From: Dan Stoza Date: Tue, 19 Apr 2016 18:56:20 +0000 (-0700) Subject: DispSync: Don't resync if HW vsync is unavailable X-Git-Tag: android-x86-7.1-r1~145^2~104^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=0a3c4d6f8c95a89875455e989278a440822968d7;p=android-x86%2Fframeworks-native.git 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 --- 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); } }