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/dri_cursor.h" | 16 #include "ui/ozone/platform/dri/dri_cursor.h" |
17 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" | 17 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" |
18 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" | 18 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" |
19 #include "ui/ozone/platform/dri/dri_window.h" | 19 #include "ui/ozone/platform/dri/dri_window.h" |
20 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" | 20 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" |
21 #include "ui/ozone/platform/dri/dri_window_manager.h" | 21 #include "ui/ozone/platform/dri/dri_window_manager.h" |
22 #include "ui/ozone/platform/dri/dri_wrapper.h" | 22 #include "ui/ozone/platform/dri/dri_wrapper.h" |
23 #include "ui/ozone/platform/dri/gbm_buffer.h" | 23 #include "ui/ozone/platform/dri/gbm_buffer.h" |
24 #include "ui/ozone/platform/dri/gbm_surface.h" | 24 #include "ui/ozone/platform/dri/gbm_surface.h" |
25 #include "ui/ozone/platform/dri/gbm_surface_factory.h" | 25 #include "ui/ozone/platform/dri/gbm_surface_factory.h" |
26 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" | 26 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" |
27 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" | 27 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" |
28 #include "ui/ozone/platform/dri/scanout_buffer.h" | 28 #include "ui/ozone/platform/dri/scanout_buffer.h" |
29 #include "ui/ozone/platform/dri/screen_manager.h" | 29 #include "ui/ozone/platform/dri/screen_manager.h" |
30 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" | |
31 #include "ui/ozone/public/cursor_factory_ozone.h" | 30 #include "ui/ozone/public/cursor_factory_ozone.h" |
32 #include "ui/ozone/public/gpu_platform_support.h" | 31 #include "ui/ozone/public/gpu_platform_support.h" |
33 #include "ui/ozone/public/gpu_platform_support_host.h" | 32 #include "ui/ozone/public/gpu_platform_support_host.h" |
34 #include "ui/ozone/public/ozone_platform.h" | 33 #include "ui/ozone/public/ozone_platform.h" |
35 #include "ui/ozone/public/ozone_switches.h" | 34 #include "ui/ozone/public/ozone_switches.h" |
36 | 35 |
37 namespace ui { | 36 namespace ui { |
38 | 37 |
39 namespace { | 38 namespace { |
40 | 39 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 window_manager_.get())); | 104 window_manager_.get())); |
106 platform_window->Initialize(); | 105 platform_window->Initialize(); |
107 return platform_window.Pass(); | 106 return platform_window.Pass(); |
108 } | 107 } |
109 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 108 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
110 override { | 109 override { |
111 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( | 110 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( |
112 gpu_platform_support_host_.get(), device_manager_.get())); | 111 gpu_platform_support_host_.get(), device_manager_.get())); |
113 } | 112 } |
114 virtual void InitializeUI() override { | 113 virtual void InitializeUI() override { |
115 vt_manager_.reset(new VirtualTerminalManager()); | |
116 // Needed since the browser process creates the accelerated widgets and that | 114 // Needed since the browser process creates the accelerated widgets and that |
117 // happens through SFO. | 115 // happens through SFO. |
118 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 116 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
119 device_manager_ = CreateDeviceManager(); | 117 device_manager_ = CreateDeviceManager(); |
120 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); | 118 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); |
121 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 119 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
122 window_manager_.reset( | 120 window_manager_.reset( |
123 new DriWindowManager(gpu_platform_support_host_.get())); | 121 new DriWindowManager(gpu_platform_support_host_.get())); |
124 event_factory_ozone_.reset(new EventFactoryEvdev(window_manager_->cursor(), | 122 event_factory_ozone_.reset(new EventFactoryEvdev(window_manager_->cursor(), |
125 device_manager_.get())); | 123 device_manager_.get())); |
(...skipping 19 matching lines...) Expand all Loading... |
145 screen_manager_.get(), | 143 screen_manager_.get(), |
146 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( | 144 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( |
147 dri_.get(), screen_manager_.get(), NULL)))); | 145 dri_.get(), screen_manager_.get(), NULL)))); |
148 if (surface_factory_ozone_->InitializeHardware() != | 146 if (surface_factory_ozone_->InitializeHardware() != |
149 DriSurfaceFactory::INITIALIZED) | 147 DriSurfaceFactory::INITIALIZED) |
150 LOG(FATAL) << "failed to initialize display hardware"; | 148 LOG(FATAL) << "failed to initialize display hardware"; |
151 } | 149 } |
152 | 150 |
153 private: | 151 private: |
154 bool use_surfaceless_; | 152 bool use_surfaceless_; |
155 scoped_ptr<VirtualTerminalManager> vt_manager_; | |
156 scoped_ptr<DriWrapper> dri_; | 153 scoped_ptr<DriWrapper> dri_; |
157 scoped_ptr<GbmBufferGenerator> buffer_generator_; | 154 scoped_ptr<GbmBufferGenerator> buffer_generator_; |
158 scoped_ptr<ScreenManager> screen_manager_; | 155 scoped_ptr<ScreenManager> screen_manager_; |
159 scoped_ptr<DeviceManager> device_manager_; | 156 scoped_ptr<DeviceManager> device_manager_; |
160 | 157 |
161 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 158 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
162 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 159 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
163 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 160 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
164 | 161 |
165 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 162 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
166 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 163 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
167 | 164 |
168 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; | 165 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; |
169 // Browser side object only. | 166 // Browser side object only. |
170 scoped_ptr<DriWindowManager> window_manager_; | 167 scoped_ptr<DriWindowManager> window_manager_; |
171 | 168 |
172 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 169 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
173 }; | 170 }; |
174 | 171 |
175 } // namespace | 172 } // namespace |
176 | 173 |
177 OzonePlatform* CreateOzonePlatformGbm() { | 174 OzonePlatform* CreateOzonePlatformGbm() { |
178 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 175 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
179 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 176 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
180 } | 177 } |
181 | 178 |
182 } // namespace ui | 179 } // namespace ui |
OLD | NEW |