From ba4320c070e62f3ef7aea27c04684f5b53c5707d Mon Sep 17 00:00:00 2001 From: chaviw Date: Wed, 15 Sep 2021 15:20:53 -0500 Subject: Combine Buffer Properties when calling setBuffer There are several properties, like releaseCallback, acquireFence, frameNumber, that are tied to the buffer being set. If a new buffer is set, all those properties should also be overwritten, rather than through a separate call. 1. Remove Transaction.setAcquireFence and Transaction.setFrameNumber and added them to the setBuffer as optional 2. Combine all the buffer info into a struct called BufferData that's sent to SF as one. This will also help with merging or overwriting buffer data since the callback, frameNumber, and acquireFence should also be updated. 3. Combine the functions in SF so there's no longer a separate call to BSL to set fence. Instead, send all buffer related data to BSL.setBuffer Test: SurfaceFlinger_test Fixes: 200065015 Change-Id: I53ad12dd105cd4cac6c3a7ecd48279d1b3cd2b8f --- libs/gui/BLASTBufferQueue.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libs/gui/BLASTBufferQueue.cpp') diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 379b090c5b..cc209f39f5 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -468,12 +468,12 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { std::bind(releaseBufferCallbackThunk, wp(this) /* callbackContext */, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4); - t->setBuffer(mSurfaceControl, buffer, releaseCallbackId, releaseBufferCallback); + sp fence = bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE; + t->setBuffer(mSurfaceControl, buffer, fence, bufferItem.mFrameNumber, releaseCallbackId, + releaseBufferCallback); t->setDataspace(mSurfaceControl, static_cast(bufferItem.mDataSpace)); t->setHdrMetadata(mSurfaceControl, bufferItem.mHdrMetadata); t->setSurfaceDamageRegion(mSurfaceControl, bufferItem.mSurfaceDamage); - t->setAcquireFence(mSurfaceControl, - bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE); t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast(this)); mSurfaceControlsWithPendingCallback.push(mSurfaceControl); @@ -486,7 +486,6 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { if (!bufferItem.mIsAutoTimestamp) { t->setDesiredPresentTime(bufferItem.mTimestamp); } - t->setFrameNumber(mSurfaceControl, bufferItem.mFrameNumber); if (!mNextFrameTimelineInfoQueue.empty()) { t->setFrameTimelineInfo(mNextFrameTimelineInfoQueue.front()); -- cgit v1.2.3-59-g8ed1b