diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-16 18:16:05 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-16 18:16:05 +0000 |
commit | bb0f0b36834c698e77372a093b808f0bf292521a (patch) | |
tree | f3488f7fddcfffb4be80592391a2b898cfeeea22 /chromeos | |
parent | 0cea355a02d0bf07f6f16f8732b5922b78598e26 (diff) | |
download | chromium_src-bb0f0b36834c698e77372a093b808f0bf292521a.zip chromium_src-bb0f0b36834c698e77372a093b808f0bf292521a.tar.gz chromium_src-bb0f0b36834c698e77372a093b808f0bf292521a.tar.bz2 |
Reconfigure displays even if the output count didn't change
Remove obsolete STATE_DUAL_SECONDARY_ONLY
TBR=jamescook@chromium.org
BUG=chromium-os:12662
TEST=none
Review URL: https://chromiumcodereview.appspot.com/12254041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182987 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/display/output_configurator.cc | 44 | ||||
-rw-r--r-- | chromeos/display/output_configurator.h | 4 |
2 files changed, 21 insertions, 27 deletions
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc index d2a5769..de22e2c 100644 --- a/chromeos/display/output_configurator.cc +++ b/chromeos/display/output_configurator.cc @@ -372,11 +372,8 @@ OutputState InferCurrentState(Display* display, if (primary_native && secondary_native) { // Just check the relative locations. int secondary_offset = outputs[0].height + kVerticalGap; - int primary_offset = outputs[1].height + kVerticalGap; if ((outputs[0].y == 0) && (outputs[1].y == secondary_offset)) { - state = STATE_DUAL_PRIMARY_ONLY; - } else if ((outputs[1].y == 0) && (outputs[0].y == primary_offset)) { - state = STATE_DUAL_SECONDARY_ONLY; + state = STATE_DUAL_EXTENDED; } else { // Unexpected locations. state = STATE_DUAL_UNKNOWN; @@ -412,16 +409,16 @@ OutputState GetNextState(Display* display, bool mirror_supported = (0 != outputs[0].mirror_mode) && (0 != outputs[1].mirror_mode); switch (current_state) { - case STATE_DUAL_PRIMARY_ONLY: + case STATE_DUAL_EXTENDED: state = - mirror_supported ? STATE_DUAL_MIRROR : STATE_DUAL_PRIMARY_ONLY; + mirror_supported ? STATE_DUAL_MIRROR : STATE_DUAL_EXTENDED; break; case STATE_DUAL_MIRROR: - state = STATE_DUAL_PRIMARY_ONLY; + state = STATE_DUAL_EXTENDED; break; default: - // Default to primary only. - state = STATE_DUAL_PRIMARY_ONLY; + // Default to extended mode. + state = STATE_DUAL_EXTENDED; } break; } @@ -808,21 +805,23 @@ void OutputConfigurator::ConfigureOutputs() { std::vector<OutputSnapshot> outputs = GetDualOutputs(display, screen); int new_output_count = outputs.size(); - bool changed = false; - if (new_output_count != connected_output_count_) { - connected_output_count_ = new_output_count; - OutputState new_state = - GetNextState(display, screen, STATE_INVALID, outputs); - changed = EnterState(display, screen, window, new_state, outputs); - if (changed) - output_state_ = new_state; - } + // Don't skip even if the output counts didn't change because + // a display might have been swapped during the suspend. + connected_output_count_ = new_output_count; + OutputState new_state = + GetNextState(display, screen, STATE_INVALID, outputs); + // When a display was swapped, the state moves from + // STATE_DUAL_EXTENDED to STATE_DUAL_EXTENDED, so don't rely on + // the state chagne to tell if it was successful. + bool success = EnterState(display, screen, window, new_state, outputs); bool is_projecting = IsProjecting(outputs); XRRFreeScreenResources(screen); XUngrabServer(display); - if (changed) + if (success) { + output_state_ = new_state; NotifyOnDisplayChanged(); + } chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> SetIsProjecting(is_projecting); } @@ -1256,7 +1255,7 @@ bool OutputConfigurator::EnterState( CrtcConfig config2(secondary_crtc, 0, 0, outputs[1].native_mode, outputs[1].output); - if (new_state == STATE_DUAL_PRIMARY_ONLY) + if (new_state == STATE_DUAL_EXTENDED) config2.y = primary_height + kVerticalGap; else config1.y = secondary_height + kVerticalGap; @@ -1318,13 +1317,10 @@ void OutputConfigurator::RecordPreviousStateUMA() { UMA_HISTOGRAM_LONG_TIMES("Display.EnterState.mirror_fallback_duration", duration); break; - case STATE_DUAL_PRIMARY_ONLY: + case STATE_DUAL_EXTENDED: UMA_HISTOGRAM_LONG_TIMES("Display.EnterState.dual_primary_duration", duration); break; - case STATE_DUAL_SECONDARY_ONLY: - UMA_HISTOGRAM_LONG_TIMES("Display.EnterState.dual_secondary_duration", - duration); default: break; } diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h index 4c72929..ea96a3b 100644 --- a/chromeos/display/output_configurator.h +++ b/chromeos/display/output_configurator.h @@ -35,14 +35,12 @@ namespace chromeos { struct OutputSnapshot; // Used to describe the state of a multi-display configuration. -// TODO(oshima): remove DUAL_SECONDARY_ONLY enum OutputState { STATE_INVALID, STATE_HEADLESS, STATE_SINGLE, STATE_DUAL_MIRROR, - STATE_DUAL_PRIMARY_ONLY, - STATE_DUAL_SECONDARY_ONLY, + STATE_DUAL_EXTENDED, STATE_DUAL_UNKNOWN, }; |