diff options
author | Vishnu Nair <vishnun@google.com> | 2021-06-18 13:19:49 -0700 |
---|---|---|
committer | Vishnu Nair <vishnun@google.com> | 2021-06-18 21:06:36 +0000 |
commit | 9a69a04e3dc0765a8c97cd837873be99234360ce (patch) | |
tree | abc6e9e389f40918f74045a7620ee6a0e98fa454 /libs/gui | |
parent | a785b9a9c362954c3d136cba1f30ff4bd9edf49c (diff) | |
download | native-9a69a04e3dc0765a8c97cd837873be99234360ce.tar.gz |
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
Diffstat (limited to 'libs/gui')
-rw-r--r-- | libs/gui/include/gui/FrameTimestamps.h | 1 | ||||
-rw-r--r-- | libs/gui/tests/BLASTBufferQueue_test.cpp | 27 |
2 files changed, 28 insertions, 0 deletions
diff --git a/libs/gui/include/gui/FrameTimestamps.h b/libs/gui/include/gui/FrameTimestamps.h index 0750080e1c..dd3de58844 100644 --- a/libs/gui/include/gui/FrameTimestamps.h +++ b/libs/gui/include/gui/FrameTimestamps.h @@ -131,6 +131,7 @@ public: // Public for testing. static nsecs_t snapToNextTick( nsecs_t timestamp, nsecs_t tickPhase, nsecs_t tickInterval); + nsecs_t getReportedCompositeDeadline() const { return mCompositorTiming.deadline; }; nsecs_t getNextCompositeDeadline(const nsecs_t now) const; nsecs_t getCompositeInterval() const { return mCompositorTiming.interval; } diff --git a/libs/gui/tests/BLASTBufferQueue_test.cpp b/libs/gui/tests/BLASTBufferQueue_test.cpp index 06660b8b50..7ed4023b3a 100644 --- a/libs/gui/tests/BLASTBufferQueue_test.cpp +++ b/libs/gui/tests/BLASTBufferQueue_test.cpp @@ -1075,4 +1075,31 @@ TEST_F(BLASTFrameEventHistoryTest, FrameEventHistory_DroppedFrame) { 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 |