OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/drm/gpu/drm_thread.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_thread.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ptr_util.h" |
11 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
12 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" | 13 #include "ui/ozone/platform/drm/gpu/drm_buffer.h" |
13 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" | 14 #include "ui/ozone/platform/drm/gpu/drm_device_generator.h" |
14 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" | 15 #include "ui/ozone/platform/drm/gpu/drm_device_manager.h" |
15 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" | 16 #include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h" |
16 #include "ui/ozone/platform/drm/gpu/drm_window.h" | 17 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
17 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" | 18 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" |
18 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" | 19 #include "ui/ozone/platform/drm/gpu/gbm_buffer.h" |
19 #include "ui/ozone/platform/drm/gpu/gbm_device.h" | 20 #include "ui/ozone/platform/drm/gpu/gbm_device.h" |
20 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" | 21 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 LOG(FATAL) << "Failed to create DRM thread"; | 84 LOG(FATAL) << "Failed to create DRM thread"; |
84 } | 85 } |
85 | 86 |
86 void DrmThread::Init() { | 87 void DrmThread::Init() { |
87 bool use_atomic = false; | 88 bool use_atomic = false; |
88 #if defined(USE_DRM_ATOMIC) | 89 #if defined(USE_DRM_ATOMIC) |
89 use_atomic = true; | 90 use_atomic = true; |
90 #endif | 91 #endif |
91 | 92 |
92 device_manager_.reset(new DrmDeviceManager( | 93 device_manager_.reset(new DrmDeviceManager( |
93 make_scoped_ptr(new GbmDeviceGenerator(use_atomic)))); | 94 base::WrapUnique(new GbmDeviceGenerator(use_atomic)))); |
94 buffer_generator_.reset(new GbmBufferGenerator()); | 95 buffer_generator_.reset(new GbmBufferGenerator()); |
95 screen_manager_.reset(new ScreenManager(buffer_generator_.get())); | 96 screen_manager_.reset(new ScreenManager(buffer_generator_.get())); |
96 | 97 |
97 display_manager_.reset( | 98 display_manager_.reset( |
98 new DrmGpuDisplayManager(screen_manager_.get(), device_manager_.get())); | 99 new DrmGpuDisplayManager(screen_manager_.get(), device_manager_.get())); |
99 } | 100 } |
100 | 101 |
101 void DrmThread::CreateBuffer(gfx::AcceleratedWidget widget, | 102 void DrmThread::CreateBuffer(gfx::AcceleratedWidget widget, |
102 const gfx::Size& size, | 103 const gfx::Size& size, |
103 gfx::BufferFormat format, | 104 gfx::BufferFormat format, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { | 143 const gfx::VSyncProvider::UpdateVSyncCallback& callback) { |
143 DrmWindow* window = screen_manager_->GetWindow(widget); | 144 DrmWindow* window = screen_manager_->GetWindow(widget); |
144 // No need to call the callback if there isn't a window since the vsync | 145 // No need to call the callback if there isn't a window since the vsync |
145 // provider doesn't require the callback to be called if there isn't a vsync | 146 // provider doesn't require the callback to be called if there isn't a vsync |
146 // data source. | 147 // data source. |
147 if (window) | 148 if (window) |
148 window->GetVSyncParameters(callback); | 149 window->GetVSyncParameters(callback); |
149 } | 150 } |
150 | 151 |
151 void DrmThread::CreateWindow(gfx::AcceleratedWidget widget) { | 152 void DrmThread::CreateWindow(gfx::AcceleratedWidget widget) { |
152 scoped_ptr<DrmWindow> window( | 153 std::unique_ptr<DrmWindow> window( |
153 new DrmWindow(widget, device_manager_.get(), screen_manager_.get())); | 154 new DrmWindow(widget, device_manager_.get(), screen_manager_.get())); |
154 window->Initialize(buffer_generator_.get()); | 155 window->Initialize(buffer_generator_.get()); |
155 screen_manager_->AddWindow(widget, std::move(window)); | 156 screen_manager_->AddWindow(widget, std::move(window)); |
156 } | 157 } |
157 | 158 |
158 void DrmThread::DestroyWindow(gfx::AcceleratedWidget widget) { | 159 void DrmThread::DestroyWindow(gfx::AcceleratedWidget widget) { |
159 scoped_ptr<DrmWindow> window = screen_manager_->RemoveWindow(widget); | 160 std::unique_ptr<DrmWindow> window = screen_manager_->RemoveWindow(widget); |
160 window->Shutdown(); | 161 window->Shutdown(); |
161 } | 162 } |
162 | 163 |
163 void DrmThread::SetWindowBounds(gfx::AcceleratedWidget widget, | 164 void DrmThread::SetWindowBounds(gfx::AcceleratedWidget widget, |
164 const gfx::Rect& bounds) { | 165 const gfx::Rect& bounds) { |
165 screen_manager_->GetWindow(widget)->SetBounds(bounds); | 166 screen_manager_->GetWindow(widget)->SetBounds(bounds); |
166 } | 167 } |
167 | 168 |
168 void DrmThread::SetCursor(gfx::AcceleratedWidget widget, | 169 void DrmThread::SetCursor(gfx::AcceleratedWidget widget, |
169 const std::vector<SkBitmap>& bitmaps, | 170 const std::vector<SkBitmap>& bitmaps, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 void DrmThread::SetColorCorrection( | 246 void DrmThread::SetColorCorrection( |
246 int64_t display_id, | 247 int64_t display_id, |
247 const std::vector<GammaRampRGBEntry>& degamma_lut, | 248 const std::vector<GammaRampRGBEntry>& degamma_lut, |
248 const std::vector<GammaRampRGBEntry>& gamma_lut, | 249 const std::vector<GammaRampRGBEntry>& gamma_lut, |
249 const std::vector<float>& correction_matrix) { | 250 const std::vector<float>& correction_matrix) { |
250 display_manager_->SetColorCorrection(display_id, degamma_lut, gamma_lut, | 251 display_manager_->SetColorCorrection(display_id, degamma_lut, gamma_lut, |
251 correction_matrix); | 252 correction_matrix); |
252 } | 253 } |
253 | 254 |
254 } // namespace ui | 255 } // namespace ui |
OLD | NEW |