Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: chromeos/display/output_configurator.cc

Issue 21297003: Add ability to set resolution on external display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adraddressed comment, adjusted test Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/display/output_configurator.h ('k') | chromeos/display/output_configurator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/display/output_configurator.cc
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
index 2a51228b9aad4391d44be44e11a7f03f224162eb..c1d2b30a654be1ce9207aefb29794d9f9914cb1d 100644
--- a/chromeos/display/output_configurator.cc
+++ b/chromeos/display/output_configurator.cc
@@ -104,6 +104,7 @@ OutputConfigurator::OutputSnapshot::OutputSnapshot()
current_mode(None),
native_mode(None),
mirror_mode(None),
+ selected_mode(None),
y(0),
height(0),
is_internal(false),
@@ -196,7 +197,8 @@ void OutputConfigurator::Start(uint32 background_color_argb) {
delegate_->GrabServer();
delegate_->InitXRandRExtension(&xrandr_event_base_);
- std::vector<OutputSnapshot> outputs = delegate_->GetOutputs();
+ std::vector<OutputSnapshot> outputs =
+ delegate_->GetOutputs(state_controller_);
if (outputs.size() > 1 && background_color_argb)
delegate_->SetBackgroundColor(background_color_argb);
EnterStateOrFallBackToSoftwareMirroring(
@@ -225,7 +227,8 @@ bool OutputConfigurator::SetDisplayPower(DisplayPowerState power_state,
return true;
delegate_->GrabServer();
- std::vector<OutputSnapshot> outputs = delegate_->GetOutputs();
+ std::vector<OutputSnapshot> outputs =
+ delegate_->GetOutputs(state_controller_);
bool only_if_single_internal_display =
flags & kSetDisplayPowerOnlyIfSingleInternalDisplay;
@@ -259,7 +262,8 @@ bool OutputConfigurator::SetDisplayMode(OutputState new_state) {
}
delegate_->GrabServer();
- std::vector<OutputSnapshot> outputs = delegate_->GetOutputs();
+ std::vector<OutputSnapshot> outputs =
+ delegate_->GetOutputs(state_controller_);
bool success = EnterStateOrFallBackToSoftwareMirroring(
new_state, power_state_, outputs);
delegate_->UngrabServer();
@@ -351,11 +355,25 @@ void OutputConfigurator::ResumeDisplays() {
SetDisplayPower(power_state_, kSetDisplayPowerForceProbe);
}
+void OutputConfigurator::ScheduleConfigureOutputs() {
+ if (configure_timer_.get()) {
+ configure_timer_->Reset();
+ } else {
+ configure_timer_.reset(new base::OneShotTimer<OutputConfigurator>());
+ configure_timer_->Start(
+ FROM_HERE,
+ base::TimeDelta::FromMilliseconds(kConfigureDelayMs),
+ this,
+ &OutputConfigurator::ConfigureOutputs);
+ }
+}
+
void OutputConfigurator::ConfigureOutputs() {
configure_timer_.reset();
delegate_->GrabServer();
- std::vector<OutputSnapshot> outputs = delegate_->GetOutputs();
+ std::vector<OutputSnapshot> outputs =
+ delegate_->GetOutputs(state_controller_);
OutputState new_state = GetOutputState(outputs, power_state_);
bool success = EnterStateOrFallBackToSoftwareMirroring(
new_state, power_state_, outputs);
@@ -370,19 +388,6 @@ void OutputConfigurator::ConfigureOutputs() {
delegate_->SendProjectingStateToPowerManager(IsProjecting(outputs));
}
-void OutputConfigurator::ScheduleConfigureOutputs() {
- if (configure_timer_.get()) {
- configure_timer_->Reset();
- } else {
- configure_timer_.reset(new base::OneShotTimer<OutputConfigurator>());
- configure_timer_->Start(
- FROM_HERE,
- base::TimeDelta::FromMilliseconds(kConfigureDelayMs),
- this,
- &OutputConfigurator::ConfigureOutputs);
- }
-}
-
void OutputConfigurator::NotifyOnDisplayChanged() {
FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged());
}
@@ -434,14 +439,15 @@ bool OutputConfigurator::EnterState(
const OutputSnapshot& output = outputs.size() == 1 ? outputs[0] :
(output_power[0] ? outputs[0] : outputs[1]);
int width = 0, height = 0;
- if (!delegate_->GetModeDetails(output.native_mode, &width, &height, NULL))
+ if (!delegate_->GetModeDetails(
+ output.selected_mode, &width, &height, NULL))
return false;
std::vector<CrtcConfig> configs(outputs.size());
for (size_t i = 0; i < outputs.size(); ++i) {
configs[i] = CrtcConfig(
outputs[i].crtc, 0, 0,
- output_power[i] ? outputs[i].native_mode : None,
+ output_power[i] ? outputs[i].selected_mode : None,
outputs[i].output);
}
delegate_->CreateFrameBuffer(width, height, configs);
@@ -509,14 +515,14 @@ bool OutputConfigurator::EnterState(
int width = 0, height = 0;
for (size_t i = 0; i < outputs.size(); ++i) {
- if (!delegate_->GetModeDetails(outputs[i].native_mode,
+ if (!delegate_->GetModeDetails(outputs[i].selected_mode,
&(mode_sizes[i].first), &(mode_sizes[i].second), NULL)) {
return false;
}
configs[i] = CrtcConfig(
outputs[i].crtc, 0, (height ? height + kVerticalGap : 0),
- output_power[i] ? outputs[i].native_mode : None,
+ output_power[i] ? outputs[i].selected_mode : None,
outputs[i].output);
// Retain the full screen size even if all outputs are off so the
« no previous file with comments | « chromeos/display/output_configurator.h ('k') | chromeos/display/output_configurator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698