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

Commit cf3e1a7f authored by Chris Craik's avatar Chris Craik Committed by android-build-merger
Browse files

Merge \\"Change swap chain stuffed detection logic\\" into nyc-mr1-dev am: 433a19e8

am: 3c374129

Change-Id: Id7e0d1d1dfb5448dd927c29361fb98aabf0cfe10
parents 7d261d7e 3c374129
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -219,9 +219,9 @@ bool CanvasContext::isSwapChainStuffed() {
    for (size_t i = 1; i < mSwapHistory.size(); i++) {
        auto& swapB = mSwapHistory[i];

        // If there's a frameInterval gap we effectively already dropped a frame,
        // If there's a multi-frameInterval gap we effectively already dropped a frame,
        // so consider the queue healthy.
        if (swapA.swapCompletedTime - swapB.swapCompletedTime > frameInterval) {
        if (swapA.swapCompletedTime - swapB.swapCompletedTime > frameInterval * 3) {
            return false;
        }

@@ -296,12 +296,17 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo,
            // Already drew for this vsync pulse, UI draw request missed
            // the deadline for RT animations
            info.out.canDrawThisFrame = false;
        } else if (vsyncDelta >= mRenderThread.timeLord().frameIntervalNanos()) {
            // It's been at least an entire frame interval, assume
            // the buffer queue is fine
        } else if (vsyncDelta >= mRenderThread.timeLord().frameIntervalNanos() * 3
                || (latestVsync - mLastDropVsync) < 500_ms) {
            // It's been several frame intervals, assume the buffer queue is fine
            // or the last drop was too recent
            info.out.canDrawThisFrame = true;
        } else {
            info.out.canDrawThisFrame = !isSwapChainStuffed();
            if (!info.out.canDrawThisFrame) {
                // dropping frame
                mLastDropVsync = mRenderThread.timeLord().latestVsync();
            }
        }
    } else {
        info.out.canDrawThisFrame = true;
+3 −0
Original line number Diff line number Diff line
@@ -200,6 +200,9 @@ private:
    RingBuffer<SwapHistory, 3> mSwapHistory;
    int64_t mFrameNumber = -1;

    // last vsync for a dropped frame due to stuffed queue
    nsecs_t mLastDropVsync = 0;

    bool mOpaque;
    BakedOpRenderer::LightInfo mLightInfo;
    FrameBuilder::LightGeometry mLightGeometry = { {0, 0, 0}, 0 };