TimeStats: make sure acquire fence is captured
Previously, if setAcquireFence happens earlier than setPostTime, the
acquire fence is not recorded in TimeStats which ends up with acquire
time being the same with post time. This issue is almost eliminated
after a previous refactoring of the order of recording TimeStats and
EGL throttling logic.
Since acquire fence is already available at post time, this change just
captures that by then to avoid any chance of missing the acquire fence.
Bug: 140266250
Test: atest libsurfaceflinger_unittest:TimeStatsTest
Change-Id: I90a5ab609afc7054c618273c3af79c9d12d85730
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 5a19d8a..ce9aab5 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1370,6 +1370,8 @@
if (newTimestamps) {
mFlinger->mTimeStats->setPostTime(getSequence(), newTimestamps->frameNumber,
getName().c_str(), newTimestamps->postedTime);
+ mFlinger->mTimeStats->setAcquireFence(getSequence(), newTimestamps->frameNumber,
+ newTimestamps->acquireFence);
}
Mutex::Autolock lock(mFrameEventHistoryMutex);