summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Bouyack <mbouyack@google.com>2017-06-01 14:37:29 -0700
committerMatthew Bouyack <mbouyack@google.com>2017-06-07 22:38:50 +0000
commit674c714ddde6488c12d3a01f84fdf71cd976f614 (patch)
tree87aa5db35be42c7a3f100616b14ced16845bdbe7
parent2d4959d8ebb865f67a6568ac76e16492797f1611 (diff)
downloadnative-674c714ddde6488c12d3a01f84fdf71cd976f614.tar.gz
DO NOT MERGE: Eliminate redundant changes to hardware vsync state.
When transitioning between NORMAL and DOZE power modes we were redundantly calling resyncHardwareVsync. Similarly, when transitioning from DOZE_SUSPEND to OFF we were redundantly calling disableHardwareVsync. This change eliminates those redundant calls. Fixes bug 62235417 Change-Id: I513bbf94a7ab973ab258efe16436441ac2379b70
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp6
-rw-r--r--services/surfaceflinger/SurfaceFlinger_hwc1.cpp6
2 files changed, 8 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 448f12ac95..b009fca6e0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2642,7 +2642,8 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
ALOGW("Couldn't set SCHED_OTHER on display off");
}
- if (type == DisplayDevice::DISPLAY_PRIMARY) {
+ if (type == DisplayDevice::DISPLAY_PRIMARY &&
+ currentMode != HWC_POWER_MODE_DOZE_SUSPEND) {
disableHardwareVsync(true); // also cancels any in-progress resync
// FIXME: eventthread only knows about the main display right now
@@ -2656,7 +2657,8 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
mode == HWC_POWER_MODE_NORMAL) {
// Update display while dozing
getHwComposer().setPowerMode(type, mode);
- if (type == DisplayDevice::DISPLAY_PRIMARY) {
+ if (type == DisplayDevice::DISPLAY_PRIMARY &&
+ currentMode == HWC_POWER_MODE_DOZE_SUSPEND) {
// FIXME: eventthread only knows about the main display right now
mEventThread->onScreenAcquired();
resyncToHardwareVsync(true);
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index a371c76e6d..271930bdce 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -2558,7 +2558,8 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
ALOGW("Couldn't set SCHED_OTHER on display off");
}
- if (type == DisplayDevice::DISPLAY_PRIMARY) {
+ if (type == DisplayDevice::DISPLAY_PRIMARY &&
+ currentMode != HWC_POWER_MODE_DOZE_SUSPEND) {
disableHardwareVsync(true); // also cancels any in-progress resync
// FIXME: eventthread only knows about the main display right now
@@ -2572,7 +2573,8 @@ void SurfaceFlinger::setPowerModeInternal(const sp<DisplayDevice>& hw,
mode == HWC_POWER_MODE_NORMAL) {
// Update display while dozing
getHwComposer().setPowerMode(type, mode);
- if (type == DisplayDevice::DISPLAY_PRIMARY) {
+ if (type == DisplayDevice::DISPLAY_PRIMARY &&
+ currentMode == HWC_POWER_MODE_DOZE_SUSPEND) {
// FIXME: eventthread only knows about the main display right now
mEventThread->onScreenAcquired();
resyncToHardwareVsync(true);