summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authordnicoara@chromium.org <dnicoara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-10 21:11:26 +0000
committerdnicoara@chromium.org <dnicoara@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-10 21:11:26 +0000
commit72bce5264bdb62d32d684f1e9c639bb2932e695c (patch)
treea0352306c69eb0960fd5ea3aff756a3b52a9a574 /chromeos
parentb66deffe0273ad9f53560d906bb160a226dc444a (diff)
downloadchromium_src-72bce5264bdb62d32d684f1e9c639bb2932e695c.zip
chromium_src-72bce5264bdb62d32d684f1e9c639bb2932e695c.tar.gz
chromium_src-72bce5264bdb62d32d684f1e9c639bb2932e695c.tar.bz2
Split projecting configuration into separate delegate
Moved projecting configuration into separate delegate. Since Delegate deals only with display configuration, I've also renamed it to NativeDisplayDelegate to better reflect its purpose. BUG=333413 Review URL: https://codereview.chromium.org/154033004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250205 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/chromeos.gyp4
-rw-r--r--chromeos/dbus/fake_power_manager_client.cc6
-rw-r--r--chromeos/dbus/fake_power_manager_client.h12
-rw-r--r--chromeos/display/native_display_delegate_x11.cc (renamed from chromeos/display/real_output_configurator_delegate.cc)147
-rw-r--r--chromeos/display/native_display_delegate_x11.h (renamed from chromeos/display/real_output_configurator_delegate.h)42
-rw-r--r--chromeos/display/output_configurator.cc90
-rw-r--r--chromeos/display/output_configurator.h29
-rw-r--r--chromeos/display/output_configurator_unittest.cc138
8 files changed, 189 insertions, 279 deletions
diff --git a/chromeos/chromeos.gyp b/chromeos/chromeos.gyp
index b0b69da..9eb13ae 100644
--- a/chromeos/chromeos.gyp
+++ b/chromeos/chromeos.gyp
@@ -204,12 +204,12 @@
'dbus/volume_state.h',
'disks/disk_mount_manager.cc',
'disks/disk_mount_manager.h',
+ 'display/native_display_delegate_x11.cc',
+ 'display/native_display_delegate_x11.h',
'display/output_configurator.cc',
'display/output_configurator.h',
'display/output_util.cc',
'display/output_util.h',
- 'display/real_output_configurator_delegate.cc',
- 'display/real_output_configurator_delegate.h',
'display/touchscreen_delegate_x11.cc',
'display/touchscreen_delegate_x11.h',
'ime/component_extension_ime_manager.cc',
diff --git a/chromeos/dbus/fake_power_manager_client.cc b/chromeos/dbus/fake_power_manager_client.cc
index 6007d753..529628a 100644
--- a/chromeos/dbus/fake_power_manager_client.cc
+++ b/chromeos/dbus/fake_power_manager_client.cc
@@ -9,7 +9,9 @@ namespace chromeos {
FakePowerManagerClient::FakePowerManagerClient()
: num_request_restart_calls_(0),
- num_set_policy_calls_(0) {
+ num_set_policy_calls_(0),
+ num_set_is_projecting_calls_(0),
+ is_projecting_(false) {
}
FakePowerManagerClient::~FakePowerManagerClient() {
@@ -78,6 +80,8 @@ void FakePowerManagerClient::DecreaseKeyboardBrightness() {
}
void FakePowerManagerClient::SetIsProjecting(bool is_projecting) {
+ ++num_set_is_projecting_calls_;
+ is_projecting_ = is_projecting;
}
void FakePowerManagerClient::NotifyUserActivity(
diff --git a/chromeos/dbus/fake_power_manager_client.h b/chromeos/dbus/fake_power_manager_client.h
index 61ad673..dd0cd26 100644
--- a/chromeos/dbus/fake_power_manager_client.h
+++ b/chromeos/dbus/fake_power_manager_client.h
@@ -31,6 +31,12 @@ class FakePowerManagerClient : public PowerManagerClient {
int num_set_policy_calls() const {
return num_set_policy_calls_;
}
+ int num_set_is_projecting_calls() const {
+ return num_set_is_projecting_calls_;
+ }
+ bool is_projecting() const {
+ return is_projecting_;
+ }
// PowerManagerClient overrides
virtual void Init(dbus::Bus* bus) OVERRIDE;
@@ -81,6 +87,12 @@ class FakePowerManagerClient : public PowerManagerClient {
// Number of times that SetPolicy() has been called.
int num_set_policy_calls_;
+ // Count the number of times SetIsProjecting() has been called.
+ int num_set_is_projecting_calls_;
+
+ // Last projecting state set in SetIsProjecting().
+ bool is_projecting_;
+
DISALLOW_COPY_AND_ASSIGN(FakePowerManagerClient);
};
diff --git a/chromeos/display/real_output_configurator_delegate.cc b/chromeos/display/native_display_delegate_x11.cc
index ca816bc..22d0e1e 100644
--- a/chromeos/display/real_output_configurator_delegate.cc
+++ b/chromeos/display/native_display_delegate_x11.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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 "chromeos/display/real_output_configurator_delegate.h"
+#include "chromeos/display/native_display_delegate_x11.h"
#include <X11/Xatom.h>
#include <X11/Xlib.h>
@@ -15,8 +15,6 @@
#include "base/message_loop/message_pump_x11.h"
#include "base/x11/edid_parser_x11.h"
#include "base/x11/x11_error_tracker.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
-#include "chromeos/dbus/power_manager_client.h"
#include "chromeos/display/output_util.h"
namespace chromeos {
@@ -49,44 +47,40 @@ RRMode GetOutputNativeMode(const XRROutputInfo* output_info) {
} // namespace
-RealOutputConfiguratorDelegate::RealOutputConfiguratorDelegate()
+NativeDisplayDelegateX11::NativeDisplayDelegateX11()
: display_(base::MessagePumpX11::GetDefaultXDisplay()),
window_(DefaultRootWindow(display_)),
- screen_(NULL) {
-}
+ screen_(NULL) {}
-RealOutputConfiguratorDelegate::~RealOutputConfiguratorDelegate() {
-}
+NativeDisplayDelegateX11::~NativeDisplayDelegateX11() {}
-void RealOutputConfiguratorDelegate::InitXRandRExtension(int* event_base) {
+void NativeDisplayDelegateX11::InitXRandRExtension(int* event_base) {
int error_base_ignored = 0;
XRRQueryExtension(display_, event_base, &error_base_ignored);
}
-void RealOutputConfiguratorDelegate::UpdateXRandRConfiguration(
+void NativeDisplayDelegateX11::UpdateXRandRConfiguration(
const base::NativeEvent& event) {
XRRUpdateConfiguration(event);
}
-void RealOutputConfiguratorDelegate::GrabServer() {
+void NativeDisplayDelegateX11::GrabServer() {
CHECK(!screen_) << "Server already grabbed";
XGrabServer(display_);
screen_ = XRRGetScreenResources(display_, window_);
CHECK(screen_);
}
-void RealOutputConfiguratorDelegate::UngrabServer() {
+void NativeDisplayDelegateX11::UngrabServer() {
CHECK(screen_) << "Server not grabbed";
XRRFreeScreenResources(screen_);
screen_ = NULL;
XUngrabServer(display_);
}
-void RealOutputConfiguratorDelegate::SyncWithServer() {
- XSync(display_, 0);
-}
+void NativeDisplayDelegateX11::SyncWithServer() { XSync(display_, 0); }
-void RealOutputConfiguratorDelegate::SetBackgroundColor(uint32 color_argb) {
+void NativeDisplayDelegateX11::SetBackgroundColor(uint32 color_argb) {
// Configuring CRTCs/Framebuffer clears the boot screen image. Set the
// same background color while configuring the display to minimize the
// duration of black screen at boot time. The background is filled with
@@ -105,13 +99,13 @@ void RealOutputConfiguratorDelegate::SetBackgroundColor(uint32 color_argb) {
XFreeColors(display_, colormap, &color.pixel, 1, 0);
}
-void RealOutputConfiguratorDelegate::ForceDPMSOn() {
+void NativeDisplayDelegateX11::ForceDPMSOn() {
CHECK(DPMSEnable(display_));
CHECK(DPMSForceLevel(display_, DPMSModeOn));
}
std::vector<OutputConfigurator::OutputSnapshot>
-RealOutputConfiguratorDelegate::GetOutputs() {
+NativeDisplayDelegateX11::GetOutputs() {
CHECK(screen_) << "Server not grabbed";
std::vector<OutputConfigurator::OutputSnapshot> outputs;
@@ -121,11 +115,10 @@ RealOutputConfiguratorDelegate::GetOutputs() {
RROutput output_id = screen_->outputs[i];
XRROutputInfo* output_info = XRRGetOutputInfo(display_, screen_, output_id);
if (output_info->connection == RR_Connected) {
- OutputConfigurator::OutputSnapshot output = InitOutputSnapshot(
- output_id, output_info, &last_used_crtc, i);
+ OutputConfigurator::OutputSnapshot output =
+ InitOutputSnapshot(output_id, output_info, &last_used_crtc, i);
VLOG(2) << "Found display " << outputs.size() << ":"
- << " output=" << output.output
- << " crtc=" << output.crtc
+ << " output=" << output.output << " crtc=" << output.crtc
<< " current_mode=" << output.current_mode;
outputs.push_back(output);
}
@@ -135,25 +128,20 @@ RealOutputConfiguratorDelegate::GetOutputs() {
return outputs;
}
-void RealOutputConfiguratorDelegate::AddOutputMode(RROutput output,
- RRMode mode) {
+void NativeDisplayDelegateX11::AddOutputMode(RROutput output, RRMode mode) {
CHECK(screen_) << "Server not grabbed";
VLOG(1) << "AddOutputMode: output=" << output << " mode=" << mode;
XRRAddOutputMode(display_, output, mode);
}
-bool RealOutputConfiguratorDelegate::ConfigureCrtc(
- RRCrtc crtc,
- RRMode mode,
- RROutput output,
- int x,
- int y) {
+bool NativeDisplayDelegateX11::ConfigureCrtc(RRCrtc crtc,
+ RRMode mode,
+ RROutput output,
+ int x,
+ int y) {
CHECK(screen_) << "Server not grabbed";
- VLOG(1) << "ConfigureCrtc: crtc=" << crtc
- << " mode=" << mode
- << " output=" << output
- << " x=" << x
- << " y=" << y;
+ VLOG(1) << "ConfigureCrtc: crtc=" << crtc << " mode=" << mode
+ << " output=" << output << " x=" << x << " y=" << y;
// Xrandr.h is full of lies. XRRSetCrtcConfig() is defined as returning a
// Status, which is typically 0 for failure and 1 for success. In
// actuality it returns a RRCONFIGSTATUS, which uses 0 for success.
@@ -169,7 +157,7 @@ bool RealOutputConfiguratorDelegate::ConfigureCrtc(
(output && mode) ? 1 : 0) == RRSetConfigSuccess;
}
-void RealOutputConfiguratorDelegate::CreateFrameBuffer(
+void NativeDisplayDelegateX11::CreateFrameBuffer(
int width,
int height,
const std::vector<OutputConfigurator::OutputSnapshot>& outputs) {
@@ -178,7 +166,7 @@ void RealOutputConfiguratorDelegate::CreateFrameBuffer(
int current_height = DisplayHeight(display_, DefaultScreen(display_));
VLOG(1) << "CreateFrameBuffer: new=" << width << "x" << height
<< " current=" << current_width << "x" << current_height;
- if (width == current_width && height == current_height)
+ if (width == current_width && height == current_height)
return;
DestroyUnusedCrtcs(outputs);
@@ -187,13 +175,7 @@ void RealOutputConfiguratorDelegate::CreateFrameBuffer(
XRRSetScreenSize(display_, window_, width, height, mm_width, mm_height);
}
-void RealOutputConfiguratorDelegate::SendProjectingStateToPowerManager(
- bool projecting) {
- chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->
- SetIsProjecting(projecting);
-}
-
-bool RealOutputConfiguratorDelegate::InitModeInfo(
+bool NativeDisplayDelegateX11::InitModeInfo(
RRMode mode,
OutputConfigurator::ModeInfo* mode_info) {
DCHECK(mode_info);
@@ -209,9 +191,9 @@ bool RealOutputConfiguratorDelegate::InitModeInfo(
mode_info->height = info.height;
mode_info->interlaced = info.modeFlags & RR_Interlace;
if (info.hTotal && info.vTotal) {
- mode_info->refresh_rate = static_cast<float>(info.dotClock) /
- (static_cast<float>(info.hTotal) *
- static_cast<float>(info.vTotal));
+ mode_info->refresh_rate =
+ static_cast<float>(info.dotClock) /
+ (static_cast<float>(info.hTotal) * static_cast<float>(info.vTotal));
} else {
mode_info->refresh_rate = 0.0f;
}
@@ -221,8 +203,7 @@ bool RealOutputConfiguratorDelegate::InitModeInfo(
return false;
}
-OutputConfigurator::OutputSnapshot
-RealOutputConfiguratorDelegate::InitOutputSnapshot(
+OutputConfigurator::OutputSnapshot NativeDisplayDelegateX11::InitOutputSnapshot(
RROutput id,
XRROutputInfo* info,
RRCrtc* last_used_crtc,
@@ -290,8 +271,7 @@ RealOutputConfiguratorDelegate::InitOutputSnapshot(
return output;
}
-bool RealOutputConfiguratorDelegate::GetHDCPState(RROutput id,
- HDCPState* state) {
+bool NativeDisplayDelegateX11::GetHDCPState(RROutput id, HDCPState* state) {
unsigned char* values = NULL;
int actual_format = 0;
unsigned long nitems = 0;
@@ -304,9 +284,18 @@ bool RealOutputConfiguratorDelegate::GetHDCPState(RROutput id,
bool ok = true;
// TODO(kcwu): Move this to x11_util (similar method calls in this file and
// output_util.cc)
- success = XRRGetOutputProperty(display_, id, prop, 0, 100, False,
- False, AnyPropertyType, &actual_type,
- &actual_format, &nitems, &bytes_after,
+ success = XRRGetOutputProperty(display_,
+ id,
+ prop,
+ 0,
+ 100,
+ False,
+ False,
+ AnyPropertyType,
+ &actual_type,
+ &actual_format,
+ &nitems,
+ &bytes_after,
&values);
if (actual_type == None) {
LOG(ERROR) << "Property '" << kContentProtectionAtomName
@@ -317,15 +306,15 @@ bool RealOutputConfiguratorDelegate::GetHDCPState(RROutput id,
Atom value = reinterpret_cast<Atom*>(values)[0];
if (value == XInternAtom(display_, kProtectionUndesiredAtomName, False)) {
*state = HDCP_STATE_UNDESIRED;
- } else if (value == XInternAtom(display_, kProtectionDesiredAtomName,
- False)) {
+ } else if (value ==
+ XInternAtom(display_, kProtectionDesiredAtomName, False)) {
*state = HDCP_STATE_DESIRED;
- } else if (value == XInternAtom(display_, kProtectionEnabledAtomName,
- False)) {
+ } else if (value ==
+ XInternAtom(display_, kProtectionEnabledAtomName, False)) {
*state = HDCP_STATE_ENABLED;
} else {
- LOG(ERROR) << "Unknown " << kContentProtectionAtomName << " value: "
- << value;
+ LOG(ERROR) << "Unknown " << kContentProtectionAtomName
+ << " value: " << value;
ok = false;
}
} else {
@@ -339,8 +328,7 @@ bool RealOutputConfiguratorDelegate::GetHDCPState(RROutput id,
return ok;
}
-bool RealOutputConfiguratorDelegate::SetHDCPState(RROutput id,
- HDCPState state) {
+bool NativeDisplayDelegateX11::SetHDCPState(RROutput id, HDCPState state) {
Atom name = XInternAtom(display_, kContentProtectionAtomName, False);
Atom value = None;
switch (state) {
@@ -356,8 +344,8 @@ bool RealOutputConfiguratorDelegate::SetHDCPState(RROutput id,
}
base::X11ErrorTracker err_tracker;
unsigned char* data = reinterpret_cast<unsigned char*>(&value);
- XRRChangeOutputProperty(display_, id, name, XA_ATOM, 32,
- PropModeReplace, data, 1);
+ XRRChangeOutputProperty(
+ display_, id, name, XA_ATOM, 32, PropModeReplace, data, 1);
if (err_tracker.FoundNewError()) {
LOG(ERROR) << "XRRChangeOutputProperty failed";
return false;
@@ -366,7 +354,7 @@ bool RealOutputConfiguratorDelegate::SetHDCPState(RROutput id,
}
}
-void RealOutputConfiguratorDelegate::DestroyUnusedCrtcs(
+void NativeDisplayDelegateX11::DestroyUnusedCrtcs(
const std::vector<OutputConfigurator::OutputSnapshot>& outputs) {
CHECK(screen_) << "Server not grabbed";
// Setting the screen size will fail if any CRTC doesn't fit afterwards.
@@ -387,7 +375,9 @@ void RealOutputConfiguratorDelegate::DestroyUnusedCrtcs(
RROutput output = None;
const OutputConfigurator::ModeInfo* mode_info = NULL;
for (std::vector<OutputConfigurator::OutputSnapshot>::const_iterator it =
- outputs.begin(); it != outputs.end(); ++it) {
+ outputs.begin();
+ it != outputs.end();
+ ++it) {
if (crtc == it->crtc) {
mode = it->current_mode;
output = it->output;
@@ -414,8 +404,7 @@ void RealOutputConfiguratorDelegate::DestroyUnusedCrtcs(
}
}
-bool RealOutputConfiguratorDelegate::IsOutputAspectPreservingScaling(
- RROutput id) {
+bool NativeDisplayDelegateX11::IsOutputAspectPreservingScaling(RROutput id) {
bool ret = false;
Atom scaling_prop = XInternAtom(display_, "scaling mode", False);
@@ -435,11 +424,21 @@ bool RealOutputConfiguratorDelegate::IsOutputAspectPreservingScaling(
Atom actual_type;
int success;
- success = XRRGetOutputProperty(display_, id, prop, 0, 100, False, False,
- AnyPropertyType, &actual_type, &actual_format, &nitems,
- &bytes_after, &values);
- if (success == Success && actual_type == XA_ATOM &&
- actual_format == 32 && nitems == 1) {
+ success = XRRGetOutputProperty(display_,
+ id,
+ prop,
+ 0,
+ 100,
+ False,
+ False,
+ AnyPropertyType,
+ &actual_type,
+ &actual_format,
+ &nitems,
+ &bytes_after,
+ &values);
+ if (success == Success && actual_type == XA_ATOM && actual_format == 32 &&
+ nitems == 1) {
Atom value = reinterpret_cast<Atom*>(values)[0];
if (full_aspect_atom == value)
ret = true;
diff --git a/chromeos/display/real_output_configurator_delegate.h b/chromeos/display/native_display_delegate_x11.h
index 7c7d62b..fbce154 100644
--- a/chromeos/display/real_output_configurator_delegate.h
+++ b/chromeos/display/native_display_delegate_x11.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Copyright 2014 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.
-#ifndef CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_
-#define CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_
+#ifndef CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_X11_H_
+#define CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_X11_H_
#include <vector>
@@ -22,15 +22,16 @@ typedef _XRRScreenResources XRRScreenResources;
namespace chromeos {
-class RealOutputConfiguratorDelegate : public OutputConfigurator::Delegate {
+class NativeDisplayDelegateX11
+ : public OutputConfigurator::NativeDisplayDelegate {
public:
- RealOutputConfiguratorDelegate();
- virtual ~RealOutputConfiguratorDelegate();
+ NativeDisplayDelegateX11();
+ virtual ~NativeDisplayDelegateX11();
// OutputConfigurator::Delegate overrides:
virtual void InitXRandRExtension(int* event_base) OVERRIDE;
- virtual void UpdateXRandRConfiguration(
- const base::NativeEvent& event) OVERRIDE;
+ virtual void UpdateXRandRConfiguration(const base::NativeEvent& event)
+ OVERRIDE;
virtual void GrabServer() OVERRIDE;
virtual void UngrabServer() OVERRIDE;
virtual void SyncWithServer() OVERRIDE;
@@ -38,17 +39,15 @@ class RealOutputConfiguratorDelegate : public OutputConfigurator::Delegate {
virtual void ForceDPMSOn() OVERRIDE;
virtual std::vector<OutputConfigurator::OutputSnapshot> GetOutputs() OVERRIDE;
virtual void AddOutputMode(RROutput output, RRMode mode) OVERRIDE;
- virtual bool ConfigureCrtc(
- RRCrtc crtc,
- RRMode mode,
- RROutput output,
- int x,
- int y) OVERRIDE;
+ virtual bool ConfigureCrtc(RRCrtc crtc,
+ RRMode mode,
+ RROutput output,
+ int x,
+ int y) OVERRIDE;
virtual void CreateFrameBuffer(
int width,
int height,
const std::vector<OutputConfigurator::OutputSnapshot>& outputs) OVERRIDE;
- virtual void SendProjectingStateToPowerManager(bool projecting) OVERRIDE;
virtual bool GetHDCPState(RROutput id, HDCPState* state) OVERRIDE;
virtual bool SetHDCPState(RROutput id, HDCPState state) OVERRIDE;
@@ -60,11 +59,10 @@ class RealOutputConfiguratorDelegate : public OutputConfigurator::Delegate {
// Helper method for GetOutputs() that returns an OutputSnapshot struct based
// on the passed-in information. Further initialization is required (e.g.
// |selected_mode|, |mirror_mode|, and |touch_device_id|).
- OutputConfigurator::OutputSnapshot InitOutputSnapshot(
- RROutput id,
- XRROutputInfo* info,
- RRCrtc* last_used_crtc,
- int index);
+ OutputConfigurator::OutputSnapshot InitOutputSnapshot(RROutput id,
+ XRROutputInfo* info,
+ RRCrtc* last_used_crtc,
+ int index);
// Destroys unused CRTCs and parks used CRTCs in a way which allows a
// framebuffer resize. This is faster than turning them off, resizing,
@@ -81,9 +79,9 @@ class RealOutputConfiguratorDelegate : public OutputConfigurator::Delegate {
// Initialized when the server is grabbed and freed when it's ungrabbed.
XRRScreenResources* screen_;
- DISALLOW_COPY_AND_ASSIGN(RealOutputConfiguratorDelegate);
+ DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateX11);
};
} // namespace chromeos
-#endif // CHROMEOS_DISPLAY_REAL_OUTPUT_CONFIGURATOR_DELEGATE_H_
+#endif // CHROMEOS_DISPLAY_NATIVE_DISPLAY_DELEGATE_X11_H_
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
index 327d243..22b9fb3 100644
--- a/chromeos/display/output_configurator.cc
+++ b/chromeos/display/output_configurator.cc
@@ -14,8 +14,8 @@
#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
#include "base/time/time.h"
+#include "chromeos/display/native_display_delegate_x11.h"
#include "chromeos/display/output_util.h"
-#include "chromeos/display/real_output_configurator_delegate.h"
#include "chromeos/display/touchscreen_delegate_x11.h"
namespace chromeos {
@@ -239,14 +239,13 @@ OutputConfigurator::OutputConfigurator()
xrandr_event_base_(0),
output_state_(STATE_INVALID),
power_state_(DISPLAY_POWER_ALL_ON),
- next_output_protection_client_id_(1),
- casting_session_count_(0) {
-}
+ next_output_protection_client_id_(1) {}
OutputConfigurator::~OutputConfigurator() {}
-void OutputConfigurator::SetDelegateForTesting(scoped_ptr<Delegate> delegate) {
- delegate_ = delegate.Pass();
+void OutputConfigurator::SetNativeDisplayDelegateForTesting(
+ scoped_ptr<NativeDisplayDelegate> delegate) {
+ native_display_delegate_ = delegate.Pass();
configure_display_ = true;
}
@@ -265,8 +264,8 @@ void OutputConfigurator::Init(bool is_panel_fitting_enabled) {
if (!configure_display_)
return;
- if (!delegate_)
- delegate_.reset(new RealOutputConfiguratorDelegate());
+ if (!native_display_delegate_)
+ native_display_delegate_.reset(new NativeDisplayDelegateX11());
if (!touchscreen_delegate_)
touchscreen_delegate_.reset(new TouchscreenDelegateX11());
@@ -276,21 +275,20 @@ void OutputConfigurator::Start(uint32 background_color_argb) {
if (!configure_display_)
return;
- delegate_->GrabServer();
- delegate_->InitXRandRExtension(&xrandr_event_base_);
+ native_display_delegate_->GrabServer();
+ native_display_delegate_->InitXRandRExtension(&xrandr_event_base_);
UpdateCachedOutputs();
if (cached_outputs_.size() > 1 && background_color_argb)
- delegate_->SetBackgroundColor(background_color_argb);
+ native_display_delegate_->SetBackgroundColor(background_color_argb);
const OutputState new_state = ChooseOutputState(power_state_);
const bool success = EnterStateOrFallBackToSoftwareMirroring(
new_state, power_state_);
// Force the DPMS on chrome startup as the driver doesn't always detect
// that all displays are on when signing out.
- delegate_->ForceDPMSOn();
- delegate_->UngrabServer();
- SendProjectingStateToPowerManager();
+ native_display_delegate_->ForceDPMSOn();
+ native_display_delegate_->UngrabServer();
NotifyObservers(success, new_state);
}
@@ -313,7 +311,7 @@ bool OutputConfigurator::ApplyProtections(const DisplayProtections& requests) {
HDCPState new_desired_state =
(all_desired & OUTPUT_PROTECTION_METHOD_HDCP) ?
HDCP_STATE_DESIRED : HDCP_STATE_UNDESIRED;
- if (!delegate_->SetHDCPState(this_id, new_desired_state))
+ if (!native_display_delegate_->SetHDCPState(this_id, new_desired_state))
return false;
break;
}
@@ -331,22 +329,6 @@ bool OutputConfigurator::ApplyProtections(const DisplayProtections& requests) {
return true;
}
-void OutputConfigurator::SendProjectingStateToPowerManager() {
- bool has_internal_output = false;
- int connected_output_count = cached_outputs_.size() + casting_session_count_;
- for (size_t i = 0; i < cached_outputs_.size(); ++i) {
- if (cached_outputs_[i].type == OUTPUT_TYPE_INTERNAL) {
- has_internal_output = true;
- break;
- }
- }
-
- // "Projecting" is defined as having more than 1 output connected while at
- // least one of them is an internal output.
- bool is_projecting = has_internal_output && (connected_output_count > 1);
- delegate_->SendProjectingStateToPowerManager(is_projecting);
-}
-
OutputConfigurator::OutputProtectionClientId
OutputConfigurator::RegisterOutputProtectionClient() {
if (!configure_display_)
@@ -398,7 +380,7 @@ bool OutputConfigurator::QueryOutputProtectionStatus(
case OUTPUT_TYPE_DVI:
case OUTPUT_TYPE_HDMI: {
HDCPState state;
- if (!delegate_->GetHDCPState(this_id, &state))
+ if (!native_display_delegate_->GetHDCPState(this_id, &state))
return false;
if (state == HDCP_STATE_ENABLED)
enabled |= OUTPUT_PROTECTION_METHOD_HDCP;
@@ -485,7 +467,7 @@ bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state,
if (power_state == power_state_ && !(flags & kSetDisplayPowerForceProbe))
return true;
- delegate_->GrabServer();
+ native_display_delegate_->GrabServer();
UpdateCachedOutputs();
const OutputState new_state = ChooseOutputState(power_state);
@@ -504,10 +486,10 @@ bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state,
// Force the DPMS on since the driver doesn't always detect that it
// should turn on. This is needed when coming back from idle suspend.
if (success && power_state != DISPLAY_POWER_ALL_OFF)
- delegate_->ForceDPMSOn();
+ native_display_delegate_->ForceDPMSOn();
}
- delegate_->UngrabServer();
+ native_display_delegate_->UngrabServer();
if (attempted_change)
NotifyObservers(success, new_state);
return true;
@@ -527,11 +509,11 @@ bool OutputConfigurator::SetDisplayMode(OutputState new_state) {
return true;
}
- delegate_->GrabServer();
+ native_display_delegate_->GrabServer();
UpdateCachedOutputs();
const bool success = EnterStateOrFallBackToSoftwareMirroring(
new_state, power_state_);
- delegate_->UngrabServer();
+ native_display_delegate_->UngrabServer();
NotifyObservers(success, new_state);
return success;
@@ -543,7 +525,7 @@ uint32_t OutputConfigurator::Dispatch(const base::NativeEvent& event) {
if (event->type - xrandr_event_base_ == RRScreenChangeNotify) {
VLOG(1) << "Received RRScreenChangeNotify event";
- delegate_->UpdateXRandRConfiguration(event);
+ native_display_delegate_->UpdateXRandRConfiguration(event);
return POST_DISPATCH_PERFORM_DEFAULT;
}
@@ -611,18 +593,6 @@ base::EventStatus OutputConfigurator::WillProcessEvent(
void OutputConfigurator::DidProcessEvent(const base::NativeEvent& event) {
}
-void OutputConfigurator::OnCastingSessionStartedOrStopped(bool started) {
- if (started) {
- ++casting_session_count_;
- } else {
- DCHECK_GT(casting_session_count_, 0);
- --casting_session_count_;
- if (casting_session_count_ < 0)
- casting_session_count_ = 0;
- }
- SendProjectingStateToPowerManager();
-}
-
void OutputConfigurator::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
@@ -644,7 +614,7 @@ void OutputConfigurator::SuspendDisplays() {
// We need to make sure that the monitor configuration we just did actually
// completes before we return, because otherwise the X message could be
// racing with the HandleSuspendReadiness message.
- delegate_->SyncWithServer();
+ native_display_delegate_->SyncWithServer();
}
}
@@ -668,7 +638,7 @@ void OutputConfigurator::ScheduleConfigureOutputs() {
}
void OutputConfigurator::UpdateCachedOutputs() {
- cached_outputs_ = delegate_->GetOutputs();
+ cached_outputs_ = native_display_delegate_->GetOutputs();
touchscreen_delegate_->AssociateTouchscreens(&cached_outputs_);
// Set |selected_mode| fields.
@@ -779,7 +749,7 @@ bool OutputConfigurator::FindMirrorMode(OutputSnapshot* internal_output,
!external_info.interlaced;
if (can_fit) {
RRMode mode = external_it->first;
- delegate_->AddOutputMode(internal_output->output, mode);
+ native_display_delegate_->AddOutputMode(internal_output->output, mode);
internal_output->mode_infos.insert(std::make_pair(mode, external_info));
internal_output->mirror_mode = mode;
external_output->mirror_mode = mode;
@@ -794,15 +764,14 @@ bool OutputConfigurator::FindMirrorMode(OutputSnapshot* internal_output,
void OutputConfigurator::ConfigureOutputs() {
configure_timer_.reset();
- delegate_->GrabServer();
+ native_display_delegate_->GrabServer();
UpdateCachedOutputs();
const OutputState new_state = ChooseOutputState(power_state_);
const bool success = EnterStateOrFallBackToSoftwareMirroring(
new_state, power_state_);
- delegate_->UngrabServer();
+ native_display_delegate_->UngrabServer();
NotifyObservers(success, new_state);
- SendProjectingStateToPowerManager();
}
void OutputConfigurator::NotifyObservers(bool success,
@@ -968,14 +937,17 @@ bool OutputConfigurator::EnterState(
DCHECK_EQ(cached_outputs_.size(), updated_outputs.size());
bool all_succeeded = true;
if (!updated_outputs.empty()) {
- delegate_->CreateFrameBuffer(width, height, updated_outputs);
+ native_display_delegate_->CreateFrameBuffer(width, height, updated_outputs);
for (size_t i = 0; i < updated_outputs.size(); ++i) {
const OutputSnapshot& output = updated_outputs[i];
bool configure_succeeded =false;
while (true) {
- if (delegate_->ConfigureCrtc(output.crtc, output.current_mode,
- output.output, output.x, output.y)) {
+ if (native_display_delegate_->ConfigureCrtc(output.crtc,
+ output.current_mode,
+ output.output,
+ output.x,
+ output.y)) {
configure_succeeded = true;
break;
}
diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h
index cee949e..7432171 100644
--- a/chromeos/display/output_configurator.h
+++ b/chromeos/display/output_configurator.h
@@ -189,10 +189,11 @@ class CHROMEOS_EXPORT OutputConfigurator
virtual void SetSoftwareMirroring(bool enabled) = 0;
};
- // Interface for classes that perform actions on behalf of OutputController.
- class Delegate {
+ // Interface for classes that perform display configuration actions on behalf
+ // of OutputConfigurator.
+ class NativeDisplayDelegate {
public:
- virtual ~Delegate() {}
+ virtual ~NativeDisplayDelegate() {}
// Initializes the XRandR extension, saving the base event ID to
// |event_base|.
@@ -243,10 +244,6 @@ class CHROMEOS_EXPORT OutputConfigurator
int height,
const std::vector<OutputConfigurator::OutputSnapshot>& outputs) = 0;
- // Sends a D-Bus message to the power manager telling it that the
- // machine is or is not projecting.
- virtual void SendProjectingStateToPowerManager(bool projecting) = 0;
-
// Gets HDCP state of output.
virtual bool GetHDCPState(RROutput id, HDCPState* state) = 0;
@@ -349,9 +346,10 @@ class CHROMEOS_EXPORT OutputConfigurator
mirroring_controller_ = controller;
}
- // Replaces |delegate_| with |delegate| and sets |configure_display_| to
- // true. Should be called before Init().
- void SetDelegateForTesting(scoped_ptr<Delegate> delegate);
+ // Replaces |native_display_delegate_| with |delegate| and sets
+ // |configure_display_| to true. Should be called before Init().
+ void SetNativeDisplayDelegateForTesting(
+ scoped_ptr<NativeDisplayDelegate> delegate);
void SetTouchscreenDelegateForTesting(
scoped_ptr<TouchscreenDelegate> delegate);
@@ -395,9 +393,6 @@ class CHROMEOS_EXPORT OutputConfigurator
const base::NativeEvent& event) OVERRIDE;
virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE;
- // Called when a casting session is started or stopped.
- void OnCastingSessionStartedOrStopped(bool started);
-
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
@@ -522,12 +517,9 @@ class CHROMEOS_EXPORT OutputConfigurator
// Applies output protections according to requests.
bool ApplyProtections(const DisplayProtections& requests);
- // Sends the current projecting state to power manager.
- void SendProjectingStateToPowerManager();
-
StateController* state_controller_;
SoftwareMirroringController* mirroring_controller_;
- scoped_ptr<Delegate> delegate_;
+ scoped_ptr<NativeDisplayDelegate> native_display_delegate_;
scoped_ptr<TouchscreenDelegate> touchscreen_delegate_;
// Used to enable modes which rely on panel fitting.
@@ -574,9 +566,6 @@ class CHROMEOS_EXPORT OutputConfigurator
// Output protection requests of each client.
ProtectionRequests client_protection_requests_;
- // Number of outstanding casting sessions.
- int casting_session_count_;
-
DISALLOW_COPY_AND_ASSIGN(OutputConfigurator);
};
diff --git a/chromeos/display/output_configurator_unittest.cc b/chromeos/display/output_configurator_unittest.cc
index fd62430..3b53fd9 100644
--- a/chromeos/display/output_configurator_unittest.cc
+++ b/chromeos/display/output_configurator_unittest.cc
@@ -20,32 +20,33 @@ namespace chromeos {
namespace {
-// Strings returned by TestDelegate::GetActionsAndClear() to describe various
-// actions that were performed.
+// Strings returned by TestNativeDisplayDelegate::GetActionsAndClear() to
+// describe various actions that were performed.
const char kInitXRandR[] = "init";
const char kUpdateXRandR[] = "update";
const char kGrab[] = "grab";
const char kUngrab[] = "ungrab";
const char kSync[] = "sync";
const char kForceDPMS[] = "dpms";
-const char kProjectingOn[] = "projecting";
-const char kProjectingOff[] = "not_projecting";
-// String returned by TestDelegate::GetActionsAndClear() if no actions were
-// requested.
+// String returned by TestNativeDisplayDelegate::GetActionsAndClear() if no
+// actions were requested.
const char kNoActions[] = "";
-// Returns a string describing a TestDelegate::SetBackgroundColor() call.
+// Returns a string describing a TestNativeDisplayDelegate::SetBackgroundColor()
+// call.
std::string GetBackgroundAction(uint32 color_argb) {
return base::StringPrintf("background(0x%x)", color_argb);
}
-// Returns a string describing a TestDelegate::AddOutputMode() call.
+// Returns a string describing a TestNativeDisplayDelegate::AddOutputMode()
+// call.
std::string GetAddOutputModeAction(RROutput output, RRMode mode) {
return base::StringPrintf("add_mode(output=%lu,mode=%lu)", output, mode);
}
-// Returns a string describing a TestDelegate::ConfigureCrtc() call.
+// Returns a string describing a TestNativeDisplayDelegate::ConfigureCrtc()
+// call.
std::string GetCrtcAction(RRCrtc crtc,
int x,
int y,
@@ -55,7 +56,8 @@ std::string GetCrtcAction(RRCrtc crtc,
crtc, x, y, mode, output);
}
-// Returns a string describing a TestDelegate::CreateFramebuffer() call.
+// Returns a string describing a TestNativeDisplayDelegate::CreateFramebuffer()
+// call.
std::string GetFramebufferAction(int width,
int height,
RRCrtc crtc1,
@@ -65,7 +67,7 @@ std::string GetFramebufferAction(int width,
width, height, crtc1, crtc2);
}
-// Returns a string describing a TestDelegate::ConfigureCTM() call.
+// Returns a string describing a TestNativeDisplayDelegate::ConfigureCTM() call.
std::string GetCTMAction(
int device_id,
const OutputConfigurator::CoordinateTransformation& ctm) {
@@ -73,14 +75,14 @@ std::string GetCTMAction(
ctm.x_scale, ctm.x_offset, ctm.y_scale, ctm.y_offset);
}
-// Returns a string describing a TestDelegate::SetHDCPState() call.
+// Returns a string describing a TestNativeDisplayDelegate::SetHDCPState() call.
std::string GetSetHDCPStateAction(RROutput id, HDCPState state) {
return base::StringPrintf("set_hdcp(id=%lu,state=%d)", id, state);
}
// Joins a sequence of strings describing actions (e.g. kScreenDim) such
// that they can be compared against a string returned by
-// TestDelegate::GetActionsAndClear(). The list of actions must be
+// ActionLogger::GetActionsAndClear(). The list of actions must be
// terminated by a NULL pointer.
std::string JoinActions(const char* action, ...) {
std::string actions;
@@ -152,16 +154,17 @@ class TestTouchscreenDelegate : public OutputConfigurator::TouchscreenDelegate {
DISALLOW_COPY_AND_ASSIGN(TestTouchscreenDelegate);
};
-class TestDelegate : public OutputConfigurator::Delegate {
+class TestNativeDisplayDelegate
+ : public OutputConfigurator::NativeDisplayDelegate {
public:
static const int kXRandREventBase = 10;
// Ownership of |log| remains with the caller.
- explicit TestDelegate(ActionLogger* log)
+ explicit TestNativeDisplayDelegate(ActionLogger* log)
: max_configurable_pixels_(0),
hdcp_state_(HDCP_STATE_UNDESIRED),
log_(log) {}
- virtual ~TestDelegate() {}
+ virtual ~TestNativeDisplayDelegate() {}
const std::vector<OutputConfigurator::OutputSnapshot>& outputs() const {
return outputs_;
@@ -232,10 +235,6 @@ class TestDelegate : public OutputConfigurator::Delegate {
outputs.size() >= 1 ? outputs[0].crtc : 0,
outputs.size() >= 2 ? outputs[1].crtc : 0));
}
- virtual void SendProjectingStateToPowerManager(bool projecting) OVERRIDE {
- log_->AppendAction(projecting ? kProjectingOn : kProjectingOff);
- }
-
virtual bool GetHDCPState(RROutput id, HDCPState* state) OVERRIDE {
*state = hdcp_state_;
return true;
@@ -271,7 +270,7 @@ class TestDelegate : public OutputConfigurator::Delegate {
ActionLogger* log_; // Not owned.
- DISALLOW_COPY_AND_ASSIGN(TestDelegate);
+ DISALLOW_COPY_AND_ASSIGN(TestNativeDisplayDelegate);
};
class TestObserver : public OutputConfigurator::Observer {
@@ -383,15 +382,17 @@ class OutputConfiguratorTest : public testing::Test {
OutputConfiguratorTest()
: observer_(&configurator_),
- test_api_(&configurator_, TestDelegate::kXRandREventBase) {}
+ test_api_(&configurator_, TestNativeDisplayDelegate::kXRandREventBase) {
+ }
virtual ~OutputConfiguratorTest() {}
virtual void SetUp() OVERRIDE {
log_.reset(new ActionLogger());
- delegate_ = new TestDelegate(log_.get());
- configurator_.SetDelegateForTesting(
- scoped_ptr<OutputConfigurator::Delegate>(delegate_));
+ native_display_delegate_ = new TestNativeDisplayDelegate(log_.get());
+ configurator_.SetNativeDisplayDelegateForTesting(
+ scoped_ptr<OutputConfigurator::NativeDisplayDelegate>(
+ native_display_delegate_));
touchscreen_delegate_ = new TestTouchscreenDelegate(log_.get());
configurator_.SetTouchscreenDelegateForTesting(
@@ -438,7 +439,8 @@ class OutputConfiguratorTest : public testing::Test {
}
protected:
- // Configures |delegate_| to return the first |num_outputs| entries from
+ // Configures |native_display_delegate_| to return the first |num_outputs|
+ // entries from
// |outputs_|. If |send_events| is true, also sends screen-change and
// output-change events to |configurator_| and triggers the configure
// timeout if one was scheduled.
@@ -447,7 +449,7 @@ class OutputConfiguratorTest : public testing::Test {
std::vector<OutputConfigurator::OutputSnapshot> outputs;
for (size_t i = 0; i < num_outputs; ++i)
outputs.push_back(outputs_[i]);
- delegate_->set_outputs(outputs);
+ native_display_delegate_->set_outputs(outputs);
if (send_events) {
test_api_.SendScreenChangeEvent();
@@ -479,7 +481,6 @@ class OutputConfiguratorTest : public testing::Test {
.c_str(),
kForceDPMS,
kUngrab,
- kProjectingOff,
NULL),
log_->GetActionsAndClear());
}
@@ -490,7 +491,7 @@ class OutputConfiguratorTest : public testing::Test {
OutputConfigurator configurator_;
TestObserver observer_;
scoped_ptr<ActionLogger> log_;
- TestDelegate* delegate_; // not owned
+ TestNativeDisplayDelegate* native_display_delegate_; // not owned
TestTouchscreenDelegate* touchscreen_delegate_; // not owned
OutputConfigurator::TestApi test_api_;
@@ -595,7 +596,6 @@ TEST_F(OutputConfiguratorTest, ConnectSecondOutput) {
kBigModeId,
outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled());
@@ -632,7 +632,6 @@ TEST_F(OutputConfiguratorTest, ConnectSecondOutput) {
GetCrtcAction(
outputs_[0].crtc, 0, 0, kSmallModeId, outputs_[0].output).c_str(),
kUngrab,
- kProjectingOff,
NULL),
log_->GetActionsAndClear());
EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled());
@@ -657,7 +656,6 @@ TEST_F(OutputConfiguratorTest, ConnectSecondOutput) {
kBigModeId,
outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled());
@@ -696,7 +694,6 @@ TEST_F(OutputConfiguratorTest, ConnectSecondOutput) {
GetCrtcAction(
outputs_[0].crtc, 0, 0, kSmallModeId, outputs_[0].output).c_str(),
kUngrab,
- kProjectingOff,
NULL),
log_->GetActionsAndClear());
EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled());
@@ -722,7 +719,6 @@ TEST_F(OutputConfiguratorTest, SetDisplayPower) {
GetCrtcAction(
outputs_[1].crtc, 0, 0, kSmallModeId, outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
EXPECT_FALSE(mirroring_controller_.software_mirroring_enabled());
@@ -815,7 +811,6 @@ TEST_F(OutputConfiguratorTest, SetDisplayPower) {
kBigModeId,
outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
EXPECT_EQ(STATE_DUAL_EXTENDED, configurator_.output_state());
@@ -894,53 +889,6 @@ TEST_F(OutputConfiguratorTest, SetDisplayPower) {
EXPECT_EQ(1, observer_.num_changes());
}
-TEST_F(OutputConfiguratorTest, Casting) {
- InitWithSingleOutput();
-
- // Notify configurator that casting session is started.
- configurator_.OnCastingSessionStartedOrStopped(true);
- EXPECT_EQ(kProjectingOn, log_->GetActionsAndClear());
-
- // Verify that the configurator keeps a count of active casting sessions
- // instead of treating it as a single global state.
- configurator_.OnCastingSessionStartedOrStopped(true);
- EXPECT_EQ(kProjectingOn, log_->GetActionsAndClear());
- configurator_.OnCastingSessionStartedOrStopped(false);
- EXPECT_EQ(kProjectingOn, log_->GetActionsAndClear());
-
- // Turn all displays off and check that projecting is not turned off.
- configurator_.SetDisplayPower(DISPLAY_POWER_ALL_OFF,
- OutputConfigurator::kSetDisplayPowerNoFlags);
- EXPECT_EQ(
- JoinActions(
- kGrab,
- GetFramebufferAction(
- kSmallModeWidth, kSmallModeHeight, outputs_[0].crtc, 0).c_str(),
- GetCrtcAction(outputs_[0].crtc, 0, 0, 0, outputs_[0].output).c_str(),
- kUngrab,
- NULL),
- log_->GetActionsAndClear());
-
- // Turn all displays back on.
- configurator_.SetDisplayPower(DISPLAY_POWER_ALL_ON,
- OutputConfigurator::kSetDisplayPowerNoFlags);
- EXPECT_EQ(
- JoinActions(
- kGrab,
- GetFramebufferAction(
- kSmallModeWidth, kSmallModeHeight, outputs_[0].crtc, 0).c_str(),
- GetCrtcAction(
- outputs_[0].crtc, 0, 0, kSmallModeId, outputs_[0].output).c_str(),
- kForceDPMS,
- kUngrab,
- NULL),
- log_->GetActionsAndClear());
-
- // Notify configurator that casting session is ended.
- configurator_.OnCastingSessionStartedOrStopped(false);
- EXPECT_EQ(kProjectingOff, log_->GetActionsAndClear());
-}
-
TEST_F(OutputConfiguratorTest, SuspendAndResume) {
InitWithSingleOutput();
@@ -1020,7 +968,6 @@ TEST_F(OutputConfiguratorTest, SuspendAndResume) {
GetCrtcAction(
outputs_[1].crtc, 0, 0, kSmallModeId, outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
@@ -1064,8 +1011,7 @@ TEST_F(OutputConfiguratorTest, Headless) {
configurator_.Init(false);
EXPECT_EQ(kNoActions, log_->GetActionsAndClear());
configurator_.Start(0);
- EXPECT_EQ(JoinActions(
- kGrab, kInitXRandR, kForceDPMS, kUngrab, kProjectingOff, NULL),
+ EXPECT_EQ(JoinActions(kGrab, kInitXRandR, kForceDPMS, kUngrab, NULL),
log_->GetActionsAndClear());
// Not much should happen when the display power state is changed while
@@ -1090,7 +1036,6 @@ TEST_F(OutputConfiguratorTest, Headless) {
GetCrtcAction(outputs_[0].crtc, 0, 0, kBigModeId, outputs_[0].output)
.c_str(),
kUngrab,
- kProjectingOff,
NULL),
log_->GetActionsAndClear());
}
@@ -1117,7 +1062,6 @@ TEST_F(OutputConfiguratorTest, StartWithTwoOutputs) {
outputs_[1].crtc, 0, 0, kSmallModeId, outputs_[1].output).c_str(),
kForceDPMS,
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
}
@@ -1208,7 +1152,6 @@ TEST_F(OutputConfiguratorTest, AvoidUnnecessaryProbes) {
GetCrtcAction(
outputs_[1].crtc, 0, 0, kSmallModeId, outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
@@ -1229,7 +1172,6 @@ TEST_F(OutputConfiguratorTest, AvoidUnnecessaryProbes) {
GetCrtcAction(
outputs_[1].crtc, 0, 0, kSmallModeId, outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
@@ -1244,7 +1186,6 @@ TEST_F(OutputConfiguratorTest, AvoidUnnecessaryProbes) {
GetCrtcAction(
outputs_[0].crtc, 0, 0, kSmallModeId, outputs_[0].output).c_str(),
kUngrab,
- kProjectingOff,
NULL),
log_->GetActionsAndClear());
@@ -1257,7 +1198,7 @@ TEST_F(OutputConfiguratorTest, AvoidUnnecessaryProbes) {
// Lower the limit for which the delegate will succeed, which should result
// in the second output sticking with its native mode.
- delegate_->set_max_configurable_pixels(1);
+ native_display_delegate_->set_max_configurable_pixels(1);
UpdateOutputs(2, true);
EXPECT_EQ(
JoinActions(
@@ -1289,13 +1230,12 @@ TEST_F(OutputConfiguratorTest, AvoidUnnecessaryProbes) {
kSmallModeId,
outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
// A change event reporting a mode change on the second output should
// trigger another reconfigure.
- delegate_->set_max_configurable_pixels(0);
+ native_display_delegate_->set_max_configurable_pixels(0);
test_api_.SendOutputChangeEvent(
outputs_[1].output, outputs_[1].crtc, outputs_[1].mirror_mode, true);
EXPECT_TRUE(test_api_.TriggerConfigureTimeout());
@@ -1311,7 +1251,6 @@ TEST_F(OutputConfiguratorTest, AvoidUnnecessaryProbes) {
GetCrtcAction(
outputs_[1].crtc, 0, 0, kSmallModeId, outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
}
@@ -1370,7 +1309,6 @@ TEST_F(OutputConfiguratorTest, PanelFitting) {
outputs_[1].crtc, 0, 0, kSmallModeId, outputs_[1].output).c_str(),
kForceDPMS,
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
@@ -1435,7 +1373,7 @@ TEST_F(OutputConfiguratorTest, OutputProtection) {
log_->GetActionsAndClear());
// Enable protection.
- delegate_->set_hdcp_state(HDCP_STATE_ENABLED);
+ native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED);
EXPECT_TRUE(configurator_.QueryOutputProtectionStatus(id,
outputs_[1].display_id,
&link_mask,
@@ -1471,7 +1409,7 @@ TEST_F(OutputConfiguratorTest, OutputProtectionTwoClients) {
EXPECT_EQ(
GetSetHDCPStateAction(outputs_[1].output, HDCP_STATE_DESIRED).c_str(),
log_->GetActionsAndClear());
- delegate_->set_hdcp_state(HDCP_STATE_ENABLED);
+ native_display_delegate_->set_hdcp_state(HDCP_STATE_ENABLED);
uint32_t link_mask = 0;
uint32_t protection_mask = 0;
@@ -1572,7 +1510,7 @@ TEST_F(OutputConfiguratorTest, HandleConfigureCrtcFailure) {
// First test simply fails in STATE_SINGLE mode. This is probably
// unrealistic but the want to make sure any assumptions don't
// creep in.
- delegate_->set_max_configurable_pixels(
+ native_display_delegate_->set_max_configurable_pixels(
outputs_[0].mode_infos[kFirstMode + 2].width *
outputs_[0].mode_infos[kFirstMode + 2].height);
state_controller_.set_state(STATE_SINGLE);
@@ -1592,13 +1530,12 @@ TEST_F(OutputConfiguratorTest, HandleConfigureCrtcFailure) {
outputs_[0].crtc, 0, 0, kFirstMode + 2, outputs_[0].output)
.c_str(),
kUngrab,
- kProjectingOff,
NULL),
log_->GetActionsAndClear());
// This test should attempt to configure a mirror mode that will not succeed
// and should end up in extended mode.
- delegate_->set_max_configurable_pixels(
+ native_display_delegate_->set_max_configurable_pixels(
outputs_[0].mode_infos[kFirstMode + 3].width *
outputs_[0].mode_infos[kFirstMode + 3].height);
state_controller_.set_state(STATE_DUAL_MIRROR);
@@ -1653,7 +1590,6 @@ TEST_F(OutputConfiguratorTest, HandleConfigureCrtcFailure) {
kFirstMode + 3,
outputs_[1].output).c_str(),
kUngrab,
- kProjectingOn,
NULL),
log_->GetActionsAndClear());
}