summaryrefslogtreecommitdiffstats
path: root/chromeos/display
diff options
context:
space:
mode:
authormarcheu@chromium.org <marcheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 04:50:30 +0000
committermarcheu@chromium.org <marcheu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 04:50:30 +0000
commit27fbe7f1f656b18735d5d4d72302bcf040176e6a (patch)
tree9f563f687685fb8e55ffd67623f4c57742866d80 /chromeos/display
parent6a2c09f4c85933cd360b9cc1af5dec1f4e78a356 (diff)
downloadchromium_src-27fbe7f1f656b18735d5d4d72302bcf040176e6a.zip
chromium_src-27fbe7f1f656b18735d5d4d72302bcf040176e6a.tar.gz
chromium_src-27fbe7f1f656b18735d5d4d72302bcf040176e6a.tar.bz2
Implement support for monitor suspend.
This speeds up idle resume by around 2.5 seconds. Previously, we would turn the panel off before idle suspend. Then we would suspend and resume. On resume, the kernel would restore the "off" state, and the Chrome monitor code would kick in to turn the panel on. This is a huge waste of time when each panel configuration step takes more than one second. Instead, just before suspending, we turn the backlight off and the panel on. On resume the kernel sets the panel state to on right away, and power_manager turns the backlight on. The Chrome monitor code still runs, but is a noop. This change needs this power_manager change to handle the backlight part: https://gerrit.chromium.org/gerrit/#/c/40971/ This landed as r178195, but was reverted in r178288 because it crashed in the VM tests; unregistering suspenddelay from the destructor was assuming that the object proxy was still around which wasn't the case. I fixed the destructor to not unregister the suspenddelay. BUG=chrome-os-partner:13364 TEST=By hand: reduce the idle suspend timeout, let the machine idle and TEST=suspend, press a key to resume and see how long it takes. The time TEST=it takes shrinks from ~4 seconds to ~1.5 second. TBR=sky@chromium.org Change-Id: I610995c12ed08624eb0bc91057d7c9bfa8002fbf Review URL: https://chromiumcodereview.appspot.com/12036092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/display')
-rw-r--r--chromeos/display/output_configurator.cc15
-rw-r--r--chromeos/display/output_configurator.h5
2 files changed, 18 insertions, 2 deletions
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
index bad007a..ddfb003 100644
--- a/chromeos/display/output_configurator.cc
+++ b/chromeos/display/output_configurator.cc
@@ -790,9 +790,9 @@ bool OutputConfigurator::IsInternalOutputName(const std::string& name) {
void OutputConfigurator::WillNotifyOnDisplayChanged() {
// Sets the timer for NotifyOnDisplayChanged(). When an output state change
- // is issued, several notifications chould arrive and NotifyOnDisplayChanged()
+ // is issued, several notifications should arrive and NotifyOnDisplayChanged()
// should be called once for the last one. The timer could lead at most a few
- // handreds milliseconds of delay for the notification, but it would be
+ // hundreds of milliseconds of delay for the notification, but it would be
// unrecognizable for users.
if (notification_timer_.get()) {
notification_timer_->Reset();
@@ -806,6 +806,17 @@ void OutputConfigurator::WillNotifyOnDisplayChanged() {
}
}
+void OutputConfigurator::SuspendDisplays() {
+ // Turn displays on before suspend. At this point, the backlight is off,
+ // so we turn on the internal display so that we can resume directly into
+ // "on" state. This greatly reduces resume times.
+ ScreenPowerSet(true, true);
+ // We need to make sure that the monitor configuration we just did actually
+ // completes before we return, because otherwise the X message could be
+ // racing with the HandleSuspendReadiness message.
+ XSync(base::MessagePumpAuraX11::GetDefaultXDisplay(), 0);
+}
+
void OutputConfigurator::NotifyOnDisplayChanged() {
notification_timer_.reset();
FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged());
diff --git a/chromeos/display/output_configurator.h b/chromeos/display/output_configurator.h
index 132d10b..8febbaf 100644
--- a/chromeos/display/output_configurator.h
+++ b/chromeos/display/output_configurator.h
@@ -101,6 +101,11 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher {
// Tells if the output specified by |name| is for internal display.
static bool IsInternalOutputName(const std::string& name);
+ // Set all the displays into pre-suspend mode; usually this means configure
+ // them for their resume state. This allows faster resume on machines where
+ // display configuration is slow.
+ void SuspendDisplays();
+
private:
// Schedules notifying OnDisplayModeChanged().
void WillNotifyOnDisplayChanged();