From 7eb670ae5357ea9f609e1630759a57ea31537271 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 15 Oct 2020 12:16:10 -0700 Subject: BlastBufferQueue: Add a function to flush the shadow queue If the function is called, the next queue buffer will wait until the the adapter processes the previously queued buffers. Test: enable blast and test split screen resize Change-Id: Ica9b3be9459dd174a7e80311abddb691976e83e3 --- libs/gui/BLASTBufferQueue.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libs/gui/BLASTBufferQueue.cpp') diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 87f797200c..c3f045e868 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -254,8 +254,8 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { if (rejectBuffer(bufferItem)) { BQA_LOGE("rejecting buffer:configured size=%dx%d, buffer{size=%dx%d transform=%d}", mWidth, mHeight, buffer->getWidth(), buffer->getHeight(), bufferItem.mTransform); - mBufferItemConsumer->releaseBuffer(bufferItem, Fence::NO_FENCE); - return; + // TODO(b/168917217) temporarily don't reject buffers until we can synchronize buffer size + // changes from ViewRootImpl. } mNumAcquired++; @@ -307,13 +307,16 @@ void BLASTBufferQueue::onFrameAvailable(const BufferItem& /*item*/) { std::unique_lock _lock{mMutex}; const bool nextTransactionSet = mNextTransaction != nullptr; - BQA_LOGV("onFrameAvailable nextTransactionSet=%s", toString(nextTransactionSet)); + BQA_LOGV("onFrameAvailable nextTransactionSet=%s mFlushShadowQueue=%s", + toString(nextTransactionSet), toString(mFlushShadowQueue)); - if (nextTransactionSet) { + if (nextTransactionSet || mFlushShadowQueue) { while (mNumFrameAvailable > 0 || mNumAcquired == MAX_ACQUIRED_BUFFERS + 1) { + BQA_LOGV("waiting in onFrameAvailable..."); mCallbackCV.wait(_lock); } } + mFlushShadowQueue = false; // add to shadow queue mNumFrameAvailable++; processNextBufferLocked(true); -- cgit v1.2.3-59-g8ed1b