| 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::SetKeyboardLayoutEngine( | 132 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(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 25 matching lines...) Expand all Loading... |
| 168 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 169 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 169 | 170 |
| 170 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 171 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
| 171 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 172 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
| 172 | 173 |
| 173 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; | 174 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; |
| 174 // Browser side object only. | 175 // Browser side object only. |
| 175 scoped_ptr<DriWindowManager> window_manager_; | 176 scoped_ptr<DriWindowManager> window_manager_; |
| 176 scoped_ptr<DisplayManager> display_manager_; | 177 scoped_ptr<DisplayManager> display_manager_; |
| 177 | 178 |
| 179 XkbEvdevCodes xkb_evdev_code_converter_; |
| 180 |
| 178 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 181 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
| 179 }; | 182 }; |
| 180 | 183 |
| 181 } // namespace | 184 } // namespace |
| 182 | 185 |
| 183 OzonePlatform* CreateOzonePlatformGbm() { | 186 OzonePlatform* CreateOzonePlatformGbm() { |
| 184 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 187 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 185 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 188 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
| 186 } | 189 } |
| 187 | 190 |
| 188 } // namespace ui | 191 } // namespace ui |
| OLD | NEW |