diff options
author | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2023-04-20 00:08:54 +0800 |
commit | fb34b76e3f7a1b2bb8cafba9a485b4a5f57c4a2c (patch) | |
tree | 02c3f70afc88c4a9fd26d2a490e3ea4fbdfe7c1c /libs/gui/tests/BLASTBufferQueue_test.cpp | |
parent | cc8a3758be627207828a9c70353e84cb1525edbb (diff) | |
parent | f0037e2123deb6b62847c9e2fec53a8b00cf2a31 (diff) |
Merge tag 'LA.QSSI.13.0.r1-09800-qssi.0' into tachibana
"LA.QSSI.13.0.r1-09800-qssi.0"
Change-Id: I59609ccba4dd384f5a1d653de9f926614a220037
Diffstat (limited to 'libs/gui/tests/BLASTBufferQueue_test.cpp')
-rw-r--r-- | libs/gui/tests/BLASTBufferQueue_test.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/gui/tests/BLASTBufferQueue_test.cpp b/libs/gui/tests/BLASTBufferQueue_test.cpp index cb7e94c932..b993289e6a 100644 --- a/libs/gui/tests/BLASTBufferQueue_test.cpp +++ b/libs/gui/tests/BLASTBufferQueue_test.cpp @@ -161,6 +161,10 @@ public: ASSERT_EQ(numFramesSubmitted, mBlastBufferQueueAdapter->mSubmitted.size()); } + void mergeWithNextTransaction(Transaction* merge, uint64_t frameNumber) { + mBlastBufferQueueAdapter->mergeWithNextTransaction(merge, frameNumber); + } + private: sp<TestBLASTBufferQueue> mBlastBufferQueueAdapter; }; @@ -1111,6 +1115,39 @@ TEST_F(BLASTBufferQueueTest, SyncNextTransactionOverwrite) { ASSERT_TRUE(receivedCallback); } +TEST_F(BLASTBufferQueueTest, SyncNextTransactionDropBuffer) { + uint8_t r = 255; + uint8_t g = 0; + uint8_t b = 0; + + BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight); + + sp<IGraphicBufferProducer> igbProducer; + setUpProducer(adapter, igbProducer); + + Transaction sync; + adapter.setSyncTransaction(sync); + queueBuffer(igbProducer, 0, 255, 0, 0); + + // Merge a transaction that has a complete callback into the next frame so we can get notified + // when to take a screenshot + CallbackHelper transactionCallback; + Transaction t; + t.addTransactionCompletedCallback(transactionCallback.function, + transactionCallback.getContext()); + adapter.mergeWithNextTransaction(&t, 2); + queueBuffer(igbProducer, r, g, b, 0); + + // Drop the buffer, but ensure the next one continues to get processed. + sync.setBuffer(mSurfaceControl, nullptr); + + CallbackData callbackData; + transactionCallback.getCallbackData(&callbackData); + ASSERT_EQ(NO_ERROR, captureDisplay(mCaptureArgs, mCaptureResults)); + ASSERT_NO_FATAL_FAILURE( + checkScreenCapture(r, g, b, {0, 0, (int32_t)mDisplayWidth, (int32_t)mDisplayHeight})); +} + // This test will currently fail because the old surfacecontrol will steal the last presented buffer // until the old surface control is destroyed. This is not necessarily a bug but to document a // limitation with the update API and to test any changes to make the api more robust. The current |