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

Commit 429fd15f 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

am: 60954518

Change-Id: Ic03549017c29b05cae9363483b3e980723a3817d
parents 4206d155 60954518
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,