Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: ui/ozone/platform/drm/ozone_platform_gbm.cc

Issue 2870653002: ozone: Use the right thread for BinderRegistry. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_thread_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <xf86drm.h> 11 #include <xf86drm.h>
12 12
13 #include <memory> 13 #include <memory>
14 #include <utility> 14 #include <utility>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
20 #include "base/threading/thread_task_runner_handle.h"
20 #include "services/service_manager/public/cpp/bind_source_info.h" 21 #include "services/service_manager/public/cpp/bind_source_info.h"
21 #include "services/service_manager/public/cpp/binder_registry.h" 22 #include "services/service_manager/public/cpp/binder_registry.h"
22 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" 23 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
23 #include "ui/base/ui_features.h" 24 #include "ui/base/ui_features.h"
24 #include "ui/events/ozone/device/device_manager.h" 25 #include "ui/events/ozone/device/device_manager.h"
25 #include "ui/events/ozone/evdev/event_factory_evdev.h" 26 #include "ui/events/ozone/evdev/event_factory_evdev.h"
26 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" 27 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
27 #include "ui/ozone/platform/drm/common/drm_util.h" 28 #include "ui/ozone/platform/drm/common/drm_util.h"
28 #include "ui/ozone/platform/drm/cursor_proxy_mojo.h" 29 #include "ui/ozone/platform/drm/cursor_proxy_mojo.h"
29 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" 30 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return gpu_message_filter_.get(); 102 return gpu_message_filter_.get();
102 } 103 }
103 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { 104 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
104 return gpu_platform_support_host_.get(); 105 return gpu_platform_support_host_.get();
105 } 106 }
106 std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override { 107 std::unique_ptr<SystemInputInjector> CreateSystemInputInjector() override {
107 return event_factory_ozone_->CreateSystemInputInjector(); 108 return event_factory_ozone_->CreateSystemInputInjector();
108 } 109 }
109 void AddInterfaces(service_manager::BinderRegistry* registry) override { 110 void AddInterfaces(service_manager::BinderRegistry* registry) override {
110 registry->AddInterface<ozone::mojom::DeviceCursor>( 111 registry->AddInterface<ozone::mojom::DeviceCursor>(
111 base::Bind(&OzonePlatformGbm::Create, base::Unretained(this))); 112 base::Bind(&OzonePlatformGbm::Create, base::Unretained(this)),
113 gpu_task_runner_);
112 } 114 }
113 void Create(const service_manager::BindSourceInfo& source_info, 115 void Create(const service_manager::BindSourceInfo& source_info,
114 ozone::mojom::DeviceCursorRequest request) { 116 ozone::mojom::DeviceCursorRequest request) {
115 if (drm_thread_proxy_) 117 if (drm_thread_proxy_)
116 drm_thread_proxy_->AddBinding(std::move(request)); 118 drm_thread_proxy_->AddBinding(std::move(request));
117 else 119 else
118 pending_cursor_requests_.push_back(std::move(request)); 120 pending_cursor_requests_.push_back(std::move(request));
119 } 121 }
120 std::unique_ptr<PlatformWindow> CreatePlatformWindow( 122 std::unique_ptr<PlatformWindow> CreatePlatformWindow(
121 PlatformWindowDelegate* delegate, 123 PlatformWindowDelegate* delegate,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 overlay_manager_.get()); 203 overlay_manager_.get());
202 } 204 }
203 } 205 }
204 void InitializeGPU(const InitParams& args) override { 206 void InitializeGPU(const InitParams& args) override {
205 // TODO(rjkroege): services/ui should initialize this with a connector. 207 // TODO(rjkroege): services/ui should initialize this with a connector.
206 // However, in-progress refactorings in services/ui make it difficult to 208 // However, in-progress refactorings in services/ui make it difficult to
207 // require this at present. Set using_mojo_ like below once this is 209 // require this at present. Set using_mojo_ like below once this is
208 // complete. 210 // complete.
209 // using_mojo_ = args.connector != nullptr; 211 // using_mojo_ = args.connector != nullptr;
210 212
213 gpu_task_runner_ = base::ThreadTaskRunnerHandle::Get();
varad 2017/06/02 09:59:41 exo clients segfault here during ui::OzonePlatform
211 InterThreadMessagingProxy* itmp; 214 InterThreadMessagingProxy* itmp;
212 if (using_mojo_ || single_process_) { 215 if (using_mojo_ || single_process_) {
213 itmp = mus_thread_proxy_.get(); 216 itmp = mus_thread_proxy_.get();
214 } else { 217 } else {
215 gl_api_loader_.reset(new GlApiLoader()); 218 gl_api_loader_.reset(new GlApiLoader());
216 scoped_refptr<DrmThreadMessageProxy> message_proxy( 219 scoped_refptr<DrmThreadMessageProxy> message_proxy(
217 new DrmThreadMessageProxy()); 220 new DrmThreadMessageProxy());
218 itmp = message_proxy.get(); 221 itmp = message_proxy.get();
219 gpu_message_filter_ = std::move(message_proxy); 222 gpu_message_filter_ = std::move(message_proxy);
220 } 223 }
(...skipping 19 matching lines...) Expand all
240 // Bridges the DRM, GPU and main threads in mus. This must be destroyed last. 243 // Bridges the DRM, GPU and main threads in mus. This must be destroyed last.
241 std::unique_ptr<MusThreadProxy> mus_thread_proxy_; 244 std::unique_ptr<MusThreadProxy> mus_thread_proxy_;
242 245
243 // Objects in the GPU process. 246 // Objects in the GPU process.
244 std::unique_ptr<DrmThreadProxy> drm_thread_proxy_; 247 std::unique_ptr<DrmThreadProxy> drm_thread_proxy_;
245 std::unique_ptr<GlApiLoader> gl_api_loader_; 248 std::unique_ptr<GlApiLoader> gl_api_loader_;
246 std::unique_ptr<GbmSurfaceFactory> surface_factory_; 249 std::unique_ptr<GbmSurfaceFactory> surface_factory_;
247 scoped_refptr<IPC::MessageFilter> gpu_message_filter_; 250 scoped_refptr<IPC::MessageFilter> gpu_message_filter_;
248 // TODO(sad): Once the mus gpu process split happens, this can go away. 251 // TODO(sad): Once the mus gpu process split happens, this can go away.
249 std::vector<ozone::mojom::DeviceCursorRequest> pending_cursor_requests_; 252 std::vector<ozone::mojom::DeviceCursorRequest> pending_cursor_requests_;
253 scoped_refptr<base::SingleThreadTaskRunner> gpu_task_runner_;
250 254
251 // Objects in the Browser process. 255 // Objects in the Browser process.
252 std::unique_ptr<DeviceManager> device_manager_; 256 std::unique_ptr<DeviceManager> device_manager_;
253 std::unique_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; 257 std::unique_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
254 std::unique_ptr<DrmWindowHostManager> window_manager_; 258 std::unique_ptr<DrmWindowHostManager> window_manager_;
255 std::unique_ptr<DrmCursor> cursor_; 259 std::unique_ptr<DrmCursor> cursor_;
256 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_; 260 std::unique_ptr<EventFactoryEvdev> event_factory_ozone_;
257 std::unique_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_; 261 std::unique_ptr<DrmGpuPlatformSupportHost> gpu_platform_support_host_;
258 std::unique_ptr<DrmDisplayHostManager> display_manager_; 262 std::unique_ptr<DrmDisplayHostManager> display_manager_;
259 std::unique_ptr<DrmOverlayManager> overlay_manager_; 263 std::unique_ptr<DrmOverlayManager> overlay_manager_;
260 264
261 #if BUILDFLAG(USE_XKBCOMMON) 265 #if BUILDFLAG(USE_XKBCOMMON)
262 XkbEvdevCodes xkb_evdev_code_converter_; 266 XkbEvdevCodes xkb_evdev_code_converter_;
263 #endif 267 #endif
264 268
265 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); 269 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
266 }; 270 };
267 271
268 } // namespace 272 } // namespace
269 273
270 OzonePlatform* CreateOzonePlatformGbm() { 274 OzonePlatform* CreateOzonePlatformGbm() {
271 return new OzonePlatformGbm; 275 return new OzonePlatformGbm;
272 } 276 }
273 277
274 } // namespace ui 278 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698