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

Commit f24ce7c7 authored by liuzhifu's avatar liuzhifu Committed by Ying Wei
Browse files

FrameTimeline: Optimize tracing information about frame start time



If the prediction state is expired but the actual start time is
available, prioritize the actual start time as the reference for the
actual timeline instead of using the actual end time.

Flag: EXEMPT. bug fix from external contributor

Signed-off-by: default avatarliuzhifu <liuzhifu@xiaomi.com>
(cherry picked from https://android-review.googlesource.com/q/commit:13eb5161b25da09feabfb9c4c89e6804da92056b)
Merged-In: I1646a159ab74b3d7918067e24c6e827bf6ae5b4e
Change-Id: I1646a159ab74b3d7918067e24c6e827bf6ae5b4e
parent a83d862d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -801,6 +801,9 @@ void SurfaceFrame::traceActuals(int64_t displayFrameToken, nsecs_t monoBootOffse
    FrameTimelineDataSource::Trace([&](FrameTimelineDataSource::TraceContext ctx) {
        const auto timestamp = [&]() {
            std::scoped_lock lock(mMutex);
            if (mActuals.startTime != 0) {
                return mActuals.startTime;
            }
            // Actual start time is not yet available, so use expected start instead
            if (mPredictionState == PredictionState::Expired) {
                // If prediction is expired, we can't use the predicted start time. Instead, just
@@ -811,7 +814,7 @@ void SurfaceFrame::traceActuals(int64_t displayFrameToken, nsecs_t monoBootOffse
                return endTime - kPredictionExpiredStartTimeDelta;
            }

            return mActuals.startTime == 0 ? mPredictions.startTime : mActuals.startTime;
            return mPredictions.startTime;
        }();

        if (filterFramesBeforeTraceStarts && !shouldTraceForDataSource(ctx, timestamp)) {