summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChavi Weingarten <chaviw@google.com>2021-11-23 19:13:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-11-23 19:13:58 +0000
commit3316c9775acab304c5f790b6fa48a576563b7bcc (patch)
treeab177ec1761fe7c84982dc885e5d55f71fca2d05
parent11595687cb64ef66b390deaf9aca9f891423afd5 (diff)
parent9d12adc77270be3215e3cd2b89b1b787493a11f6 (diff)
downloadnative-3316c9775acab304c5f790b6fa48a576563b7bcc.tar.gz
Merge "Only add commit callback when using sync transaction" into sc-v2-dev
-rw-r--r--libs/gui/BLASTBufferQueue.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index 39dd5d9552..085a11a88e 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -529,7 +529,6 @@ void BLASTBufferQueue::acquireNextBufferLocked(
// Ensure BLASTBufferQueue stays alive until we receive the transaction complete callback.
incStrong((void*)transactionCallbackThunk);
- incStrong((void*)transactionCommittedCallbackThunk);
const bool sizeHasChanged = mRequestedSize != mSize;
mSize = mRequestedSize;
@@ -550,7 +549,7 @@ void BLASTBufferQueue::acquireNextBufferLocked(
t->setAcquireFence(mSurfaceControl,
bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE);
t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this));
- t->addTransactionCommittedCallback(transactionCommittedCallbackThunk, static_cast<void*>(this));
+
mSurfaceControlsWithPendingCallback.push(mSurfaceControl);
if (updateDestinationFrame) {
@@ -673,6 +672,13 @@ void BLASTBufferQueue::onFrameAvailable(const BufferItem& item) {
if (nextTransactionSet) {
acquireNextBufferLocked(std::move(mNextTransaction));
+
+ // Only need a commit callback when syncing to ensure the buffer that's synced has been sent
+ // to SF
+ incStrong((void*)transactionCommittedCallbackThunk);
+ mNextTransaction->addTransactionCommittedCallback(transactionCommittedCallbackThunk,
+ static_cast<void*>(this));
+
mNextTransaction = nullptr;
mWaitForTransactionCallback = true;
} else if (!mWaitForTransactionCallback) {