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

Commit 60bda728 authored by Ady Abraham's avatar Ady Abraham Committed by Automerger Merge Worker
Browse files

Merge "Ensure that expected present time is in the future" am: 2ea36520 am: 444ea081

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1557199

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7800429fa86079abddf4ed736b79bccfe8f4ee78
parents 921f6e84 444ea081
Loading
Loading
Loading
Loading
+9 −3
Original line number Original line Diff line number Diff line
@@ -1726,8 +1726,14 @@ void SurfaceFlinger::onMessageInvalidate(nsecs_t expectedVSyncTime) {
    // calculate the expected present time once and use the cached
    // calculate the expected present time once and use the cached
    // value throughout this frame to make sure all layers are
    // value throughout this frame to make sure all layers are
    // seeing this same value.
    // seeing this same value.
    const nsecs_t lastExpectedPresentTime = mExpectedPresentTime.load();
    if (expectedVSyncTime >= frameStart) {
        mExpectedPresentTime = expectedVSyncTime;
        mExpectedPresentTime = expectedVSyncTime;
    } else {
        mExpectedPresentTime = mScheduler->getDispSyncExpectedPresentTime(frameStart);
    }

    const nsecs_t lastScheduledPresentTime = mScheduledPresentTime;
    mScheduledPresentTime = expectedVSyncTime;


    // When Backpressure propagation is enabled we want to give a small grace period
    // When Backpressure propagation is enabled we want to give a small grace period
    // for the present fence to fire instead of just giving up on this frame to handle cases
    // for the present fence to fire instead of just giving up on this frame to handle cases
@@ -1757,7 +1763,7 @@ void SurfaceFlinger::onMessageInvalidate(nsecs_t expectedVSyncTime) {
    const TracedOrdinal<bool> frameMissed = {"PrevFrameMissed",
    const TracedOrdinal<bool> frameMissed = {"PrevFrameMissed",
                                             framePending ||
                                             framePending ||
                                                     (previousPresentTime >= 0 &&
                                                     (previousPresentTime >= 0 &&
                                                      (lastExpectedPresentTime <
                                                      (lastScheduledPresentTime <
                                                       previousPresentTime - frameMissedSlop))};
                                                       previousPresentTime - frameMissedSlop))};
    const TracedOrdinal<bool> hwcFrameMissed = {"PrevHwcFrameMissed",
    const TracedOrdinal<bool> hwcFrameMissed = {"PrevHwcFrameMissed",
                                                mHadDeviceComposition && frameMissed};
                                                mHadDeviceComposition && frameMissed};
+1 −0
Original line number Original line Diff line number Diff line
@@ -1199,6 +1199,7 @@ private:
    std::unique_ptr<scheduler::RefreshRateStats> mRefreshRateStats;
    std::unique_ptr<scheduler::RefreshRateStats> mRefreshRateStats;


    std::atomic<nsecs_t> mExpectedPresentTime = 0;
    std::atomic<nsecs_t> mExpectedPresentTime = 0;
    nsecs_t mScheduledPresentTime = 0;
    hal::Vsync mHWCVsyncPendingState = hal::Vsync::DISABLE;
    hal::Vsync mHWCVsyncPendingState = hal::Vsync::DISABLE;


    /* ------------------------------------------------------------------------
    /* ------------------------------------------------------------------------