OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <gbm.h> | 8 #include <gbm.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "ui/events/ozone/device/device_manager.h" | 12 #include "ui/events/ozone/device/device_manager.h" |
13 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 13 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
14 #include "ui/ozone/ozone_platform.h" | 14 #include "ui/ozone/ozone_platform.h" |
15 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" | 15 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" |
16 #include "ui/ozone/platform/dri/dri_wrapper.h" | 16 #include "ui/ozone/platform/dri/dri_wrapper.h" |
17 #include "ui/ozone/platform/dri/gbm_surface.h" | 17 #include "ui/ozone/platform/dri/gbm_surface.h" |
18 #include "ui/ozone/platform/dri/gbm_surface_factory.h" | 18 #include "ui/ozone/platform/dri/gbm_surface_factory.h" |
19 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" | 19 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" |
20 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" | 20 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
21 #include "ui/ozone/platform/dri/scanout_surface.h" | 21 #include "ui/ozone/platform/dri/scanout_surface.h" |
22 #include "ui/ozone/platform/dri/screen_manager.h" | 22 #include "ui/ozone/platform/dri/screen_manager.h" |
23 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" | 23 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" |
24 #include "ui/ozone/public/cursor_factory_ozone.h" | 24 #include "ui/ozone/public/cursor_factory_ozone.h" |
25 #include "ui/ozone/public/gpu_platform_support.h" | 25 #include "ui/ozone/public/gpu_platform_support.h" |
26 #include "ui/ozone/public/gpu_platform_support_host.h" | 26 #include "ui/ozone/public/gpu_platform_support_host.h" |
27 | 27 |
28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
29 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" | |
30 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" | 29 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" |
| 30 #include "ui/ozone/platform/dri/chromeos/display_message_handler.h" |
| 31 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" |
| 32 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_proxy.h" |
31 #endif | 33 #endif |
32 | 34 |
33 namespace ui { | 35 namespace ui { |
34 | 36 |
35 namespace { | 37 namespace { |
36 | 38 |
37 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; | 39 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; |
38 | 40 |
39 class GbmSurfaceGenerator : public ScanoutSurfaceGenerator { | 41 class GbmSurfaceGenerator : public ScanoutSurfaceGenerator { |
40 public: | 42 public: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 87 } |
86 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { | 88 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { |
87 return gpu_platform_support_.get(); | 89 return gpu_platform_support_.get(); |
88 } | 90 } |
89 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { | 91 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { |
90 return gpu_platform_support_host_.get(); | 92 return gpu_platform_support_host_.get(); |
91 } | 93 } |
92 #if defined(OS_CHROMEOS) | 94 #if defined(OS_CHROMEOS) |
93 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 95 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
94 OVERRIDE { | 96 OVERRIDE { |
95 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 97 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( |
| 98 gpu_platform_support_host_.get(), device_manager_.get())); |
96 } | 99 } |
97 virtual scoped_ptr<TouchscreenDeviceManager> | 100 virtual scoped_ptr<TouchscreenDeviceManager> |
98 CreateTouchscreenDeviceManager() OVERRIDE { | 101 CreateTouchscreenDeviceManager() OVERRIDE { |
99 return scoped_ptr<TouchscreenDeviceManager>( | 102 return scoped_ptr<TouchscreenDeviceManager>( |
100 new TouchscreenDeviceManagerOzone()); | 103 new TouchscreenDeviceManagerOzone()); |
101 } | 104 } |
102 #endif | 105 #endif |
103 virtual void InitializeUI() OVERRIDE { | 106 virtual void InitializeUI() OVERRIDE { |
104 vt_manager_.reset(new VirtualTerminalManager()); | 107 vt_manager_.reset(new VirtualTerminalManager()); |
105 // Needed since the browser process creates the accelerated widgets and that | 108 // Needed since the browser process creates the accelerated widgets and that |
(...skipping 15 matching lines...) Expand all Loading... |
121 surface_generator_.get())); | 124 surface_generator_.get())); |
122 if (!surface_factory_ozone_) | 125 if (!surface_factory_ozone_) |
123 surface_factory_ozone_.reset(new GbmSurfaceFactory()); | 126 surface_factory_ozone_.reset(new GbmSurfaceFactory()); |
124 | 127 |
125 surface_factory_ozone_->InitializeGpu(dri_.get(), | 128 surface_factory_ozone_->InitializeGpu(dri_.get(), |
126 surface_generator_->device(), | 129 surface_generator_->device(), |
127 screen_manager_.get()); | 130 screen_manager_.get()); |
128 | 131 |
129 gpu_platform_support_.reset( | 132 gpu_platform_support_.reset( |
130 new GpuPlatformSupportGbm(surface_factory_ozone_.get())); | 133 new GpuPlatformSupportGbm(surface_factory_ozone_.get())); |
| 134 #if defined(OS_CHROMEOS) |
| 135 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>( |
| 136 new DisplayMessageHandler( |
| 137 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( |
| 138 dri_.get(), |
| 139 screen_manager_.get(), |
| 140 NULL))))); |
| 141 #endif |
131 } | 142 } |
132 | 143 |
133 private: | 144 private: |
134 scoped_ptr<VirtualTerminalManager> vt_manager_; | 145 scoped_ptr<VirtualTerminalManager> vt_manager_; |
135 scoped_ptr<DriWrapper> dri_; | 146 scoped_ptr<DriWrapper> dri_; |
136 scoped_ptr<GbmSurfaceGenerator> surface_generator_; | 147 scoped_ptr<GbmSurfaceGenerator> surface_generator_; |
137 scoped_ptr<ScreenManager> screen_manager_; | 148 scoped_ptr<ScreenManager> screen_manager_; |
138 scoped_ptr<DeviceManager> device_manager_; | 149 scoped_ptr<DeviceManager> device_manager_; |
139 | 150 |
140 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 151 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
141 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; | 152 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; |
142 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 153 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
143 | 154 |
144 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; | 155 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; |
145 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; | 156 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; |
146 | 157 |
147 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 158 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
148 }; | 159 }; |
149 | 160 |
150 } // namespace | 161 } // namespace |
151 | 162 |
152 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; } | 163 OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; } |
153 | 164 |
154 } // namespace ui | 165 } // namespace ui |
OLD | NEW |