From 2a52ca6274f3ca8b9aea8d22c49ca8fcae4b8455 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Thu, 24 Jun 2021 13:08:53 -0700 Subject: BlastBufferQueue: Fix acquire counts when holding buffers Update the acquire count when ever we release a buffer otherwise when going from 120hz to 60hz we may release multiple buffers and only decrement the acquire count once. This will prevent the adapter from acquiring all the possible buffers. Also make sure we process the shadow queue every time we release a buffer. Bug: 188553729 Test: Run backpressure based game on 60Hz and 90hz and collect traces Change-Id: I23517ee0fe840a9215f368bd85713ba19dbeb2a3 --- libs/gui/BLASTBufferQueue.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libs/gui/BLASTBufferQueue.cpp') diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 364c939c18..e15e11cc20 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -151,7 +151,7 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const spsetName(String8(consumerName.c_str())); mBufferItemConsumer->setFrameAvailableListener(this); @@ -361,16 +361,15 @@ void BLASTBufferQueue::releaseBufferCallback(uint64_t graphicBufferId, graphicBufferId); return; } - + mNumAcquired--; mBufferItemConsumer->releaseBuffer(it->second, releaseBuffer.releaseFence); mSubmitted.erase(it); + processNextBufferLocked(false /* useNextTransaction */); } ATRACE_INT("PendingRelease", mPendingRelease.size()); - - mNumAcquired--; - ATRACE_INT(mPendingBufferTrace.c_str(), mNumFrameAvailable + mNumAcquired); - processNextBufferLocked(false /* useNextTransaction */); + ATRACE_INT(mQueuedBufferTrace.c_str(), + mNumFrameAvailable + mNumAcquired - mPendingRelease.size()); mCallbackCV.notify_all(); } @@ -538,7 +537,8 @@ void BLASTBufferQueue::onFrameAvailable(const BufferItem& item) { } // add to shadow queue mNumFrameAvailable++; - ATRACE_INT(mPendingBufferTrace.c_str(), mNumFrameAvailable + mNumAcquired); + ATRACE_INT(mQueuedBufferTrace.c_str(), + mNumFrameAvailable + mNumAcquired - mPendingRelease.size()); BQA_LOGV("onFrameAvailable framenumber=%" PRIu64 " nextTransactionSet=%s", item.mFrameNumber, toString(nextTransactionSet)); -- cgit v1.2.3-59-g8ed1b