| 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/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 <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/ozone/platform/drm/common/drm_util.h" | 18 #include "ui/ozone/platform/drm/common/drm_util.h" |
| 19 #include "ui/ozone/platform/drm/gbm_surface_factory.h" | 19 #include "ui/ozone/platform/drm/gbm_surface_factory.h" |
| 20 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" | 20 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" |
| 21 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" | 21 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
| 22 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" | 22 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" |
| 23 #include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support.h" | 23 #include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support.h" |
| 24 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" | 24 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" |
| 25 #include "ui/ozone/platform/drm/gpu/gbm_device.h" | 25 #include "ui/ozone/platform/drm/gpu/gbm_device.h" |
| 26 #include "ui/ozone/platform/drm/gpu/gbm_surface.h" | 26 #include "ui/ozone/platform/drm/gpu/gbm_surface.h" |
| 27 #include "ui/ozone/platform/drm/gpu/gpu_lock.h" | |
| 28 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" | 27 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| 29 #include "ui/ozone/platform/drm/gpu/screen_manager.h" | 28 #include "ui/ozone/platform/drm/gpu/screen_manager.h" |
| 30 #include "ui/ozone/platform/drm/host/drm_cursor.h" | 29 #include "ui/ozone/platform/drm/host/drm_cursor.h" |
| 31 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" | 30 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" |
| 32 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" | 31 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" |
| 33 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" | 32 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h" |
| 34 #include "ui/ozone/platform/drm/host/drm_window_host.h" | 33 #include "ui/ozone/platform/drm/host/drm_window_host.h" |
| 35 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" | 34 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" |
| 36 #include "ui/ozone/public/cursor_factory_ozone.h" | 35 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 37 #include "ui/ozone/public/gpu_platform_support.h" | 36 #include "ui/ozone/public/gpu_platform_support.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 #else | 162 #else |
| 164 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 163 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 165 make_scoped_ptr(new StubKeyboardLayoutEngine())); | 164 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
| 166 #endif | 165 #endif |
| 167 event_factory_ozone_.reset(new EventFactoryEvdev( | 166 event_factory_ozone_.reset(new EventFactoryEvdev( |
| 168 cursor_.get(), device_manager_.get(), | 167 cursor_.get(), device_manager_.get(), |
| 169 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); | 168 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); |
| 170 } | 169 } |
| 171 | 170 |
| 172 void InitializeGPU() override { | 171 void InitializeGPU() override { |
| 173 #if defined(OS_CHROMEOS) | |
| 174 gpu_lock_.reset(new GpuLock()); | |
| 175 #endif | |
| 176 gl_api_loader_.reset(new GlApiLoader()); | 172 gl_api_loader_.reset(new GlApiLoader()); |
| 177 drm_device_manager_.reset(new DrmDeviceManager( | 173 drm_device_manager_.reset(new DrmDeviceManager( |
| 178 scoped_ptr<DrmDeviceGenerator>(new GbmDeviceGenerator()))); | 174 scoped_ptr<DrmDeviceGenerator>(new GbmDeviceGenerator()))); |
| 179 buffer_generator_.reset(new GbmBufferGenerator()); | 175 buffer_generator_.reset(new GbmBufferGenerator()); |
| 180 screen_manager_.reset(new ScreenManager(buffer_generator_.get())); | 176 screen_manager_.reset(new ScreenManager(buffer_generator_.get())); |
| 181 if (!surface_factory_ozone_) | 177 if (!surface_factory_ozone_) |
| 182 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 178 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
| 183 | 179 |
| 184 surface_factory_ozone_->InitializeGpu(drm_device_manager_.get(), | 180 surface_factory_ozone_->InitializeGpu(drm_device_manager_.get(), |
| 185 screen_manager_.get()); | 181 screen_manager_.get()); |
| 186 scoped_ptr<DrmGpuDisplayManager> ndd(new DrmGpuDisplayManager( | 182 scoped_ptr<DrmGpuDisplayManager> ndd(new DrmGpuDisplayManager( |
| 187 screen_manager_.get(), drm_device_manager_.get())); | 183 screen_manager_.get(), drm_device_manager_.get())); |
| 188 gpu_platform_support_.reset(new DrmGpuPlatformSupport( | 184 gpu_platform_support_.reset(new DrmGpuPlatformSupport( |
| 189 drm_device_manager_.get(), screen_manager_.get(), ndd.Pass())); | 185 drm_device_manager_.get(), screen_manager_.get(), ndd.Pass())); |
| 190 } | 186 } |
| 191 | 187 |
| 192 private: | 188 private: |
| 193 // Objects in both processes. | 189 // Objects in both processes. |
| 194 bool use_surfaceless_; | 190 bool use_surfaceless_; |
| 195 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 191 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
| 196 | 192 |
| 197 // Objects in the GPU process. | 193 // Objects in the GPU process. |
| 198 scoped_ptr<GpuLock> gpu_lock_; | |
| 199 scoped_ptr<GlApiLoader> gl_api_loader_; | 194 scoped_ptr<GlApiLoader> gl_api_loader_; |
| 200 scoped_ptr<DrmDeviceManager> drm_device_manager_; | 195 scoped_ptr<DrmDeviceManager> drm_device_manager_; |
| 201 scoped_ptr<GbmBufferGenerator> buffer_generator_; | 196 scoped_ptr<GbmBufferGenerator> buffer_generator_; |
| 202 scoped_ptr<ScreenManager> screen_manager_; | 197 scoped_ptr<ScreenManager> screen_manager_; |
| 203 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_; | 198 scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_; |
| 204 | 199 |
| 205 // Objects in the Browser process. | 200 // Objects in the Browser process. |
| 206 scoped_ptr<DeviceManager> device_manager_; | 201 scoped_ptr<DeviceManager> device_manager_; |
| 207 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 202 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
| 208 scoped_ptr<DrmWindowHostManager> window_manager_; | 203 scoped_ptr<DrmWindowHostManager> window_manager_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 223 OzonePlatform* CreateOzonePlatformGbm() { | 218 OzonePlatform* CreateOzonePlatformGbm() { |
| 224 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 219 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 225 #if defined(USE_MESA_PLATFORM_NULL) | 220 #if defined(USE_MESA_PLATFORM_NULL) |
| 226 // Only works with surfaceless. | 221 // Only works with surfaceless. |
| 227 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); | 222 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); |
| 228 #endif | 223 #endif |
| 229 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 224 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
| 230 } | 225 } |
| 231 | 226 |
| 232 } // namespace ui | 227 } // namespace ui |
| OLD | NEW |