| Index: ui/ozone/platform/drm/gpu/drm_thread_proxy.cc
|
| diff --git a/ui/ozone/platform/drm/gpu/drm_thread_proxy.cc b/ui/ozone/platform/drm/gpu/drm_thread_proxy.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..018e3e1d1e4bbda8d4c325f03ce1e2260cf701e7
|
| --- /dev/null
|
| +++ b/ui/ozone/platform/drm/gpu/drm_thread_proxy.cc
|
| @@ -0,0 +1,162 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/ozone/platform/drm/gpu/drm_thread_proxy.h"
|
| +
|
| +namespace ui {
|
| +
|
| +DrmThreadProxy::DrmThreadProxy() : drm_thread_("DrmThread") {}
|
| +
|
| +void DrmThreadProxy::Initialize() {
|
| + // The DRM thread needs to be started late since we need to wait for the
|
| + // sandbox to start.
|
| + drm_thread_->Start();
|
| +}
|
| +
|
| +void DrmThreadProxy::OnCreateWindow(gfx::AcceleratedWidget widget) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnCreateWindow,
|
| + base::Unretained(&drm_thread_), widget));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnDestroyWindow(gfx::AcceleratedWidget widget) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnDestroyWindow,
|
| + base::Unretained(&drm_thread_), widget));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnWindowBoundsChanged(gfx::AcceleratedWidget widget,
|
| + const gfx::Rect& bounds) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnWindowBoundsChanged,
|
| + base::Unretained(&drm_thread_), widget, bounds));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnCursorSet(gfx::AcceleratedWidget widget,
|
| + const std::vector<SkBitmap>& bitmaps,
|
| + const gfx::Point& location,
|
| + int frame_delay_ms) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(DrmThread::OnCursorSet, base::Unretained(&drm_thread_), widget,
|
| + bitmaps, location, frame_delay_ms));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnCursorMove(gfx::AcceleratedWidget widget,
|
| + const gfx::Point& location) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnCursorMove,
|
| + base::Unretained(&drm_thread_), widget, location));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnCheckOverlayCapabilities(
|
| + gfx::AcceleratedWidget widget,
|
| + const std::vector<OverlayCheck_Params>& overlays,
|
| + const base::Callback<void(gfx::AcceleratedWidget, bool)>& callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnCheckOverlayCapabilities,
|
| + base::Unretained(&drm_thread_), widget, overlays,
|
| + CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnRefreshNativeDisplays(
|
| + const base::Callback<void(const std::vector<DisplaySnapshot_Params>&)>&
|
| + callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(DrmThread::OnRefreshNativeDisplays,
|
| + base::Unretained(&drm_thread_), CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnConfigureNativeDisplay(
|
| + int64_t id,
|
| + const DisplayMode_Params& mode,
|
| + const gfx::Point& origin,
|
| + const base::Callback<void(int64_t, bool)>& callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnConfigureNativeDisplay,
|
| + base::Unretained(&drm_thread_), id, mode, origin,
|
| + CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnDisableNativeDisplay(
|
| + int64_t id,
|
| + const base::Callback<void(int64_t, bool)>& callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnDisableNativeDisplay,
|
| + base::Unretained(&drm_thread_), id,
|
| + CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnTakeDisplayControl(
|
| + const base::Callback<void(bool)>& callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(DrmThread::OnTakeDisplayControl,
|
| + base::Unretained(&drm_thread_), CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnRelinquishDisplayControl(
|
| + const base::Callback<void(bool)>& callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(DrmThread::OnRelinquishDisplayControl,
|
| + base::Unretained(&drm_thread_), CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnAddGraphicsDevice(const base::FilePath& path,
|
| + const base::FileDescriptor& fd) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnAddGraphicsDevice,
|
| + base::Unretained(&drm_thread_), path, fd));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnRemoveGraphicsDevice(const base::FilePath& path) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnRemoveGraphicsDevice,
|
| + base::Unretained(&drm_thread_), path));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnGetHDCPState(
|
| + int64_t display_id,
|
| + const base::Callback<void(int64_t, bool, HDCPState>& callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(DrmThread::OnGetHDCPState, base::Unretained(&drm_thread_),
|
| + display_id, CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnSetHDCPState(
|
| + int64_t display_id, HDCPState state,
|
| + const base::Callback<void(int64_t, bool>& callback) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(DrmThread::OnSetHDCPState, base::Unretained(&drm_thread_),
|
| + display_id, state, CreateSafeCallback(callback)));
|
| +}
|
| +
|
| +void DrmThreadProxy::OnSetGammaRamp(int64_t id,
|
| + const std::vector<GammaRampRGBEntry>& lut) {
|
| + DCHECK(drm_thread_->IsRunning());
|
| + drm_thread_->task_runner()->PostTask(
|
| + FROM_HERE, base::Bind(DrmThread::OnSetGammaRamp,
|
| + base::Unretained(&drm_thread_), id, lut));
|
| +}
|
| +
|
| +} // namespace ui
|
|
|