| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mus_thread_proxy.h" | 5 #include "ui/ozone/platform/drm/mus_thread_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
| 9 #include "base/task_runner.h" | 9 #include "base/task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "ui/ozone/platform/drm/common/drm_util.h" |
| 11 #include "ui/ozone/platform/drm/gpu/drm_thread.h" | 12 #include "ui/ozone/platform/drm/gpu/drm_thread.h" |
| 12 #include "ui/ozone/platform/drm/gpu/proxy_helpers.h" | 13 #include "ui/ozone/platform/drm/gpu/proxy_helpers.h" |
| 13 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" | 14 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" |
| 14 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" | 15 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" |
| 15 | 16 |
| 16 namespace ui { | 17 namespace ui { |
| 17 | 18 |
| 18 CursorProxyThread::CursorProxyThread(MusThreadProxy* mus_thread_proxy) | 19 CursorProxyThread::CursorProxyThread(MusThreadProxy* mus_thread_proxy) |
| 19 : mus_thread_proxy_(mus_thread_proxy) {} | 20 : mus_thread_proxy_(mus_thread_proxy) {} |
| 20 CursorProxyThread::~CursorProxyThread() {} | 21 CursorProxyThread::~CursorProxyThread() {} |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 weak_ptr_factory_.GetWeakPtr()); | 205 weak_ptr_factory_.GetWeakPtr()); |
| 205 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); | 206 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); |
| 206 drm_thread_->task_runner()->PostTask( | 207 drm_thread_->task_runner()->PostTask( |
| 207 FROM_HERE, | 208 FROM_HERE, |
| 208 base::BindOnce(&DrmThread::RefreshNativeDisplays, | 209 base::BindOnce(&DrmThread::RefreshNativeDisplays, |
| 209 base::Unretained(drm_thread_), std::move(safe_callback))); | 210 base::Unretained(drm_thread_), std::move(safe_callback))); |
| 210 return true; | 211 return true; |
| 211 } | 212 } |
| 212 | 213 |
| 213 bool MusThreadProxy::GpuConfigureNativeDisplay(int64_t id, | 214 bool MusThreadProxy::GpuConfigureNativeDisplay(int64_t id, |
| 214 const DisplayMode_Params& mode, | 215 const DisplayMode_Params& pmode, |
| 215 const gfx::Point& origin) { | 216 const gfx::Point& origin) { |
| 216 DCHECK(drm_thread_->IsRunning()); | 217 DCHECK(drm_thread_->IsRunning()); |
| 217 DCHECK(on_window_server_thread_.CalledOnValidThread()); | 218 DCHECK(on_window_server_thread_.CalledOnValidThread()); |
| 218 | 219 |
| 220 auto mode = CreateDisplayModeFromParams(pmode); |
| 219 auto callback = | 221 auto callback = |
| 220 base::BindOnce(&MusThreadProxy::GpuConfigureNativeDisplayCallback, | 222 base::BindOnce(&MusThreadProxy::GpuConfigureNativeDisplayCallback, |
| 221 weak_ptr_factory_.GetWeakPtr()); | 223 weak_ptr_factory_.GetWeakPtr()); |
| 222 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); | 224 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); |
| 223 drm_thread_->task_runner()->PostTask( | 225 drm_thread_->task_runner()->PostTask( |
| 224 FROM_HERE, base::BindOnce(&DrmThread::ConfigureNativeDisplay, | 226 FROM_HERE, |
| 225 base::Unretained(drm_thread_), id, mode, origin, | 227 base::BindOnce(&DrmThread::ConfigureNativeDisplay, |
| 226 std::move(safe_callback))); | 228 base::Unretained(drm_thread_), id, std::move(mode), origin, |
| 229 std::move(safe_callback))); |
| 227 return true; | 230 return true; |
| 228 } | 231 } |
| 229 | 232 |
| 230 bool MusThreadProxy::GpuDisableNativeDisplay(int64_t id) { | 233 bool MusThreadProxy::GpuDisableNativeDisplay(int64_t id) { |
| 231 DCHECK(drm_thread_->IsRunning()); | 234 DCHECK(drm_thread_->IsRunning()); |
| 232 DCHECK(on_window_server_thread_.CalledOnValidThread()); | 235 DCHECK(on_window_server_thread_.CalledOnValidThread()); |
| 233 auto callback = | 236 auto callback = |
| 234 base::BindOnce(&MusThreadProxy::GpuDisableNativeDisplayCallback, | 237 base::BindOnce(&MusThreadProxy::GpuDisableNativeDisplayCallback, |
| 235 weak_ptr_factory_.GetWeakPtr()); | 238 weak_ptr_factory_.GetWeakPtr()); |
| 236 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); | 239 auto safe_callback = CreateSafeOnceCallback(std::move(callback)); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 display_manager_->GpuReceivedHDCPState(display_id, success, state); | 373 display_manager_->GpuReceivedHDCPState(display_id, success, state); |
| 371 } | 374 } |
| 372 | 375 |
| 373 void MusThreadProxy::GpuSetHDCPStateCallback(int64_t display_id, | 376 void MusThreadProxy::GpuSetHDCPStateCallback(int64_t display_id, |
| 374 bool success) const { | 377 bool success) const { |
| 375 DCHECK(on_window_server_thread_.CalledOnValidThread()); | 378 DCHECK(on_window_server_thread_.CalledOnValidThread()); |
| 376 display_manager_->GpuUpdatedHDCPState(display_id, success); | 379 display_manager_->GpuUpdatedHDCPState(display_id, success); |
| 377 } | 380 } |
| 378 | 381 |
| 379 } // namespace ui | 382 } // namespace ui |
| OLD | NEW |