summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2021-06-24 13:08:53 -0700
committer Vishnu Nair <vishnun@google.com> 2021-06-24 13:09:54 -0700
commit2a52ca6274f3ca8b9aea8d22c49ca8fcae4b8455 (patch)
tree1e9ee0f1e9999e41cd804f8f8a025b11acfc0a61
parent504a4d8f648b6c2e0ed6971c9666a69dbdeedb45 (diff)
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
-rw-r--r--libs/gui/BLASTBufferQueue.cpp14
-rw-r--r--libs/gui/include/gui/BLASTBufferQueue.h6
2 files changed, 12 insertions, 8 deletions
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 sp<SurfaceCont
1, false);
static int32_t id = 0;
auto consumerName = mName + "(BLAST Consumer)" + std::to_string(id);
- mPendingBufferTrace = "PendingBuffer - " + mName + "BLAST#" + std::to_string(id);
+ mQueuedBufferTrace = "QueuedBuffer - " + mName + "BLAST#" + std::to_string(id);
id++;
mBufferItemConsumer->setName(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));
diff --git a/libs/gui/include/gui/BLASTBufferQueue.h b/libs/gui/include/gui/BLASTBufferQueue.h
index cb0e65e409..26c7285ab0 100644
--- a/libs/gui/include/gui/BLASTBufferQueue.h
+++ b/libs/gui/include/gui/BLASTBufferQueue.h
@@ -125,7 +125,11 @@ private:
static PixelFormat convertBufferFormat(PixelFormat& format);
std::string mName;
- std::string mPendingBufferTrace;
+ // Represents the queued buffer count from buffer queue,
+ // pre-BLAST. This is mNumFrameAvailable (buffers that queued to blast) +
+ // mNumAcquired (buffers that queued to SF) mPendingRelease.size() (buffers that are held by
+ // blast). This counter is read by android studio profiler.
+ std::string mQueuedBufferTrace;
sp<SurfaceControl> mSurfaceControl;
std::mutex mMutex;