Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60954518 authored by Dan Stoza's avatar Dan Stoza Committed by android-build-merger
Browse files

Merge "SF: Use last call time to rate limit resyncs" into oc-dev

am: 2e252c93

Change-Id: Id9ecf8b6aeb8ce3b084c1aa21096a0dc03e3fb7c
parents 0bcb8e93 2e252c93
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1116,9 +1116,14 @@ void SurfaceFlinger::disableHardwareVsync(bool makeUnavailable) {

void SurfaceFlinger::resyncWithRateLimit() {
    static constexpr nsecs_t kIgnoreDelay = ms2ns(500);
    if (systemTime() - mLastSwapTime > kIgnoreDelay) {

    // No explicit locking is needed here since EventThread holds a lock while calling this method
    static nsecs_t sLastResyncAttempted = 0;
    const nsecs_t now = systemTime();
    if (now - sLastResyncAttempted > kIgnoreDelay) {
        resyncToHardwareVsync(false);
    }
    sLastResyncAttempted = now;
}

void SurfaceFlinger::onVSyncReceived(HWComposer* composer, int32_t type,