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
3 // found in the LICENSE file.
5 #include "ui/ozone/platform/drm/host/drm_native_display_delegate.h"
7 #include "ui/display/types/display_snapshot.h"
8 #include "ui/display/types/native_display_observer.h"
9 #include "ui/ozone/platform/drm/host/drm_display_host.h"
10 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h"
14 DrmNativeDisplayDelegate::DrmNativeDisplayDelegate(
15 DrmDisplayHostManager
* display_manager
)
16 : display_manager_(display_manager
) {
19 DrmNativeDisplayDelegate::~DrmNativeDisplayDelegate() {
20 display_manager_
->RemoveDelegate(this);
23 void DrmNativeDisplayDelegate::OnConfigurationChanged() {
24 FOR_EACH_OBSERVER(NativeDisplayObserver
, observers_
,
25 OnConfigurationChanged());
28 void DrmNativeDisplayDelegate::Initialize() {
29 display_manager_
->AddDelegate(this);
32 void DrmNativeDisplayDelegate::GrabServer() {
35 void DrmNativeDisplayDelegate::UngrabServer() {
38 void DrmNativeDisplayDelegate::TakeDisplayControl(
39 const DisplayControlCallback
& callback
) {
40 display_manager_
->TakeDisplayControl(callback
);
43 void DrmNativeDisplayDelegate::RelinquishDisplayControl(
44 const DisplayControlCallback
& callback
) {
45 display_manager_
->RelinquishDisplayControl(callback
);
48 void DrmNativeDisplayDelegate::SyncWithServer() {
51 void DrmNativeDisplayDelegate::SetBackgroundColor(uint32_t color_argb
) {
54 void DrmNativeDisplayDelegate::ForceDPMSOn() {
57 void DrmNativeDisplayDelegate::GetDisplays(
58 const GetDisplaysCallback
& callback
) {
59 display_manager_
->UpdateDisplays(callback
);
62 void DrmNativeDisplayDelegate::AddMode(const ui::DisplaySnapshot
& output
,
63 const ui::DisplayMode
* mode
) {
66 void DrmNativeDisplayDelegate::Configure(const ui::DisplaySnapshot
& output
,
67 const ui::DisplayMode
* mode
,
68 const gfx::Point
& origin
,
69 const ConfigureCallback
& callback
) {
70 DrmDisplayHost
* display
= display_manager_
->GetDisplay(output
.display_id());
71 display
->Configure(mode
, origin
, callback
);
74 void DrmNativeDisplayDelegate::CreateFrameBuffer(const gfx::Size
& size
) {
77 void DrmNativeDisplayDelegate::GetHDCPState(
78 const ui::DisplaySnapshot
& output
,
79 const GetHDCPStateCallback
& callback
) {
80 DrmDisplayHost
* display
= display_manager_
->GetDisplay(output
.display_id());
81 display
->GetHDCPState(callback
);
84 void DrmNativeDisplayDelegate::SetHDCPState(
85 const ui::DisplaySnapshot
& output
,
87 const SetHDCPStateCallback
& callback
) {
88 DrmDisplayHost
* display
= display_manager_
->GetDisplay(output
.display_id());
89 display
->SetHDCPState(state
, callback
);
92 std::vector
<ui::ColorCalibrationProfile
>
93 DrmNativeDisplayDelegate::GetAvailableColorCalibrationProfiles(
94 const ui::DisplaySnapshot
& output
) {
95 return std::vector
<ui::ColorCalibrationProfile
>();
98 bool DrmNativeDisplayDelegate::SetColorCalibrationProfile(
99 const ui::DisplaySnapshot
& output
,
100 ui::ColorCalibrationProfile new_profile
) {
105 bool DrmNativeDisplayDelegate::SetGammaRamp(
106 const ui::DisplaySnapshot
& output
,
107 const std::vector
<GammaRampRGBEntry
>& lut
) {
108 DrmDisplayHost
* display
= display_manager_
->GetDisplay(output
.display_id());
109 display
->SetGammaRamp(lut
);
113 void DrmNativeDisplayDelegate::AddObserver(NativeDisplayObserver
* observer
) {
114 observers_
.AddObserver(observer
);
117 void DrmNativeDisplayDelegate::RemoveObserver(NativeDisplayObserver
* observer
) {
118 observers_
.RemoveObserver(observer
);