| 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/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 13 #include "ui/events/ozone/device/device_manager.h" | 14 #include "ui/events/ozone/device/device_manager.h" |
| 14 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 15 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 15 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" | 16 #include "ui/ozone/platform/dri/dri_cursor.h" |
| 16 #include "ui/ozone/platform/dri/dri_window.h" | 17 #include "ui/ozone/platform/dri/dri_window.h" |
| 17 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" | 18 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" |
| 18 #include "ui/ozone/platform/dri/dri_window_manager.h" | 19 #include "ui/ozone/platform/dri/dri_window_manager.h" |
| 19 #include "ui/ozone/platform/dri/dri_wrapper.h" | 20 #include "ui/ozone/platform/dri/dri_wrapper.h" |
| 20 #include "ui/ozone/platform/dri/gbm_buffer.h" | 21 #include "ui/ozone/platform/dri/gbm_buffer.h" |
| 21 #include "ui/ozone/platform/dri/gbm_surface.h" | 22 #include "ui/ozone/platform/dri/gbm_surface.h" |
| 22 #include "ui/ozone/platform/dri/gbm_surface_factory.h" | 23 #include "ui/ozone/platform/dri/gbm_surface_factory.h" |
| 23 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" | 24 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" |
| 24 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" | 25 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
| 25 #include "ui/ozone/platform/dri/scanout_buffer.h" | 26 #include "ui/ozone/platform/dri/scanout_buffer.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 99 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 99 PlatformWindowDelegate* delegate, | 100 PlatformWindowDelegate* delegate, |
| 100 const gfx::Rect& bounds) OVERRIDE { | 101 const gfx::Rect& bounds) OVERRIDE { |
| 101 scoped_ptr<DriWindow> platform_window( | 102 scoped_ptr<DriWindow> platform_window( |
| 102 new DriWindow(delegate, | 103 new DriWindow(delegate, |
| 103 bounds, | 104 bounds, |
| 104 scoped_ptr<DriWindowDelegate>(new DriWindowDelegateProxy( | 105 scoped_ptr<DriWindowDelegate>(new DriWindowDelegateProxy( |
| 105 ui_window_manager_.NextAcceleratedWidget(), | 106 ui_window_manager_.NextAcceleratedWidget(), |
| 106 gpu_platform_support_host_.get())), | 107 gpu_platform_support_host_.get())), |
| 107 event_factory_ozone_.get(), | 108 event_factory_ozone_.get(), |
| 108 &ui_window_manager_)); | 109 &ui_window_manager_, |
| 110 cursor_.get())); |
| 109 platform_window->Initialize(); | 111 platform_window->Initialize(); |
| 110 return platform_window.PassAs<PlatformWindow>(); | 112 return platform_window.PassAs<PlatformWindow>(); |
| 111 } | 113 } |
| 112 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
| 113 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 115 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 114 OVERRIDE { | 116 OVERRIDE { |
| 115 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( | 117 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( |
| 116 gpu_platform_support_host_.get(), device_manager_.get())); | 118 gpu_platform_support_host_.get(), device_manager_.get())); |
| 117 } | 119 } |
| 118 virtual scoped_ptr<TouchscreenDeviceManager> | 120 virtual scoped_ptr<TouchscreenDeviceManager> |
| 119 CreateTouchscreenDeviceManager() OVERRIDE { | 121 CreateTouchscreenDeviceManager() OVERRIDE { |
| 120 return scoped_ptr<TouchscreenDeviceManager>( | 122 return scoped_ptr<TouchscreenDeviceManager>( |
| 121 new TouchscreenDeviceManagerOzone()); | 123 new TouchscreenDeviceManagerOzone()); |
| 122 } | 124 } |
| 123 #endif | 125 #endif |
| 124 virtual void InitializeUI() OVERRIDE { | 126 virtual void InitializeUI() OVERRIDE { |
| 125 vt_manager_.reset(new VirtualTerminalManager()); | 127 vt_manager_.reset(new VirtualTerminalManager()); |
| 126 // Needed since the browser process creates the accelerated widgets and that | 128 // Needed since the browser process creates the accelerated widgets and that |
| 127 // happens through SFO. | 129 // happens through SFO. |
| 128 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 130 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
| 129 device_manager_ = CreateDeviceManager(); | 131 device_manager_ = CreateDeviceManager(); |
| 130 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); | 132 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); |
| 131 cursor_factory_ozone_.reset( | 133 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
| 132 new CursorFactoryEvdevDri(gpu_platform_support_host_.get())); | 134 cursor_.reset(new DriCursor(gpu_platform_support_host_.get())); |
| 133 event_factory_ozone_.reset(new EventFactoryEvdev( | 135 event_factory_ozone_.reset( |
| 134 cursor_factory_ozone_.get(), device_manager_.get())); | 136 new EventFactoryEvdev(cursor_.get(), device_manager_.get())); |
| 135 } | 137 } |
| 136 | 138 |
| 137 virtual void InitializeGPU() OVERRIDE { | 139 virtual void InitializeGPU() OVERRIDE { |
| 138 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); | 140 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); |
| 139 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); | 141 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); |
| 140 screen_manager_.reset(new ScreenManager(dri_.get(), | 142 screen_manager_.reset(new ScreenManager(dri_.get(), |
| 141 buffer_generator_.get())); | 143 buffer_generator_.get())); |
| 142 if (!surface_factory_ozone_) | 144 if (!surface_factory_ozone_) |
| 143 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 145 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
| 144 | 146 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 165 | 167 |
| 166 private: | 168 private: |
| 167 bool use_surfaceless_; | 169 bool use_surfaceless_; |
| 168 scoped_ptr<VirtualTerminalManager> vt_manager_; | 170 scoped_ptr<VirtualTerminalManager> vt_manager_; |
| 169 scoped_ptr<DriWrapper> dri_; | 171 scoped_ptr<DriWrapper> dri_; |
| 170 scoped_ptr<GbmBufferGenerator> buffer_generator_; | 172 scoped_ptr<GbmBufferGenerator> buffer_generator_; |
| 171 scoped_ptr<ScreenManager> screen_manager_; | 173 scoped_ptr<ScreenManager> screen_manager_; |
| 172 scoped_ptr<DeviceManager> device_manager_; | 174 scoped_ptr<DeviceManager> device_manager_; |
| 173 | 175 |
| 174 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 176 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
| 175 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; | 177 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
| 178 scoped_ptr<DriCursor> cursor_; |
| 176 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 179 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 177 | 180 |
| 178 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; | 181 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; |
| 179 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; | 182 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; |
| 180 | 183 |
| 181 DriWindowManager gpu_window_manager_; | 184 DriWindowManager gpu_window_manager_; |
| 182 DriWindowManager ui_window_manager_; | 185 DriWindowManager ui_window_manager_; |
| 183 | 186 |
| 184 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 187 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
| 185 }; | 188 }; |
| 186 | 189 |
| 187 } // namespace | 190 } // namespace |
| 188 | 191 |
| 189 OzonePlatform* CreateOzonePlatformGbm() { | 192 OzonePlatform* CreateOzonePlatformGbm() { |
| 190 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 193 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 191 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 194 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
| 192 } | 195 } |
| 193 | 196 |
| 194 } // namespace ui | 197 } // namespace ui |
| OLD | NEW |