Blast: Populate compositor timings
Compositor timings are populated in BufferLayer::onPostComposition
but the callback handles were cleared before in
BufferStateLayer::releasePendingBuffer. Fix the ordering and add a
test.
Test: atest BLASTFrameEventHistoryTest
Fixes: 191247797
Change-Id: I5f93ed7f80cdcb4c0c6763fa37bad5e77588a20a
diff --git a/libs/gui/tests/BLASTBufferQueue_test.cpp b/libs/gui/tests/BLASTBufferQueue_test.cpp
index 06660b8..7ed4023 100644
--- a/libs/gui/tests/BLASTBufferQueue_test.cpp
+++ b/libs/gui/tests/BLASTBufferQueue_test.cpp
@@ -1075,4 +1075,31 @@
ASSERT_GE(events->postedTime, postedTimeB);
}
+TEST_F(BLASTFrameEventHistoryTest, FrameEventHistory_CompositorTimings) {
+ BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight);
+ sp<IGraphicBufferProducer> igbProducer;
+ ProducerFrameEventHistory history;
+ setUpProducer(adapter, igbProducer);
+
+ IGraphicBufferProducer::QueueBufferOutput qbOutput;
+ nsecs_t requestedPresentTimeA = 0;
+ nsecs_t postedTimeA = 0;
+ adapter.setTransactionCompleteCallback(1);
+ setUpAndQueueBuffer(igbProducer, &requestedPresentTimeA, &postedTimeA, &qbOutput, true);
+ history.applyDelta(qbOutput.frameTimestamps);
+ adapter.waitForCallback(1);
+
+ // queue another buffer so we query for frame event deltas
+ nsecs_t requestedPresentTimeB = 0;
+ nsecs_t postedTimeB = 0;
+ setUpAndQueueBuffer(igbProducer, &requestedPresentTimeB, &postedTimeB, &qbOutput, true);
+ history.applyDelta(qbOutput.frameTimestamps);
+
+ // check for a valid compositor deadline
+ ASSERT_NE(0, history.getReportedCompositeDeadline());
+
+ // wait for any callbacks that have not been received
+ adapter.waitForCallbacks();
+}
+
} // namespace android