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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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<mojom::ozone::Cursor> 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_); | 116 DCHECK(drm_thread_proxy_); |
117 drm_thread_->AddBinding(std::move(request)); | 117 drm_thread_proxy_->AddBinding(std::move(request)); |
118 } | 118 } |
119 std::unique_ptr<PlatformWindow> CreatePlatformWindow( | 119 std::unique_ptr<PlatformWindow> CreatePlatformWindow( |
120 PlatformWindowDelegate* delegate, | 120 PlatformWindowDelegate* delegate, |
121 const gfx::Rect& bounds) override { | 121 const gfx::Rect& bounds) override { |
122 GpuThreadAdapter* adapter = gpu_platform_support_host_.get(); | 122 GpuThreadAdapter* adapter = gpu_platform_support_host_.get(); |
123 if (using_mojo_ || single_process_) { | 123 if (using_mojo_ || single_process_) { |
124 DCHECK(drm_thread_) << "drm_thread_ should exist (and be running) here."; | 124 DCHECK(drm_thread_proxy_) |
| 125 << "drm_thread_proxy_ should exist (and be running) here."; |
125 adapter = mus_thread_proxy_.get(); | 126 adapter = mus_thread_proxy_.get(); |
126 } | 127 } |
127 | 128 |
128 std::unique_ptr<DrmWindowHost> platform_window(new DrmWindowHost( | 129 std::unique_ptr<DrmWindowHost> platform_window(new DrmWindowHost( |
129 delegate, bounds, adapter, event_factory_ozone_.get(), cursor_.get(), | 130 delegate, bounds, adapter, event_factory_ozone_.get(), cursor_.get(), |
130 window_manager_.get(), display_manager_.get(), overlay_manager_.get())); | 131 window_manager_.get(), display_manager_.get(), overlay_manager_.get())); |
131 platform_window->Initialize(); | 132 platform_window->Initialize(); |
132 return std::move(platform_window); | 133 return std::move(platform_window); |
133 } | 134 } |
134 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 135 std::unique_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } else { | 221 } else { |
221 gl_api_loader_.reset(new GlApiLoader()); | 222 gl_api_loader_.reset(new GlApiLoader()); |
222 scoped_refptr<DrmThreadMessageProxy> message_proxy( | 223 scoped_refptr<DrmThreadMessageProxy> message_proxy( |
223 new DrmThreadMessageProxy()); | 224 new DrmThreadMessageProxy()); |
224 itmp = message_proxy.get(); | 225 itmp = message_proxy.get(); |
225 gpu_message_filter_ = std::move(message_proxy); | 226 gpu_message_filter_ = std::move(message_proxy); |
226 } | 227 } |
227 | 228 |
228 // NOTE: Can't start the thread here since this is called before sandbox | 229 // NOTE: Can't start the thread here since this is called before sandbox |
229 // initialization in multi-process Chrome. In mus, we start the DRM thread. | 230 // initialization in multi-process Chrome. In mus, we start the DRM thread. |
230 drm_thread_.reset(new DrmThreadProxy()); | 231 drm_thread_proxy_.reset(new DrmThreadProxy()); |
231 drm_thread_->BindThreadIntoMessagingProxy(itmp); | 232 drm_thread_proxy_->BindThreadIntoMessagingProxy(itmp); |
232 | 233 |
233 surface_factory_.reset(new GbmSurfaceFactory(drm_thread_.get())); | 234 surface_factory_.reset(new GbmSurfaceFactory(drm_thread_proxy_.get())); |
234 if (using_mojo_ || single_process_) { | 235 if (using_mojo_ || single_process_) { |
235 mus_thread_proxy_->StartDrmThread(); | 236 mus_thread_proxy_->StartDrmThread(); |
236 } | 237 } |
237 } | 238 } |
238 | 239 |
239 private: | 240 private: |
240 bool using_mojo_; | 241 bool using_mojo_; |
241 bool single_process_; | 242 bool single_process_; |
242 | 243 |
243 // Objects in the GPU process. | 244 // Objects in the GPU process. |
244 // TODO(rjk): rename drm_thread_ to drm_thread_proxy_; | 245 std::unique_ptr<DrmThreadProxy> drm_thread_proxy_; |
245 std::unique_ptr<DrmThreadProxy> drm_thread_; | |
246 std::unique_ptr<GlApiLoader> gl_api_loader_; | 246 std::unique_ptr<GlApiLoader> gl_api_loader_; |
247 std::unique_ptr<GbmSurfaceFactory> surface_factory_; | 247 std::unique_ptr<GbmSurfaceFactory> surface_factory_; |
248 scoped_refptr<IPC::MessageFilter> gpu_message_filter_; | 248 scoped_refptr<IPC::MessageFilter> gpu_message_filter_; |
249 | 249 |
250 // Objects in the Browser process. | 250 // Objects in the Browser process. |
251 std::unique_ptr<DeviceManager> device_manager_; | 251 std::unique_ptr<DeviceManager> device_manager_; |
252 std::unique_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 252 std::unique_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
253 std::unique_ptr<DrmWindowHostManager> window_manager_; | 253 std::unique_ptr<DrmWindowHostManager> window_manager_; |
254 std::unique_ptr<DrmCursor> cursor_; | 254 std::unique_ptr<DrmCursor> cursor_; |
255 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; | 255 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; |
(...skipping 11 matching lines...) Expand all Loading... |
267 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 267 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
268 }; | 268 }; |
269 | 269 |
270 } // namespace | 270 } // namespace |
271 | 271 |
272 OzonePlatform* CreateOzonePlatformGbm() { | 272 OzonePlatform* CreateOzonePlatformGbm() { |
273 return new OzonePlatformGbm; | 273 return new OzonePlatformGbm; |
274 } | 274 } |
275 | 275 |
276 } // namespace ui | 276 } // namespace ui |
OLD | NEW |