summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authordisher@chromium.org <disher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-15 15:41:46 +0000
committerdisher@chromium.org <disher@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-15 15:41:46 +0000
commit1be92e0af6a6db20ba66554db889c313ee20d59a (patch)
tree075766f9da1d83f5c69abf2f733a568d937e85aa /chromeos
parent34b77d3555cd7f2a362dbdb9d6aa606be52ee73b (diff)
downloadchromium_src-1be92e0af6a6db20ba66554db889c313ee20d59a.zip
chromium_src-1be92e0af6a6db20ba66554db889c313ee20d59a.tar.gz
chromium_src-1be92e0af6a6db20ba66554db889c313ee20d59a.tar.bz2
Refresh output cache when setting display mode
Historically, all the entry-points into the OutputConfigurator needed to refresh their view of the cached output data. This newly-added entry-point doesn't do this which can lead to the cached data becoming stale (since it technically only applies within the context where the corresponding XRRScreenResources are valid). Ideally, no such information would be cached and every attempt to evaluate or change the state of the video outputs would start by requesting this structure. That change is of larger scope and risk, though, so this is the tactical solution to the immediate problem suitable for porting to stable branches. BUG=chromium:140807 TEST=Manually tested that ctrl-F4 and "manage displays" (in chrome://settings) work on a Lumpy the same way with and without this change Review URL: https://chromiumcodereview.appspot.com/10825306 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/display/output_configurator.cc16
-rw-r--r--chromeos/display/output_configurator.h5
2 files changed, 17 insertions, 4 deletions
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
index c38a4ca..9504ef5 100644
--- a/chromeos/display/output_configurator.cc
+++ b/chromeos/display/output_configurator.cc
@@ -396,6 +396,9 @@ bool OutputConfigurator::SetDisplayMode(OutputState new_state) {
XRRScreenResources* screen = XRRGetScreenResources(display, window);
CHECK(screen != NULL);
+ // We are about to act on the cached output data but it could be stale so
+ // force the outputs to be recached.
+ ForceRecacheOutputs(display, screen);
UpdateCacheAndXrandrToState(display,
screen,
window,
@@ -465,9 +468,15 @@ bool OutputConfigurator::TryRecacheOutputs(Display* display,
}
}
- if (!outputs_did_change)
- return false;
- // We now know that we need to recache so free and re-alloc the buffer.
+ if (outputs_did_change) {
+ // We now know that we need to recache so free and re-alloc the buffer.
+ ForceRecacheOutputs(display, screen);
+ }
+ return outputs_did_change;
+}
+
+void OutputConfigurator::ForceRecacheOutputs(Display* display,
+ XRRScreenResources* screen) {
output_count_ = screen->noutput;
if (output_count_ == 0) {
output_cache_.reset(NULL);
@@ -572,7 +581,6 @@ bool OutputConfigurator::TryRecacheOutputs(Display* display,
<< " primary " << primary_mode
<< " secondary " << second_mode;
}
- return outputs_did_change;
}
void OutputConfigurator::UpdateCacheAndXrandrToState(
diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h
index bbf0063..caf5335 100644
--- a/chromeos/display/output_configurator.h
+++ b/chromeos/display/output_configurator.h
@@ -104,6 +104,11 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher {
// Note that |output_state_| is not updated by this call.
bool TryRecacheOutputs(Display* display, XRRScreenResources* screen);
+ // Updates |output_count_|, |output_cache_|, |mirror_supported_|,
+ // |primary_output_index_|, and |secondary_output_index_| with new data.
+ // Note that |output_state_| is not updated by this call.
+ void ForceRecacheOutputs(Display* display, XRRScreenResources* screen);
+
// Uses the data stored in |output_cache_| and the given |new_state| to
// configure the Xrandr interface and then updates |output_state_| to reflect
// the new state.