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 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 scoped_ptr<DriWindow> platform_window( | 137 scoped_ptr<DriWindow> platform_window( |
138 new DriWindow(delegate, bounds, gpu_platform_support_host_.get(), | 138 new DriWindow(delegate, bounds, gpu_platform_support_host_.get(), |
139 event_factory_ozone_.get(), cursor_.get(), | 139 event_factory_ozone_.get(), cursor_.get(), |
140 window_manager_.get(), display_manager_.get())); | 140 window_manager_.get(), display_manager_.get())); |
141 platform_window->Initialize(); | 141 platform_window->Initialize(); |
142 return platform_window.Pass(); | 142 return platform_window.Pass(); |
143 } | 143 } |
144 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 144 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
145 return make_scoped_ptr(new NativeDisplayDelegateProxy( | 145 return make_scoped_ptr(new NativeDisplayDelegateProxy( |
146 gpu_platform_support_host_.get(), device_manager_.get(), | 146 gpu_platform_support_host_.get(), device_manager_.get(), |
147 display_manager_.get())); | 147 display_manager_.get(), primary_graphics_card_path_)); |
148 } | 148 } |
149 void InitializeUI() override { | 149 void InitializeUI() override { |
150 primary_graphics_card_path_ = GetFirstDisplayCardPath(); | |
alexst (slow to review)
2015/02/25 18:54:50
GetPrimaryDsiplayCardPath for consistency? I know
dnicoara
2015/02/25 19:03:17
Done.
| |
150 display_manager_.reset(new DisplayManager()); | 151 display_manager_.reset(new DisplayManager()); |
151 // Needed since the browser process creates the accelerated widgets and that | 152 // Needed since the browser process creates the accelerated widgets and that |
152 // happens through SFO. | 153 // happens through SFO. |
153 if (!surface_factory_ozone_) | 154 if (!surface_factory_ozone_) |
154 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 155 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
155 device_manager_ = CreateDeviceManager(); | 156 device_manager_ = CreateDeviceManager(); |
156 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); | 157 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); |
157 window_manager_.reset(new DriWindowManager()); | 158 window_manager_.reset(new DriWindowManager()); |
158 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 159 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
159 cursor_.reset( | 160 cursor_.reset( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 scoped_ptr<NativeDisplayDelegateDri> ndd(new NativeDisplayDelegateDri( | 195 scoped_ptr<NativeDisplayDelegateDri> ndd(new NativeDisplayDelegateDri( |
195 screen_manager_.get(), gbm_, | 196 screen_manager_.get(), gbm_, |
196 scoped_ptr<DrmDeviceGenerator>(new GbmDeviceGenerator()))); | 197 scoped_ptr<DrmDeviceGenerator>(new GbmDeviceGenerator()))); |
197 gpu_platform_support_.reset(new DriGpuPlatformSupport( | 198 gpu_platform_support_.reset(new DriGpuPlatformSupport( |
198 drm_device_manager_.get(), window_delegate_manager_.get(), | 199 drm_device_manager_.get(), window_delegate_manager_.get(), |
199 screen_manager_.get(), ndd.Pass())); | 200 screen_manager_.get(), ndd.Pass())); |
200 } | 201 } |
201 | 202 |
202 private: | 203 private: |
203 bool use_surfaceless_; | 204 bool use_surfaceless_; |
205 base::FilePath primary_graphics_card_path_; | |
204 scoped_ptr<GlApiLoader> gl_api_loader_; | 206 scoped_ptr<GlApiLoader> gl_api_loader_; |
205 scoped_refptr<GbmWrapper> gbm_; | 207 scoped_refptr<GbmWrapper> gbm_; |
206 scoped_ptr<DrmDeviceManager> drm_device_manager_; | 208 scoped_ptr<DrmDeviceManager> drm_device_manager_; |
207 scoped_ptr<GbmBufferGenerator> buffer_generator_; | 209 scoped_ptr<GbmBufferGenerator> buffer_generator_; |
208 scoped_ptr<ScreenManager> screen_manager_; | 210 scoped_ptr<ScreenManager> screen_manager_; |
209 scoped_ptr<DeviceManager> device_manager_; | 211 scoped_ptr<DeviceManager> device_manager_; |
210 | 212 |
211 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 213 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
212 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 214 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
213 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 215 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
(...skipping 19 matching lines...) Expand all Loading... | |
233 OzonePlatform* CreateOzonePlatformGbm() { | 235 OzonePlatform* CreateOzonePlatformGbm() { |
234 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 236 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
235 #if defined(USE_MESA_PLATFORM_NULL) | 237 #if defined(USE_MESA_PLATFORM_NULL) |
236 // Only works with surfaceless. | 238 // Only works with surfaceless. |
237 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); | 239 cmd->AppendSwitch(switches::kOzoneUseSurfaceless); |
238 #endif | 240 #endif |
239 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 241 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
240 } | 242 } |
241 | 243 |
242 } // namespace ui | 244 } // namespace ui |
OLD | NEW |