Skip to content

Commit f24ce7c

Browse files
liuzhifuYing Wei
authored andcommitted
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: liuzhifu <[email protected]> (cherry picked from https://android-review.googlesource.com/q/commit:13eb5161b25da09feabfb9c4c89e6804da92056b) Merged-In: I1646a159ab74b3d7918067e24c6e827bf6ae5b4e Change-Id: I1646a159ab74b3d7918067e24c6e827bf6ae5b4e
1 parent a83d862 commit f24ce7c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

services/surfaceflinger/FrameTimeline/FrameTimeline.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,9 @@ void SurfaceFrame::traceActuals(int64_t displayFrameToken, nsecs_t monoBootOffse
801801
FrameTimelineDataSource::Trace([&](FrameTimelineDataSource::TraceContext ctx) {
802802
const auto timestamp = [&]() {
803803
std::scoped_lock lock(mMutex);
804+
if (mActuals.startTime != 0) {
805+
return mActuals.startTime;
806+
}
804807
// Actual start time is not yet available, so use expected start instead
805808
if (mPredictionState == PredictionState::Expired) {
806809
// 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
811814
return endTime - kPredictionExpiredStartTimeDelta;
812815
}
813816

814-
return mActuals.startTime == 0 ? mPredictions.startTime : mActuals.startTime;
817+
return mPredictions.startTime;
815818
}();
816819

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

0 commit comments

Comments
 (0)