Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d12adc7 authored by chaviw's avatar chaviw Committed by Chavi Weingarten
Browse files

Only add commit callback when using sync transaction

There's no need to add a commit callback when we're not syncing since
the callback won't actually do anything. Instead only add a commit
callback when a sync transaction has been requested.

Test: BLASTBufferQueueTest
Bug: 205278630
Change-Id: Ib7345f2581b6e4ce8923531aebcd457c14d86027
Merged-In: Ib7345f2581b6e4ce8923531aebcd457c14d86027
parent 4b26b7fb
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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) {