| 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 <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <gbm.h> | 9 #include <gbm.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 104 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| 105 return gpu_platform_support_host_.get(); | 105 return gpu_platform_support_host_.get(); |
| 106 } | 106 } |
| 107 std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override { | 107 std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
| 108 return event_factory_ozone_->CreateSystemInputInjector(); | 108 return event_factory_ozone_->CreateSystemInputInjector(); |
| 109 } | 109 } |
| 110 void AddInterfaces(shell::InterfaceRegistry* registry) override { | 110 void AddInterfaces(shell::InterfaceRegistry* registry) override { |
| 111 registry->AddInterface<ozone::mojom::DeviceCursor>(this); | 111 registry->AddInterface<ozone::mojom::DeviceCursor>(this); |
| 112 } | 112 } |
| 113 // shell::InterfaceFactory<mojom::ozone::Cursor> implementation. | 113 // shell::InterfaceFactory<ozone::mojom::DeviceCursor> implementation. |
| 114 void Create(const shell::Identity& remote_identity, | 114 void Create(const shell::Identity& remote_identity, |
| 115 ozone::mojom::DeviceCursorRequest request) override { | 115 ozone::mojom::DeviceCursorRequest request) override { |
| 116 DCHECK(drm_thread_proxy_); | 116 if (drm_thread_proxy_) |
| 117 drm_thread_proxy_->AddBinding(std::move(request)); | 117 drm_thread_proxy_->AddBinding(std::move(request)); |
| 118 else |
| 119 pending_cursor_requests_.push_back(std::move(request)); |
| 118 } | 120 } |
| 119 std::unique_ptr<PlatformWindow> CreatePlatformWindow( | 121 std::unique_ptr<PlatformWindow> CreatePlatformWindow( |
| 120 PlatformWindowDelegate* delegate, | 122 PlatformWindowDelegate* delegate, |
| 121 const gfx::Rect& bounds) override { | 123 const gfx::Rect& bounds) override { |
| 122 GpuThreadAdapter* adapter = gpu_platform_support_host_.get(); | 124 GpuThreadAdapter* adapter = gpu_platform_support_host_.get(); |
| 123 if (using_mojo_ || single_process_) { | 125 if (using_mojo_ || single_process_) { |
| 124 DCHECK(drm_thread_proxy_) | 126 DCHECK(drm_thread_proxy_) |
| 125 << "drm_thread_proxy_ should exist (and be running) here."; | 127 << "drm_thread_proxy_ should exist (and be running) here."; |
| 126 adapter = mus_thread_proxy_.get(); | 128 adapter = mus_thread_proxy_.get(); |
| 127 } | 129 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 230 |
| 229 // NOTE: Can't start the thread here since this is called before sandbox | 231 // NOTE: Can't start the thread here since this is called before sandbox |
| 230 // initialization in multi-process Chrome. In mus, we start the DRM thread. | 232 // initialization in multi-process Chrome. In mus, we start the DRM thread. |
| 231 drm_thread_proxy_.reset(new DrmThreadProxy()); | 233 drm_thread_proxy_.reset(new DrmThreadProxy()); |
| 232 drm_thread_proxy_->BindThreadIntoMessagingProxy(itmp); | 234 drm_thread_proxy_->BindThreadIntoMessagingProxy(itmp); |
| 233 | 235 |
| 234 surface_factory_.reset(new GbmSurfaceFactory(drm_thread_proxy_.get())); | 236 surface_factory_.reset(new GbmSurfaceFactory(drm_thread_proxy_.get())); |
| 235 if (using_mojo_ || single_process_) { | 237 if (using_mojo_ || single_process_) { |
| 236 mus_thread_proxy_->StartDrmThread(); | 238 mus_thread_proxy_->StartDrmThread(); |
| 237 } | 239 } |
| 240 for (auto& request : pending_cursor_requests_) |
| 241 drm_thread_proxy_->AddBinding(std::move(request)); |
| 242 pending_cursor_requests_.clear(); |
| 238 } | 243 } |
| 239 | 244 |
| 240 private: | 245 private: |
| 241 bool using_mojo_; | 246 bool using_mojo_; |
| 242 bool single_process_; | 247 bool single_process_; |
| 243 | 248 |
| 244 // Objects in the GPU process. | 249 // Objects in the GPU process. |
| 245 std::unique_ptr<DrmThreadProxy> drm_thread_proxy_; | 250 std::unique_ptr<DrmThreadProxy> drm_thread_proxy_; |
| 246 std::unique_ptr<GlApiLoader> gl_api_loader_; | 251 std::unique_ptr<GlApiLoader> gl_api_loader_; |
| 247 std::unique_ptr<GbmSurfaceFactory> surface_factory_; | 252 std::unique_ptr<GbmSurfaceFactory> surface_factory_; |
| 248 scoped_refptr<IPC::MessageFilter> gpu_message_filter_; | 253 scoped_refptr<IPC::MessageFilter> gpu_message_filter_; |
| 254 // TODO(sad): Once the mus gpu process split happens, this can go away. |
| 255 std::vector<ozone::mojom::DeviceCursorRequest> pending_cursor_requests_; |
| 249 | 256 |
| 250 // Objects in the Browser process. | 257 // Objects in the Browser process. |
| 251 std::unique_ptr<DeviceManager> device_manager_; | 258 std::unique_ptr<DeviceManager> device_manager_; |
| 252 std::unique_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 259 std::unique_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
| 253 std::unique_ptr<DrmWindowHostManager> window_manager_; | 260 std::unique_ptr<DrmWindowHostManager> window_manager_; |
| 254 std::unique_ptr<DrmCursor> cursor_; | 261 std::unique_ptr<DrmCursor> cursor_; |
| 255 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; | 262 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 256 std::unique_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_; | 263 std::unique_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_; |
| 257 std::unique_ptr<DrmDisplayHostManager> display_manager_; | 264 std::unique_ptr<DrmDisplayHostManager> display_manager_; |
| 258 std::unique_ptr<DrmOverlayManager> overlay_manager_; | 265 std::unique_ptr<DrmOverlayManager> overlay_manager_; |
| 259 | 266 |
| 260 // Bridges the DRM, GPU and main threads in mus. | 267 // Bridges the DRM, GPU and main threads in mus. |
| 261 std::unique_ptr<MusThreadProxy> mus_thread_proxy_; | 268 std::unique_ptr<MusThreadProxy> mus_thread_proxy_; |
| 262 | 269 |
| 263 #if defined(USE_XKBCOMMON) | 270 #if defined(USE_XKBCOMMON) |
| 264 XkbEvdevCodes xkb_evdev_code_converter_; | 271 XkbEvdevCodes xkb_evdev_code_converter_; |
| 265 #endif | 272 #endif |
| 266 | 273 |
| 267 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 274 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
| 268 }; | 275 }; |
| 269 | 276 |
| 270 } // namespace | 277 } // namespace |
| 271 | 278 |
| 272 OzonePlatform* CreateOzonePlatformGbm() { | 279 OzonePlatform* CreateOzonePlatformGbm() { |
| 273 return new OzonePlatformGbm; | 280 return new OzonePlatformGbm; |
| 274 } | 281 } |
| 275 | 282 |
| 276 } // namespace ui | 283 } // namespace ui |
| OLD | NEW |