From 0a3c4d6f8c95a89875455e989278a440822968d7 Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Tue, 19 Apr 2016 11:56:20 -0700 Subject: [PATCH] DispSync: Don't resync if HW vsync is unavailable Don't attempt to resync to hardware vsync if it's not available (if the display is blanked), which should prevent unusual sequences of commands (enable vsync, then unblank) to hardware composer. Bug: 28177844 Change-Id: I9d6046fb0a346830e98829fd250642f0809d7e31 --- services/surfaceflinger/SurfaceFlinger.cpp | 5 +++-- services/surfaceflinger/SurfaceFlinger_hwc1.cpp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index c09920cd2e..a69b11b0c3 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -800,7 +800,8 @@ void SurfaceFlinger::resyncToHardwareVsync(bool makeAvailable) { if (makeAvailable) { mHWVsyncAvailable = true; } else if (!mHWVsyncAvailable) { - ALOGE("resyncToHardwareVsync called when HW vsync unavailable"); + // Hardware vsync is not currently available, so abort the resync + // attempt for now return; } @@ -834,7 +835,7 @@ void SurfaceFlinger::disableHardwareVsync(bool makeUnavailable) { void SurfaceFlinger::resyncWithRateLimit() { static constexpr nsecs_t kIgnoreDelay = ms2ns(500); if (systemTime() - mLastSwapTime > kIgnoreDelay) { - resyncToHardwareVsync(true); + resyncToHardwareVsync(false); } } diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp index b0115988ef..00700ab590 100644 --- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp +++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp @@ -820,7 +820,8 @@ void SurfaceFlinger::resyncToHardwareVsync(bool makeAvailable) { if (makeAvailable) { mHWVsyncAvailable = true; } else if (!mHWVsyncAvailable) { - ALOGE("resyncToHardwareVsync called when HW vsync unavailable"); + // Hardware vsync is not currently available, so abort the resync + // attempt for now return; } @@ -854,7 +855,7 @@ void SurfaceFlinger::disableHardwareVsync(bool makeUnavailable) { void SurfaceFlinger::resyncWithRateLimit() { static constexpr nsecs_t kIgnoreDelay = ms2ns(500); if (systemTime() - mLastSwapTime > kIgnoreDelay) { - resyncToHardwareVsync(true); + resyncToHardwareVsync(false); } } -- 2.11.0