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

Commit b7f1556d authored by Ady Abraham's avatar Ady Abraham
Browse files

SF: pass the predicted present time to LayerHistory

If the predicted present time, according to the frame timeline vsync id,
is known, pass it to LayerHistory so we could heuristically detect
the frame rate of those layers. This is primarly used for TextureView
based media players.

Bug: 181849694
Test: TBD
Change-Id: I4e1d8a0d9c8279c64a514b1f24f4b802e0e9188d
parent 99ebe3f9
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -375,7 +375,16 @@ bool BufferStateLayer::setBuffer(const sp<GraphicBuffer>& buffer, const sp<Fence
    mCurrentState.desiredPresentTime = desiredPresentTime;
    mCurrentState.isAutoTimestamp = isAutoTimestamp;

    mFlinger->mScheduler->recordLayerHistory(this, isAutoTimestamp ? 0 : desiredPresentTime,
    const nsecs_t presentTime = [&] {
        if (!isAutoTimestamp) return desiredPresentTime;

        const auto prediction =
                mFlinger->mFrameTimeline->getTokenManager()->getPredictionsForToken(info.vsyncId);
        if (prediction.has_value()) return prediction->presentTime;

        return static_cast<nsecs_t>(0);
    }();
    mFlinger->mScheduler->recordLayerHistory(this, presentTime,
                                             LayerHistory::LayerUpdateType::Buffer);

    addFrameEvent(acquireFence, postTime, isAutoTimestamp ? 0 : desiredPresentTime);