Fix vsyncId for long frames and double stuffed
Since the vsyncId was applied immediately, and since we are doing
client-side queing in case we are double stuffed, there was a
scenario when setFrameTimelineVsyncId was applied too early
meaning that the previous frame was tagged with the id from the
next frame.
To fix that, we set the pending vsync id and then apply it
together with the buffer.
Test: Expand quick settings, ensure no missing jank data for
shared timeline jank classification
Change-Id: Id54133b84e5305d7f1f21dbfd9f0889ef3e464c9
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index e6aa02a..3a3a96f 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -289,6 +289,11 @@
t->setDesiredPresentTime(bufferItem.mTimestamp);
t->setFrameNumber(mSurfaceControl, bufferItem.mFrameNumber);
+ if (!mNextFrameTimelineVsyncIdQueue.empty()) {
+ t->setFrameTimelineVsync(mSurfaceControl, mNextFrameTimelineVsyncIdQueue.front());
+ mNextFrameTimelineVsyncIdQueue.pop();
+ }
+
if (mAutoRefresh != bufferItem.mAutoRefresh) {
t->setAutoRefresh(mSurfaceControl, bufferItem.mAutoRefresh);
mAutoRefresh = bufferItem.mAutoRefresh;
@@ -417,10 +422,8 @@
status_t BLASTBufferQueue::setFrameTimelineVsync(int64_t frameTimelineVsyncId) {
std::unique_lock _lock{mMutex};
- SurfaceComposerClient::Transaction t;
-
- return t.setFrameTimelineVsync(mSurfaceControl, frameTimelineVsyncId)
- .apply();
+ mNextFrameTimelineVsyncIdQueue.push(frameTimelineVsyncId);
+ return OK;
}
sp<Surface> BLASTBufferQueue::getSurface(bool includeSurfaceControlHandle) {