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