| OLD | NEW |
| 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 "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 8 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 9 #include "ui/events/ozone/device/device_manager.h" | 9 #include "ui/events/ozone/device/device_manager.h" |
| 10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 11 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 11 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 12 #include "ui/ozone/platform/dri/dri_buffer.h" | 12 #include "ui/ozone/platform/dri/dri_buffer.h" |
| 13 #include "ui/ozone/platform/dri/dri_cursor.h" | 13 #include "ui/ozone/platform/dri/dri_cursor.h" |
| 14 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" | 14 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" |
| 15 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" | 15 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" |
| 16 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 16 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
| 17 #include "ui/ozone/platform/dri/dri_window.h" | 17 #include "ui/ozone/platform/dri/dri_window.h" |
| 18 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" | 18 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" |
| 19 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" | 19 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" |
| 20 #include "ui/ozone/platform/dri/dri_window_manager.h" | 20 #include "ui/ozone/platform/dri/dri_window_manager.h" |
| 21 #include "ui/ozone/platform/dri/dri_wrapper.h" | 21 #include "ui/ozone/platform/dri/dri_wrapper.h" |
| 22 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" | 22 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" |
| 23 #include "ui/ozone/platform/dri/screen_manager.h" | 23 #include "ui/ozone/platform/dri/screen_manager.h" |
| 24 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" | |
| 25 #include "ui/ozone/public/ozone_platform.h" | 24 #include "ui/ozone/public/ozone_platform.h" |
| 26 #include "ui/ozone/public/ui_thread_gpu.h" | 25 #include "ui/ozone/public/ui_thread_gpu.h" |
| 27 | 26 |
| 28 namespace ui { | 27 namespace ui { |
| 29 | 28 |
| 30 namespace { | 29 namespace { |
| 31 | 30 |
| 32 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; | 31 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; |
| 33 | 32 |
| 34 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) | 33 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) |
| 35 // | 34 // |
| 36 // This platform is Linux without any display server (no X, wayland, or | 35 // This platform is Linux without any display server (no X, wayland, or |
| 37 // anything). This means chrome alone owns the display and input devices. | 36 // anything). This means chrome alone owns the display and input devices. |
| 38 class OzonePlatformDri : public OzonePlatform { | 37 class OzonePlatformDri : public OzonePlatform { |
| 39 public: | 38 public: |
| 40 OzonePlatformDri() | 39 OzonePlatformDri() |
| 41 : vt_manager_(new VirtualTerminalManager()), | 40 : dri_(new DriWrapper(kDefaultGraphicsCardPath)), |
| 42 dri_(new DriWrapper(kDefaultGraphicsCardPath)), | |
| 43 buffer_generator_(new DriBufferGenerator(dri_.get())), | 41 buffer_generator_(new DriBufferGenerator(dri_.get())), |
| 44 screen_manager_(new ScreenManager(dri_.get(), | 42 screen_manager_(new ScreenManager(dri_.get(), |
| 45 buffer_generator_.get())), | 43 buffer_generator_.get())), |
| 46 device_manager_(CreateDeviceManager()) { | 44 device_manager_(CreateDeviceManager()) { |
| 47 base::AtExitManager::RegisterTask( | 45 base::AtExitManager::RegisterTask( |
| 48 base::Bind(&base::DeletePointer<OzonePlatformDri>, this)); | 46 base::Bind(&base::DeletePointer<OzonePlatformDri>, this)); |
| 49 } | 47 } |
| 50 virtual ~OzonePlatformDri() {} | 48 virtual ~OzonePlatformDri() {} |
| 51 | 49 |
| 52 // OzonePlatform: | 50 // OzonePlatform: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 DriSurfaceFactory::INITIALIZED) | 95 DriSurfaceFactory::INITIALIZED) |
| 98 LOG(FATAL) << "Failed to initialize display hardware."; | 96 LOG(FATAL) << "Failed to initialize display hardware."; |
| 99 | 97 |
| 100 if (!ui_thread_gpu_.Initialize()) | 98 if (!ui_thread_gpu_.Initialize()) |
| 101 LOG(FATAL) << "Failed to initialize dummy channel."; | 99 LOG(FATAL) << "Failed to initialize dummy channel."; |
| 102 } | 100 } |
| 103 | 101 |
| 104 virtual void InitializeGPU() override {} | 102 virtual void InitializeGPU() override {} |
| 105 | 103 |
| 106 private: | 104 private: |
| 107 scoped_ptr<VirtualTerminalManager> vt_manager_; | |
| 108 scoped_ptr<DriWrapper> dri_; | 105 scoped_ptr<DriWrapper> dri_; |
| 109 scoped_ptr<DriBufferGenerator> buffer_generator_; | 106 scoped_ptr<DriBufferGenerator> buffer_generator_; |
| 110 scoped_ptr<ScreenManager> screen_manager_; | 107 scoped_ptr<ScreenManager> screen_manager_; |
| 111 scoped_ptr<DeviceManager> device_manager_; | 108 scoped_ptr<DeviceManager> device_manager_; |
| 112 | 109 |
| 113 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; | 110 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; |
| 114 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 111 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
| 115 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 112 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 116 | 113 |
| 117 scoped_ptr<DriWindowManager> window_manager_; | 114 scoped_ptr<DriWindowManager> window_manager_; |
| 118 | 115 |
| 119 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 116 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
| 120 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 117 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
| 121 | 118 |
| 122 DriWindowDelegateManager window_delegate_manager_; | 119 DriWindowDelegateManager window_delegate_manager_; |
| 123 | 120 |
| 124 UiThreadGpu ui_thread_gpu_; | 121 UiThreadGpu ui_thread_gpu_; |
| 125 | 122 |
| 126 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 123 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
| 127 }; | 124 }; |
| 128 | 125 |
| 129 } // namespace | 126 } // namespace |
| 130 | 127 |
| 131 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } | 128 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } |
| 132 | 129 |
| 133 } // namespace ui | 130 } // namespace ui |
| OLD | NEW |