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

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

Issue 1100973002: [2/4]Allow hotplugging of primary DRM device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-hotplug
Patch Set: unittests Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_drm.h" 5 #include "ui/ozone/platform/drm/ozone_platform_drm.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" 9 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
10 #include "ui/events/ozone/device/device_manager.h" 10 #include "ui/events/ozone/device/device_manager.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 namespace { 43 namespace {
44 44
45 // OzonePlatform for Linux DRM (Direct Rendering Manager) 45 // OzonePlatform for Linux DRM (Direct Rendering Manager)
46 // 46 //
47 // This platform is Linux without any display server (no X, wayland, or 47 // This platform is Linux without any display server (no X, wayland, or
48 // anything). This means chrome alone owns the display and input devices. 48 // anything). This means chrome alone owns the display and input devices.
49 class OzonePlatformDrm : public OzonePlatform { 49 class OzonePlatformDrm : public OzonePlatform {
50 public: 50 public:
51 OzonePlatformDrm() 51 OzonePlatformDrm()
52 : drm_(new DrmDevice(GetPrimaryDisplayCardPath())), 52 : buffer_generator_(new DrmBufferGenerator()),
53 buffer_generator_(new DrmBufferGenerator()),
54 screen_manager_(new ScreenManager(buffer_generator_.get())), 53 screen_manager_(new ScreenManager(buffer_generator_.get())),
55 device_manager_(CreateDeviceManager()) {} 54 device_manager_(CreateDeviceManager()) {}
56 ~OzonePlatformDrm() override {} 55 ~OzonePlatformDrm() override {}
57 56
58 // OzonePlatform: 57 // OzonePlatform:
59 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { 58 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
60 return surface_factory_ozone_.get(); 59 return surface_factory_ozone_.get();
61 } 60 }
62 CursorFactoryOzone* GetCursorFactoryOzone() override { 61 CursorFactoryOzone* GetCursorFactoryOzone() override {
63 return cursor_factory_ozone_.get(); 62 return cursor_factory_ozone_.get();
(...skipping 16 matching lines...) Expand all
80 scoped_ptr<DrmWindowHost> platform_window( 79 scoped_ptr<DrmWindowHost> platform_window(
81 new DrmWindowHost(delegate, bounds, gpu_platform_support_host_.get(), 80 new DrmWindowHost(delegate, bounds, gpu_platform_support_host_.get(),
82 event_factory_ozone_.get(), cursor_.get(), 81 event_factory_ozone_.get(), cursor_.get(),
83 window_manager_.get(), display_manager_.get())); 82 window_manager_.get(), display_manager_.get()));
84 platform_window->Initialize(); 83 platform_window->Initialize();
85 return platform_window.Pass(); 84 return platform_window.Pass();
86 } 85 }
87 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { 86 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
88 return make_scoped_ptr(new DrmNativeDisplayDelegate( 87 return make_scoped_ptr(new DrmNativeDisplayDelegate(
89 gpu_platform_support_host_.get(), device_manager_.get(), 88 gpu_platform_support_host_.get(), device_manager_.get(),
90 display_manager_.get(), drm_->device_path())); 89 display_manager_.get(), GetPrimaryDisplayCardPath()));
91 } 90 }
92 void InitializeUI() override { 91 void InitializeUI() override {
93 #if defined(OS_CHROMEOS) 92 #if defined(OS_CHROMEOS)
94 gpu_lock_.reset(new GpuLock()); 93 gpu_lock_.reset(new GpuLock());
95 #endif 94 #endif
96 if (!drm_->Initialize()) 95 drm_device_manager_.reset(new DrmDeviceManager(
97 LOG(FATAL) << "Failed to initialize primary DRM device"; 96 scoped_ptr<DrmDeviceGenerator>(new DrmDeviceGenerator())));
98
99 // This makes sure that simple targets that do not handle display
100 // configuration can still use the primary display.
101 ForceInitializationOfPrimaryDisplay(drm_, screen_manager_.get());
102 drm_device_manager_.reset(new DrmDeviceManager(drm_));
103 display_manager_.reset(new DisplayManager()); 97 display_manager_.reset(new DisplayManager());
104 window_manager_.reset(new DrmWindowHostManager()); 98 window_manager_.reset(new DrmWindowHostManager());
105 cursor_.reset(new DrmCursor(window_manager_.get())); 99 cursor_.reset(new DrmCursor(window_manager_.get()));
106 surface_factory_ozone_.reset(new DrmSurfaceFactory(screen_manager_.get())); 100 surface_factory_ozone_.reset(new DrmSurfaceFactory(screen_manager_.get()));
107 scoped_ptr<DrmGpuDisplayManager> ndd(new DrmGpuDisplayManager( 101 scoped_ptr<DrmGpuDisplayManager> ndd(new DrmGpuDisplayManager(
108 screen_manager_.get(), drm_, 102 screen_manager_.get(), drm_device_manager_.get()));
109 scoped_ptr<DrmDeviceGenerator>(new DrmDeviceGenerator())));
110 gpu_platform_support_.reset(new DrmGpuPlatformSupport( 103 gpu_platform_support_.reset(new DrmGpuPlatformSupport(
111 drm_device_manager_.get(), screen_manager_.get(), ndd.Pass())); 104 drm_device_manager_.get(), screen_manager_.get(), ndd.Pass()));
112 gpu_platform_support_host_.reset( 105 gpu_platform_support_host_.reset(
113 new DrmGpuPlatformSupportHost(cursor_.get())); 106 new DrmGpuPlatformSupportHost(cursor_.get()));
114 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); 107 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
115 #if defined(USE_XKBCOMMON) 108 #if defined(USE_XKBCOMMON)
116 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr( 109 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr(
117 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_))); 110 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_)));
118 #else 111 #else
119 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( 112 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
120 make_scoped_ptr(new StubKeyboardLayoutEngine())); 113 make_scoped_ptr(new StubKeyboardLayoutEngine()));
121 #endif 114 #endif
122 event_factory_ozone_.reset(new EventFactoryEvdev( 115 event_factory_ozone_.reset(new EventFactoryEvdev(
123 cursor_.get(), device_manager_.get(), 116 cursor_.get(), device_manager_.get(),
124 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); 117 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()));
125 118
126 if (!gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(), 119 if (!gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(),
127 base::ThreadTaskRunnerHandle::Get())) 120 base::ThreadTaskRunnerHandle::Get()))
128 LOG(FATAL) << "Failed to initialize dummy channel."; 121 LOG(FATAL) << "Failed to initialize dummy channel.";
129 } 122 }
130 123
131 void InitializeGPU() override {} 124 void InitializeGPU() override {}
132 125
133 private: 126 private:
134 // Objects in the "GPU" process. 127 // Objects in the "GPU" process.
135 scoped_ptr<GpuLock> gpu_lock_; 128 scoped_ptr<GpuLock> gpu_lock_;
136 scoped_refptr<DrmDevice> drm_;
137 scoped_ptr<DrmDeviceManager> drm_device_manager_; 129 scoped_ptr<DrmDeviceManager> drm_device_manager_;
138 scoped_ptr<DrmBufferGenerator> buffer_generator_; 130 scoped_ptr<DrmBufferGenerator> buffer_generator_;
139 scoped_ptr<ScreenManager> screen_manager_; 131 scoped_ptr<ScreenManager> screen_manager_;
140 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_; 132 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_;
141 133
142 // Objects in the "Browser" process. 134 // Objects in the "Browser" process.
143 scoped_ptr<DeviceManager> device_manager_; 135 scoped_ptr<DeviceManager> device_manager_;
144 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; 136 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
145 scoped_ptr<DrmWindowHostManager> window_manager_; 137 scoped_ptr<DrmWindowHostManager> window_manager_;
146 scoped_ptr<DrmCursor> cursor_; 138 scoped_ptr<DrmCursor> cursor_;
(...skipping 17 matching lines...) Expand all
164 156
165 OzonePlatform* CreateOzonePlatformDri() { 157 OzonePlatform* CreateOzonePlatformDri() {
166 return new OzonePlatformDrm; 158 return new OzonePlatformDrm;
167 } 159 }
168 160
169 OzonePlatform* CreateOzonePlatformDrm() { 161 OzonePlatform* CreateOzonePlatformDrm() {
170 return new OzonePlatformDrm; 162 return new OzonePlatformDrm;
171 } 163 }
172 164
173 } // namespace ui 165 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/drm/host/drm_native_display_delegate.cc ('k') | ui/ozone/platform/drm/ozone_platform_gbm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698