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/dri/ozone_platform_gbm.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <gbm.h> | 8 #include <gbm.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 14 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
15 #include "ui/events/ozone/device/device_manager.h" | 15 #include "ui/events/ozone/device/device_manager.h" |
16 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 16 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
18 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | 18 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" |
| 19 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" |
19 #include "ui/ozone/platform/dri/display_manager.h" | 20 #include "ui/ozone/platform/dri/display_manager.h" |
20 #include "ui/ozone/platform/dri/dri_cursor.h" | 21 #include "ui/ozone/platform/dri/dri_cursor.h" |
21 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" | 22 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" |
22 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" | 23 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" |
23 #include "ui/ozone/platform/dri/dri_window.h" | 24 #include "ui/ozone/platform/dri/dri_window.h" |
24 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" | 25 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" |
25 #include "ui/ozone/platform/dri/dri_window_manager.h" | 26 #include "ui/ozone/platform/dri/dri_window_manager.h" |
26 #include "ui/ozone/platform/dri/dri_wrapper.h" | 27 #include "ui/ozone/platform/dri/dri_wrapper.h" |
27 #include "ui/ozone/platform/dri/gbm_buffer.h" | 28 #include "ui/ozone/platform/dri/gbm_buffer.h" |
28 #include "ui/ozone/platform/dri/gbm_surface.h" | 29 #include "ui/ozone/platform/dri/gbm_surface.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void InitializeUI() override { | 122 void InitializeUI() override { |
122 display_manager_.reset(new DisplayManager()); | 123 display_manager_.reset(new DisplayManager()); |
123 // Needed since the browser process creates the accelerated widgets and that | 124 // Needed since the browser process creates the accelerated widgets and that |
124 // happens through SFO. | 125 // happens through SFO. |
125 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 126 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
126 device_manager_ = CreateDeviceManager(); | 127 device_manager_ = CreateDeviceManager(); |
127 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); | 128 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); |
128 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 129 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
129 window_manager_.reset( | 130 window_manager_.reset( |
130 new DriWindowManager(gpu_platform_support_host_.get())); | 131 new DriWindowManager(gpu_platform_support_host_.get())); |
131 KeyboardLayoutEngineManager::Create( | 132 KeyboardLayoutEngineManager::Create(make_scoped_ptr( |
132 make_scoped_ptr(new StubKeyboardLayoutEngine())); | 133 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_))); |
133 event_factory_ozone_.reset(new EventFactoryEvdev( | 134 event_factory_ozone_.reset(new EventFactoryEvdev( |
134 window_manager_->cursor(), device_manager_.get(), | 135 window_manager_->cursor(), device_manager_.get(), |
135 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); | 136 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); |
136 } | 137 } |
137 | 138 |
138 void InitializeGPU() override { | 139 void InitializeGPU() override { |
139 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); | 140 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); |
140 dri_->Initialize(); | 141 dri_->Initialize(); |
141 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); | 142 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); |
142 screen_manager_.reset( | 143 screen_manager_.reset( |
(...skipping 28 matching lines...) Expand all Loading... |
171 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 172 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
172 | 173 |
173 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 174 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
174 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 175 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
175 | 176 |
176 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; | 177 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; |
177 // Browser side object only. | 178 // Browser side object only. |
178 scoped_ptr<DriWindowManager> window_manager_; | 179 scoped_ptr<DriWindowManager> window_manager_; |
179 scoped_ptr<DisplayManager> display_manager_; | 180 scoped_ptr<DisplayManager> display_manager_; |
180 | 181 |
| 182 XkbEvdevCodes xkb_evdev_code_converter_; |
| 183 |
181 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 184 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
182 }; | 185 }; |
183 | 186 |
184 } // namespace | 187 } // namespace |
185 | 188 |
186 OzonePlatform* CreateOzonePlatformGbm() { | 189 OzonePlatform* CreateOzonePlatformGbm() { |
187 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 190 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
188 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 191 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
189 } | 192 } |
190 | 193 |
191 } // namespace ui | 194 } // namespace ui |
OLD | NEW |