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

Side by Side Diff: ui/ozone/platform/dri/ozone_platform_dri.cc

Issue 908993003: [Ozone-Dri] Rename DriWrapper to DrmDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@udl3-pass-drm-fd
Patch Set: rebased Created 5 years, 9 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/dri/ozone_platform_dri.h" 5 #include "ui/ozone/platform/dri/ozone_platform_dri.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"
11 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" 11 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
12 #include "ui/events/ozone/evdev/event_factory_evdev.h" 12 #include "ui/events/ozone/evdev/event_factory_evdev.h"
13 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" 13 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
14 #include "ui/ozone/platform/dri/display_manager.h" 14 #include "ui/ozone/platform/dri/display_manager.h"
15 #include "ui/ozone/platform/dri/dri_buffer.h" 15 #include "ui/ozone/platform/dri/dri_buffer.h"
16 #include "ui/ozone/platform/dri/dri_cursor.h" 16 #include "ui/ozone/platform/dri/dri_cursor.h"
17 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" 17 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h"
18 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" 18 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h"
19 #include "ui/ozone/platform/dri/dri_surface_factory.h" 19 #include "ui/ozone/platform/dri/dri_surface_factory.h"
20 #include "ui/ozone/platform/dri/dri_util.h" 20 #include "ui/ozone/platform/dri/dri_util.h"
21 #include "ui/ozone/platform/dri/dri_window.h" 21 #include "ui/ozone/platform/dri/dri_window.h"
22 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" 22 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
23 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" 23 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
24 #include "ui/ozone/platform/dri/dri_window_manager.h" 24 #include "ui/ozone/platform/dri/dri_window_manager.h"
25 #include "ui/ozone/platform/dri/dri_wrapper.h" 25 #include "ui/ozone/platform/dri/drm_device.h"
26 #include "ui/ozone/platform/dri/drm_device_generator.h" 26 #include "ui/ozone/platform/dri/drm_device_generator.h"
27 #include "ui/ozone/platform/dri/drm_device_manager.h" 27 #include "ui/ozone/platform/dri/drm_device_manager.h"
28 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" 28 #include "ui/ozone/platform/dri/native_display_delegate_dri.h"
29 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" 29 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h"
30 #include "ui/ozone/platform/dri/screen_manager.h" 30 #include "ui/ozone/platform/dri/screen_manager.h"
31 #include "ui/ozone/public/ozone_gpu_test_helper.h" 31 #include "ui/ozone/public/ozone_gpu_test_helper.h"
32 #include "ui/ozone/public/ozone_platform.h" 32 #include "ui/ozone/public/ozone_platform.h"
33 33
34 #if defined(USE_XKBCOMMON) 34 #if defined(USE_XKBCOMMON)
35 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" 35 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h"
36 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" 36 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h"
37 #else 37 #else
38 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" 38 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
39 #endif 39 #endif
40 40
41 namespace ui { 41 namespace ui {
42 42
43 namespace { 43 namespace {
44 44
45 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) 45 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure)
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 OzonePlatformDri : public OzonePlatform { 49 class OzonePlatformDri : public OzonePlatform {
50 public: 50 public:
51 OzonePlatformDri() 51 OzonePlatformDri()
52 : dri_(new DriWrapper(GetPrimaryDisplayCardPath())), 52 : drm_(new DrmDevice(GetPrimaryDisplayCardPath())),
53 buffer_generator_(new DriBufferGenerator()), 53 buffer_generator_(new DriBufferGenerator()),
54 screen_manager_(new ScreenManager(buffer_generator_.get())), 54 screen_manager_(new ScreenManager(buffer_generator_.get())),
55 device_manager_(CreateDeviceManager()), 55 device_manager_(CreateDeviceManager()),
56 window_delegate_manager_() {} 56 window_delegate_manager_() {}
57 ~OzonePlatformDri() override {} 57 ~OzonePlatformDri() override {}
58 58
59 // OzonePlatform: 59 // OzonePlatform:
60 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { 60 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
61 return surface_factory_ozone_.get(); 61 return surface_factory_ozone_.get();
62 } 62 }
(...skipping 18 matching lines...) Expand all
81 scoped_ptr<DriWindow> platform_window( 81 scoped_ptr<DriWindow> platform_window(
82 new DriWindow(delegate, bounds, gpu_platform_support_host_.get(), 82 new DriWindow(delegate, bounds, gpu_platform_support_host_.get(),
83 event_factory_ozone_.get(), cursor_.get(), 83 event_factory_ozone_.get(), cursor_.get(),
84 window_manager_.get(), display_manager_.get())); 84 window_manager_.get(), display_manager_.get()));
85 platform_window->Initialize(); 85 platform_window->Initialize();
86 return platform_window.Pass(); 86 return platform_window.Pass();
87 } 87 }
88 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { 88 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
89 return make_scoped_ptr(new NativeDisplayDelegateProxy( 89 return make_scoped_ptr(new NativeDisplayDelegateProxy(
90 gpu_platform_support_host_.get(), device_manager_.get(), 90 gpu_platform_support_host_.get(), device_manager_.get(),
91 display_manager_.get(), dri_->device_path())); 91 display_manager_.get(), drm_->device_path()));
92 } 92 }
93 void InitializeUI() override { 93 void InitializeUI() override {
94 if (!dri_->Initialize()) 94 if (!drm_->Initialize())
95 LOG(FATAL) << "Failed to initialize primary DRM device"; 95 LOG(FATAL) << "Failed to initialize primary DRM device";
96 96
97 // This makes sure that simple targets that do not handle display 97 // This makes sure that simple targets that do not handle display
98 // configuration can still use the primary display. 98 // configuration can still use the primary display.
99 ForceInitializationOfPrimaryDisplay(dri_, screen_manager_.get()); 99 ForceInitializationOfPrimaryDisplay(drm_, screen_manager_.get());
100 drm_device_manager_.reset(new DrmDeviceManager(dri_)); 100 drm_device_manager_.reset(new DrmDeviceManager(drm_));
101 display_manager_.reset(new DisplayManager()); 101 display_manager_.reset(new DisplayManager());
102 surface_factory_ozone_.reset( 102 surface_factory_ozone_.reset(
103 new DriSurfaceFactory(&window_delegate_manager_)); 103 new DriSurfaceFactory(&window_delegate_manager_));
104 scoped_ptr<NativeDisplayDelegateDri> ndd(new NativeDisplayDelegateDri( 104 scoped_ptr<NativeDisplayDelegateDri> ndd(new NativeDisplayDelegateDri(
105 screen_manager_.get(), dri_, 105 screen_manager_.get(), drm_,
106 scoped_ptr<DrmDeviceGenerator>(new DrmDeviceGenerator()))); 106 scoped_ptr<DrmDeviceGenerator>(new DrmDeviceGenerator())));
107 gpu_platform_support_.reset(new DriGpuPlatformSupport( 107 gpu_platform_support_.reset(new DriGpuPlatformSupport(
108 drm_device_manager_.get(), &window_delegate_manager_, 108 drm_device_manager_.get(), &window_delegate_manager_,
109 screen_manager_.get(), ndd.Pass())); 109 screen_manager_.get(), ndd.Pass()));
110 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); 110 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost());
111 window_manager_.reset(new DriWindowManager()); 111 window_manager_.reset(new DriWindowManager());
112 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); 112 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
113 cursor_.reset( 113 cursor_.reset(
114 new DriCursor(window_manager_.get(), gpu_platform_support_host_.get())); 114 new DriCursor(window_manager_.get(), gpu_platform_support_host_.get()));
115 cursor_->Init(); 115 cursor_->Init();
116 #if defined(USE_XKBCOMMON) 116 #if defined(USE_XKBCOMMON)
117 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr( 117 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr(
118 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_))); 118 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_)));
119 #else 119 #else
120 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( 120 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
121 make_scoped_ptr(new StubKeyboardLayoutEngine())); 121 make_scoped_ptr(new StubKeyboardLayoutEngine()));
122 #endif 122 #endif
123 event_factory_ozone_.reset(new EventFactoryEvdev( 123 event_factory_ozone_.reset(new EventFactoryEvdev(
124 cursor_.get(), device_manager_.get(), 124 cursor_.get(), device_manager_.get(),
125 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); 125 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()));
126 126
127 if (!gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(), 127 if (!gpu_helper_.Initialize(base::ThreadTaskRunnerHandle::Get(),
128 base::ThreadTaskRunnerHandle::Get())) 128 base::ThreadTaskRunnerHandle::Get()))
129 LOG(FATAL) << "Failed to initialize dummy channel."; 129 LOG(FATAL) << "Failed to initialize dummy channel.";
130 } 130 }
131 131
132 void InitializeGPU() override {} 132 void InitializeGPU() override {}
133 133
134 private: 134 private:
135 scoped_refptr<DriWrapper> dri_; 135 scoped_refptr<DrmDevice> drm_;
136 scoped_ptr<DrmDeviceManager> drm_device_manager_; 136 scoped_ptr<DrmDeviceManager> drm_device_manager_;
137 scoped_ptr<DriBufferGenerator> buffer_generator_; 137 scoped_ptr<DriBufferGenerator> buffer_generator_;
138 scoped_ptr<ScreenManager> screen_manager_; 138 scoped_ptr<ScreenManager> screen_manager_;
139 scoped_ptr<DeviceManager> device_manager_; 139 scoped_ptr<DeviceManager> device_manager_;
140 140
141 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; 141 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_;
142 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; 142 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
143 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 143 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
144 144
145 scoped_ptr<DriCursor> cursor_; 145 scoped_ptr<DriCursor> cursor_;
(...skipping 14 matching lines...) Expand all
160 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); 160 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri);
161 }; 161 };
162 162
163 } // namespace 163 } // namespace
164 164
165 OzonePlatform* CreateOzonePlatformDri() { 165 OzonePlatform* CreateOzonePlatformDri() {
166 return new OzonePlatformDri; 166 return new OzonePlatformDri;
167 } 167 }
168 168
169 } // namespace ui 169 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/native_display_delegate_dri.cc ('k') | ui/ozone/platform/dri/ozone_platform_gbm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698