| 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/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 14 #include "ui/events/ozone/device/device_manager.h" | 14 #include "ui/events/ozone/device/device_manager.h" |
| 15 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 15 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 16 #include "ui/ozone/platform/dri/display_manager.h" |
| 16 #include "ui/ozone/platform/dri/dri_cursor.h" | 17 #include "ui/ozone/platform/dri/dri_cursor.h" |
| 17 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" | 18 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" |
| 18 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" | 19 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" |
| 19 #include "ui/ozone/platform/dri/dri_window.h" | 20 #include "ui/ozone/platform/dri/dri_window.h" |
| 20 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" | 21 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" |
| 21 #include "ui/ozone/platform/dri/dri_window_manager.h" | 22 #include "ui/ozone/platform/dri/dri_window_manager.h" |
| 22 #include "ui/ozone/platform/dri/dri_wrapper.h" | 23 #include "ui/ozone/platform/dri/dri_wrapper.h" |
| 23 #include "ui/ozone/platform/dri/gbm_buffer.h" | 24 #include "ui/ozone/platform/dri/gbm_buffer.h" |
| 24 #include "ui/ozone/platform/dri/gbm_surface.h" | 25 #include "ui/ozone/platform/dri/gbm_surface.h" |
| 25 #include "ui/ozone/platform/dri/gbm_surface_factory.h" | 26 #include "ui/ozone/platform/dri/gbm_surface_factory.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return gpu_platform_support_host_.get(); | 96 return gpu_platform_support_host_.get(); |
| 96 } | 97 } |
| 97 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 98 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 98 PlatformWindowDelegate* delegate, | 99 PlatformWindowDelegate* delegate, |
| 99 const gfx::Rect& bounds) override { | 100 const gfx::Rect& bounds) override { |
| 100 scoped_ptr<DriWindow> platform_window( | 101 scoped_ptr<DriWindow> platform_window( |
| 101 new DriWindow(delegate, | 102 new DriWindow(delegate, |
| 102 bounds, | 103 bounds, |
| 103 gpu_platform_support_host_.get(), | 104 gpu_platform_support_host_.get(), |
| 104 event_factory_ozone_.get(), | 105 event_factory_ozone_.get(), |
| 105 window_manager_.get())); | 106 window_manager_.get(), |
| 107 display_manager_.get())); |
| 106 platform_window->Initialize(); | 108 platform_window->Initialize(); |
| 107 return platform_window.Pass(); | 109 return platform_window.Pass(); |
| 108 } | 110 } |
| 109 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 111 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 110 override { | 112 override { |
| 111 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( | 113 return scoped_ptr<NativeDisplayDelegate>( |
| 112 gpu_platform_support_host_.get(), device_manager_.get())); | 114 new NativeDisplayDelegateProxy(gpu_platform_support_host_.get(), |
| 115 device_manager_.get(), |
| 116 display_manager_.get())); |
| 113 } | 117 } |
| 114 virtual void InitializeUI() override { | 118 virtual void InitializeUI() override { |
| 115 vt_manager_.reset(new VirtualTerminalManager()); | 119 vt_manager_.reset(new VirtualTerminalManager()); |
| 120 display_manager_.reset(new DisplayManager()); |
| 116 // Needed since the browser process creates the accelerated widgets and that | 121 // Needed since the browser process creates the accelerated widgets and that |
| 117 // happens through SFO. | 122 // happens through SFO. |
| 118 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 123 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
| 119 device_manager_ = CreateDeviceManager(); | 124 device_manager_ = CreateDeviceManager(); |
| 120 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); | 125 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); |
| 121 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 126 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
| 122 window_manager_.reset( | 127 window_manager_.reset( |
| 123 new DriWindowManager(gpu_platform_support_host_.get())); | 128 new DriWindowManager(gpu_platform_support_host_.get())); |
| 124 event_factory_ozone_.reset(new EventFactoryEvdev(window_manager_->cursor(), | 129 event_factory_ozone_.reset(new EventFactoryEvdev(window_manager_->cursor(), |
| 125 device_manager_.get())); | 130 device_manager_.get())); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 167 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
| 163 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 168 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 164 | 169 |
| 165 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 170 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
| 166 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 171 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
| 167 | 172 |
| 168 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; | 173 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; |
| 169 // Browser side object only. | 174 // Browser side object only. |
| 170 scoped_ptr<DriWindowManager> window_manager_; | 175 scoped_ptr<DriWindowManager> window_manager_; |
| 171 | 176 |
| 177 scoped_ptr<DisplayManager> display_manager_; |
| 178 |
| 172 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 179 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
| 173 }; | 180 }; |
| 174 | 181 |
| 175 } // namespace | 182 } // namespace |
| 176 | 183 |
| 177 OzonePlatform* CreateOzonePlatformGbm() { | 184 OzonePlatform* CreateOzonePlatformGbm() { |
| 178 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 185 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
| 179 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 186 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
| 180 } | 187 } |
| 181 | 188 |
| 182 } // namespace ui | 189 } // namespace ui |
| OLD | NEW |