| Index: chromeos/display/output_configurator.cc
|
| diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
|
| index 92f2953de7929046963f3ee4dfbbd961a30d5369..a935435da34fb09ff29785f6d9ff8ca0b5a743ae 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),
|
| @@ -192,7 +193,8 @@ void OutputConfigurator::Init(bool is_panel_fitting_enabled,
|
| // Cache the initial output state.
|
| delegate_->SetPanelFittingEnabled(is_panel_fitting_enabled);
|
| delegate_->GrabServer();
|
| - 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);
|
| delegate_->UngrabServer();
|
| @@ -205,7 +207,8 @@ void OutputConfigurator::Start() {
|
| delegate_->GrabServer();
|
| delegate_->InitXRandRExtension(&xrandr_event_base_);
|
|
|
| - std::vector<OutputSnapshot> outputs = delegate_->GetOutputs();
|
| + std::vector<OutputSnapshot> outputs =
|
| + delegate_->GetOutputs(state_controller_);
|
| EnterStateOrFallBackToSoftwareMirroring(
|
| GetOutputState(outputs, power_state_), power_state_, outputs);
|
|
|
| @@ -231,7 +234,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;
|
| @@ -265,7 +269,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();
|
| @@ -357,11 +362,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);
|
| @@ -376,19 +395,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());
|
| }
|
| @@ -440,14 +446,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);
|
| @@ -515,14 +522,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
|
|
|