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/events/ozone/device/device_manager.h" | 13 #include "ui/events/ozone/device/device_manager.h" |
14 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 14 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
15 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" | 15 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" |
16 #include "ui/ozone/platform/dri/dri_window.h" | 16 #include "ui/ozone/platform/dri/dri_window.h" |
| 17 #include "ui/ozone/platform/dri/dri_window_manager.h" |
17 #include "ui/ozone/platform/dri/dri_wrapper.h" | 18 #include "ui/ozone/platform/dri/dri_wrapper.h" |
18 #include "ui/ozone/platform/dri/gbm_buffer.h" | 19 #include "ui/ozone/platform/dri/gbm_buffer.h" |
19 #include "ui/ozone/platform/dri/gbm_surface.h" | 20 #include "ui/ozone/platform/dri/gbm_surface.h" |
20 #include "ui/ozone/platform/dri/gbm_surface_factory.h" | 21 #include "ui/ozone/platform/dri/gbm_surface_factory.h" |
21 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" | 22 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" |
22 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" | 23 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
23 #include "ui/ozone/platform/dri/scanout_buffer.h" | 24 #include "ui/ozone/platform/dri/scanout_buffer.h" |
24 #include "ui/ozone/platform/dri/screen_manager.h" | 25 #include "ui/ozone/platform/dri/screen_manager.h" |
25 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" | 26 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" |
26 #include "ui/ozone/public/cursor_factory_ozone.h" | 27 #include "ui/ozone/public/cursor_factory_ozone.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); | 134 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); |
134 screen_manager_.reset(new ScreenManager(dri_.get(), | 135 screen_manager_.reset(new ScreenManager(dri_.get(), |
135 buffer_generator_.get())); | 136 buffer_generator_.get())); |
136 if (!surface_factory_ozone_) | 137 if (!surface_factory_ozone_) |
137 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); | 138 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); |
138 | 139 |
139 surface_factory_ozone_->InitializeGpu(dri_.get(), | 140 surface_factory_ozone_->InitializeGpu(dri_.get(), |
140 buffer_generator_->device(), | 141 buffer_generator_->device(), |
141 screen_manager_.get()); | 142 screen_manager_.get()); |
142 gpu_platform_support_.reset( | 143 gpu_platform_support_.reset( |
143 new GpuPlatformSupportGbm(surface_factory_ozone_.get())); | 144 new GpuPlatformSupportGbm(surface_factory_ozone_.get(), |
| 145 &gpu_window_manager_, |
| 146 screen_manager_.get())); |
144 #if defined(OS_CHROMEOS) | 147 #if defined(OS_CHROMEOS) |
145 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>( | 148 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>( |
146 new DisplayMessageHandler( | 149 new DisplayMessageHandler( |
147 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( | 150 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( |
148 dri_.get(), | 151 dri_.get(), |
149 screen_manager_.get(), | 152 screen_manager_.get(), |
150 NULL))))); | 153 NULL))))); |
151 #endif | 154 #endif |
152 if (surface_factory_ozone_->InitializeHardware() != | 155 if (surface_factory_ozone_->InitializeHardware() != |
153 DriSurfaceFactory::INITIALIZED) | 156 DriSurfaceFactory::INITIALIZED) |
154 LOG(FATAL) << "failed to initialize display hardware"; | 157 LOG(FATAL) << "failed to initialize display hardware"; |
155 } | 158 } |
156 | 159 |
157 private: | 160 private: |
158 bool use_surfaceless_; | 161 bool use_surfaceless_; |
159 scoped_ptr<VirtualTerminalManager> vt_manager_; | 162 scoped_ptr<VirtualTerminalManager> vt_manager_; |
160 scoped_ptr<DriWrapper> dri_; | 163 scoped_ptr<DriWrapper> dri_; |
161 scoped_ptr<GbmBufferGenerator> buffer_generator_; | 164 scoped_ptr<GbmBufferGenerator> buffer_generator_; |
162 scoped_ptr<ScreenManager> screen_manager_; | 165 scoped_ptr<ScreenManager> screen_manager_; |
163 scoped_ptr<DeviceManager> device_manager_; | 166 scoped_ptr<DeviceManager> device_manager_; |
164 | 167 |
165 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; | 168 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; |
166 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; | 169 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; |
167 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 170 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
168 | 171 |
169 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; | 172 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; |
170 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; | 173 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; |
171 | 174 |
| 175 DriWindowManager gpu_window_manager_; |
| 176 |
172 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); | 177 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); |
173 }; | 178 }; |
174 | 179 |
175 } // namespace | 180 } // namespace |
176 | 181 |
177 OzonePlatform* CreateOzonePlatformGbm() { | 182 OzonePlatform* CreateOzonePlatformGbm() { |
178 CommandLine* cmd = CommandLine::ForCurrentProcess(); | 183 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
179 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); | 184 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); |
180 } | 185 } |
181 | 186 |
182 } // namespace ui | 187 } // namespace ui |
OLD | NEW |