diff options
author | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-16 17:54:37 +0000 |
---|---|---|
committer | kerz@chromium.org <kerz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-16 17:54:37 +0000 |
commit | b28065dffc40a2a5219081822479e98c0ad07baa (patch) | |
tree | 5a43365d23d22e8be92637d39e1d37c1df4ba413 /chromeos | |
parent | 2bc06e31cbda7bf91296e4a8637248fcfe053568 (diff) | |
download | chromium_src-b28065dffc40a2a5219081822479e98c0ad07baa.zip chromium_src-b28065dffc40a2a5219081822479e98c0ad07baa.tar.gz chromium_src-b28065dffc40a2a5219081822479e98c0ad07baa.tar.bz2 |
Merge 151696 - 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
TBR=disher@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10854188
git-svn-id: svn://svn.chromium.org/chrome/branches/1229/src@151918 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r-- | chromeos/display/output_configurator.cc | 16 | ||||
-rw-r--r-- | chromeos/display/output_configurator.h | 5 |
2 files changed, 17 insertions, 4 deletions
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc index d3f2311..b3506dc 100644 --- a/chromeos/display/output_configurator.cc +++ b/chromeos/display/output_configurator.cc @@ -394,6 +394,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, @@ -463,9 +466,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); @@ -570,7 +579,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. |