Chromium Code Reviews| 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 <gbm.h> | 7 #include <gbm.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 } | 210 } |
| 211 | 211 |
| 212 void DrmThread::MoveCursor(const gfx::AcceleratedWidget& widget, | 212 void DrmThread::MoveCursor(const gfx::AcceleratedWidget& widget, |
| 213 const gfx::Point& location) { | 213 const gfx::Point& location) { |
| 214 screen_manager_->GetWindow(widget)->MoveCursor(location); | 214 screen_manager_->GetWindow(widget)->MoveCursor(location); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void DrmThread::CheckOverlayCapabilities( | 217 void DrmThread::CheckOverlayCapabilities( |
| 218 gfx::AcceleratedWidget widget, | 218 gfx::AcceleratedWidget widget, |
| 219 const std::vector<OverlayCheck_Params>& overlays, | 219 const std::vector<OverlayCheck_Params>& overlays, |
| 220 const base::Callback<void(gfx::AcceleratedWidget, | 220 base::OnceCallback<void(gfx::AcceleratedWidget, |
| 221 const std::vector<OverlayCheck_Params>&)>& | 221 const std::vector<OverlayCheck_Params>&)> |
| 222 callback) { | 222 callback) { |
| 223 callback.Run(widget, | 223 std::move(callback).Run( |
|
dnicoara
2017/05/12 14:35:25
Just wondering why does the callback need to be mo
| |
| 224 screen_manager_->GetWindow(widget)->TestPageFlip(overlays)); | 224 widget, screen_manager_->GetWindow(widget)->TestPageFlip(overlays)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void DrmThread::RefreshNativeDisplays( | 227 void DrmThread::RefreshNativeDisplays( |
| 228 const base::Callback<void(const std::vector<DisplaySnapshot_Params>&)>& | 228 base::OnceCallback<void(const std::vector<DisplaySnapshot_Params>&)> |
| 229 callback) { | 229 callback) { |
| 230 callback.Run(display_manager_->GetDisplays()); | 230 std::move(callback).Run(display_manager_->GetDisplays()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void DrmThread::ConfigureNativeDisplay( | 233 void DrmThread::ConfigureNativeDisplay( |
| 234 int64_t id, | 234 int64_t id, |
| 235 const DisplayMode_Params& mode, | 235 const DisplayMode_Params& mode, |
| 236 const gfx::Point& origin, | 236 const gfx::Point& origin, |
| 237 const base::Callback<void(int64_t, bool)>& callback) { | 237 base::OnceCallback<void(int64_t, bool)> callback) { |
| 238 callback.Run(id, display_manager_->ConfigureDisplay(id, mode, origin)); | 238 std::move(callback).Run(id, |
| 239 display_manager_->ConfigureDisplay(id, mode, origin)); | |
| 239 } | 240 } |
| 240 | 241 |
| 241 void DrmThread::DisableNativeDisplay( | 242 void DrmThread::DisableNativeDisplay( |
| 242 int64_t id, | 243 int64_t id, |
| 243 const base::Callback<void(int64_t, bool)>& callback) { | 244 base::OnceCallback<void(int64_t, bool)> callback) { |
| 244 callback.Run(id, display_manager_->DisableDisplay(id)); | 245 std::move(callback).Run(id, display_manager_->DisableDisplay(id)); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void DrmThread::TakeDisplayControl(const base::Callback<void(bool)>& callback) { | 248 void DrmThread::TakeDisplayControl(base::OnceCallback<void(bool)> callback) { |
| 248 callback.Run(display_manager_->TakeDisplayControl()); | 249 std::move(callback).Run(display_manager_->TakeDisplayControl()); |
| 249 } | 250 } |
| 250 | 251 |
| 251 void DrmThread::RelinquishDisplayControl( | 252 void DrmThread::RelinquishDisplayControl( |
| 252 const base::Callback<void(bool)>& callback) { | 253 base::OnceCallback<void(bool)> callback) { |
| 253 display_manager_->RelinquishDisplayControl(); | 254 display_manager_->RelinquishDisplayControl(); |
| 254 callback.Run(true); | 255 std::move(callback).Run(true); |
| 255 } | 256 } |
| 256 | 257 |
| 257 void DrmThread::AddGraphicsDevice(const base::FilePath& path, | 258 void DrmThread::AddGraphicsDevice(const base::FilePath& path, |
| 258 const base::FileDescriptor& fd) { | 259 const base::FileDescriptor& fd) { |
| 259 device_manager_->AddDrmDevice(path, fd); | 260 device_manager_->AddDrmDevice(path, fd); |
| 260 } | 261 } |
| 261 | 262 |
| 262 void DrmThread::RemoveGraphicsDevice(const base::FilePath& path) { | 263 void DrmThread::RemoveGraphicsDevice(const base::FilePath& path) { |
| 263 device_manager_->RemoveDrmDevice(path); | 264 device_manager_->RemoveDrmDevice(path); |
| 264 } | 265 } |
| 265 | 266 |
| 266 void DrmThread::GetHDCPState( | 267 void DrmThread::GetHDCPState( |
| 267 int64_t display_id, | 268 int64_t display_id, |
| 268 const base::Callback<void(int64_t, bool, display::HDCPState)>& callback) { | 269 base::OnceCallback<void(int64_t, bool, display::HDCPState)> callback) { |
| 269 display::HDCPState state = display::HDCP_STATE_UNDESIRED; | 270 display::HDCPState state = display::HDCP_STATE_UNDESIRED; |
| 270 bool success = display_manager_->GetHDCPState(display_id, &state); | 271 bool success = display_manager_->GetHDCPState(display_id, &state); |
| 271 callback.Run(display_id, success, state); | 272 std::move(callback).Run(display_id, success, state); |
| 272 } | 273 } |
| 273 | 274 |
| 274 void DrmThread::SetHDCPState( | 275 void DrmThread::SetHDCPState(int64_t display_id, |
| 275 int64_t display_id, | 276 display::HDCPState state, |
| 276 display::HDCPState state, | 277 base::OnceCallback<void(int64_t, bool)> callback) { |
| 277 const base::Callback<void(int64_t, bool)>& callback) { | 278 std::move(callback).Run(display_id, |
| 278 callback.Run(display_id, display_manager_->SetHDCPState(display_id, state)); | 279 display_manager_->SetHDCPState(display_id, state)); |
| 279 } | 280 } |
| 280 | 281 |
| 281 void DrmThread::SetColorCorrection( | 282 void DrmThread::SetColorCorrection( |
| 282 int64_t display_id, | 283 int64_t display_id, |
| 283 const std::vector<display::GammaRampRGBEntry>& degamma_lut, | 284 const std::vector<display::GammaRampRGBEntry>& degamma_lut, |
| 284 const std::vector<display::GammaRampRGBEntry>& gamma_lut, | 285 const std::vector<display::GammaRampRGBEntry>& gamma_lut, |
| 285 const std::vector<float>& correction_matrix) { | 286 const std::vector<float>& correction_matrix) { |
| 286 display_manager_->SetColorCorrection(display_id, degamma_lut, gamma_lut, | 287 display_manager_->SetColorCorrection(display_id, degamma_lut, gamma_lut, |
| 287 correction_matrix); | 288 correction_matrix); |
| 288 } | 289 } |
| 289 | 290 |
| 290 // DrmThread requires a BindingSet instead of a simple Binding because it will | 291 // DrmThread requires a BindingSet instead of a simple Binding because it will |
| 291 // be used from multiple threads in multiple processes. | 292 // be used from multiple threads in multiple processes. |
| 292 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) { | 293 void DrmThread::AddBinding(ozone::mojom::DeviceCursorRequest request) { |
| 293 bindings_.AddBinding(this, std::move(request)); | 294 bindings_.AddBinding(this, std::move(request)); |
| 294 } | 295 } |
| 295 | 296 |
| 296 } // namespace ui | 297 } // namespace ui |
| OLD | NEW |