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/drm/ozone_platform_gbm.h" | 5 #include "ui/ozone/platform/drm/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 |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "ui/ozone/platform/drm/host/drm_cursor.h" | 29 #include "ui/ozone/platform/drm/host/drm_cursor.h" |
30 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" | 30 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" |
31 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" | 31 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" |
32 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" | 32 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" |
33 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" | 33 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" |
34 #include "ui/ozone/platform/drm/host/drm_window_host.h" | 34 #include "ui/ozone/platform/drm/host/drm_window_host.h" |
35 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" | 35 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" |
36 #include "ui/ozone/public/cursor_factory_ozone.h" | 36 #include "ui/ozone/public/cursor_factory_ozone.h" |
37 #include "ui/ozone/public/gpu_platform_support.h" | 37 #include "ui/ozone/public/gpu_platform_support.h" |
38 #include "ui/ozone/public/gpu_platform_support_host.h" | 38 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 39 #include "ui/ozone/public/ipc_init_helper_ozone.h" |
39 #include "ui/ozone/public/ozone_gpu_test_helper.h" | 40 #include "ui/ozone/public/ozone_gpu_test_helper.h" |
40 #include "ui/ozone/public/ozone_platform.h" | 41 #include "ui/ozone/public/ozone_platform.h" |
41 #include "ui/ozone/public/ozone_switches.h" | 42 #include "ui/ozone/public/ozone_switches.h" |
42 | 43 |
43 #if defined(USE_XKBCOMMON) | 44 #if defined(USE_XKBCOMMON) |
44 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" | 45 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" |
45 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" | 46 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" |
46 #else | 47 #else |
47 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | 48 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
48 #endif | 49 #endif |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 105 } |
105 | 106 |
106 private: | 107 private: |
107 bool use_atomic_; | 108 bool use_atomic_; |
108 | 109 |
109 DISALLOW_COPY_AND_ASSIGN(GbmDeviceGenerator); | 110 DISALLOW_COPY_AND_ASSIGN(GbmDeviceGenerator); |
110 }; | 111 }; |
111 | 112 |
112 class OzonePlatformGbm : public OzonePlatform { | 113 class OzonePlatformGbm : public OzonePlatform { |
113 public: | 114 public: |
114 OzonePlatformGbm(bool use_surfaceless) : use_surfaceless_(use_surfaceless) {} | 115 OzonePlatformGbm(bool use_surfaceless) |
| 116 : use_surfaceless_(use_surfaceless), |
| 117 ipc_init_helper_ozone_(IpcInitHelperOzone::Create()) {} |
115 ~OzonePlatformGbm() override {} | 118 ~OzonePlatformGbm() override {} |
116 | 119 |
117 // OzonePlatform: | 120 // OzonePlatform: |
118 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { | 121 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
119 return surface_factory_ozone_.get(); | 122 return surface_factory_ozone_.get(); |
120 } | 123 } |
121 OverlayManagerOzone* GetOverlayManager() override { | 124 OverlayManagerOzone* GetOverlayManager() override { |
122 return overlay_manager_.get(); | 125 return overlay_manager_.get(); |
123 } | 126 } |
124 CursorFactoryOzone* GetCursorFactoryOzone() override { | 127 CursorFactoryOzone* GetCursorFactoryOzone() override { |
125 NOTIMPLEMENTED(); | 128 NOTIMPLEMENTED(); |
126 return nullptr; | 129 return nullptr; |
127 } | 130 } |
128 InputController* GetInputController() override { | 131 InputController* GetInputController() override { |
129 return event_factory_ozone_->input_controller(); | 132 return event_factory_ozone_->input_controller(); |
130 } | 133 } |
131 GpuPlatformSupport* GetGpuPlatformSupport() override { | 134 GpuPlatformSupport* GetGpuPlatformSupport() override { |
132 return gpu_platform_support_.get(); | 135 return gpu_platform_support_.get(); |
133 } | 136 } |
134 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 137 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
135 return gpu_platform_support_host_.get(); | 138 return gpu_platform_support_host_.get(); |
136 } | 139 } |
| 140 IpcInitHelperOzone* GetIpcInitHelperOzone() override { |
| 141 return ipc_init_helper_ozone_.get(); |
| 142 } |
137 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { | 143 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
138 return event_factory_ozone_->CreateSystemInputInjector(); | 144 return event_factory_ozone_->CreateSystemInputInjector(); |
139 } | 145 } |
140 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 146 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
141 PlatformWindowDelegate* delegate, | 147 PlatformWindowDelegate* delegate, |
142 const gfx::Rect& bounds) override { | 148 const gfx::Rect& bounds) override { |
143 scoped_ptr<DrmWindowHost> platform_window( | 149 scoped_ptr<DrmWindowHost> platform_window( |
144 new DrmWindowHost(delegate, bounds, gpu_platform_support_host_.get(), | 150 new DrmWindowHost(delegate, bounds, gpu_platform_support_host_.get(), |
145 event_factory_ozone_.get(), cursor_.get(), | 151 event_factory_ozone_.get(), cursor_.get(), |
146 window_manager_.get(), display_manager_.get())); | 152 window_manager_.get(), display_manager_.get())); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 scoped_ptr<DrmGpuDisplayManager> display_manager(new DrmGpuDisplayManager( | 196 scoped_ptr<DrmGpuDisplayManager> display_manager(new DrmGpuDisplayManager( |
191 screen_manager_.get(), drm_device_manager_.get())); | 197 screen_manager_.get(), drm_device_manager_.get())); |
192 gpu_platform_support_.reset(new DrmGpuPlatformSupport( | 198 gpu_platform_support_.reset(new DrmGpuPlatformSupport( |
193 drm_device_manager_.get(), screen_manager_.get(), | 199 drm_device_manager_.get(), screen_manager_.get(), |
194 buffer_generator_.get(), display_manager.Pass())); | 200 buffer_generator_.get(), display_manager.Pass())); |
195 } | 201 } |
196 | 202 |
197 private: | 203 private: |
198 // Objects in both processes. | 204 // Objects in both processes. |
199 bool use_surfaceless_; | 205 bool use_surfaceless_; |
| 206 scoped_ptr<IpcInitHelperOzone> ipc_init_helper_ozone_; |
200 | 207 |
201 // Objects in the GPU process. | 208 // Objects in the GPU process. |
202 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 209 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
203 scoped_ptr<GlApiLoader> gl_api_loader_; | 210 scoped_ptr<GlApiLoader> gl_api_loader_; |
204 scoped_ptr<DrmDeviceManager> drm_device_manager_; | 211 scoped_ptr<DrmDeviceManager> drm_device_manager_; |
205 scoped_ptr<GbmBufferGenerator> buffer_generator_; | 212 scoped_ptr<GbmBufferGenerator> buffer_generator_; |
206 scoped_ptr<ScreenManager> screen_manager_; | 213 scoped_ptr<ScreenManager> screen_manager_; |
207 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_; | 214 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_; |
208 | 215 |
209 // Objects in the Browser process. | 216 // Objects in the Browser process. |
210 scoped_ptr<DeviceManager> device_manager_; | 217 scoped_ptr<DeviceManager> device_manager_; |
211 scoped_ptr<DrmWindowHostManager> window_manager_; | 218 scoped_ptr<DrmWindowHostManager> window_manager_; |
212 scoped_ptr<DrmCursor> cursor_; | 219 scoped_ptr<DrmCursor> cursor_; |
213 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 220 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
214 scoped_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_; | 221 scoped_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_; |
215 scoped_ptr<DrmDisplayHostManager> display_manager_; | 222 scoped_ptr<DrmDisplayHostManager> display_manager_; |
216 scoped_ptr<DrmOverlayManager> overlay_manager_; | 223 scoped_ptr<DrmOverlayManager> overlay_manager_; |
217 | 224 |
218 #if defined(USE_XKBCOMMON) | 225 #if defined(USE_XKBCOMMON) |
219 XkbEvdevCodes xkb_evdev_code_converter_; | 226 XkbEvdevCodes xkb_evdev_code_converter_; |
220 #endif | 227 #endif |
221 | 228 |
222 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 229 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
223 }; | 230 }; |
224 | 231 |
225 } // namespace | 232 } // namespace |
226 | 233 |
227 OzonePlatform* CreateOzonePlatformGbm() { | 234 OzonePlatform* CreateOzonePlatformGbm() { |
228 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 235 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
229 #if defined(USE_MESA_PLATFORM_NULL) | 236 // Always go surfaceless. |
230 // Only works with surfaceless. | |
231 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); | 237 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); |
232 #endif | |
233 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 238 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
234 } | 239 } |
235 | 240 |
236 } // namespace ui | 241 } // namespace ui |
OLD | NEW |