summaryrefslogtreecommitdiff
path: root/libs/gui/BLASTBufferQueue.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2021-05-18 13:57:02 -0700
committer Ady Abraham <adyabr@google.com> 2021-06-17 14:31:02 -0700
commit0bde6b5a9837ab96484c988bb3f148d0b9b3ab4e (patch)
tree6d3bf4cefcd3e2051eed6e126f4cac569703404a /libs/gui/BLASTBufferQueue.cpp
parent603a15d295579ea583fbad2cb9c15cf41dd598dc (diff)
SF: increase the number of buffers for SurfaceView
3 buffers are not sufficient for most apps to render at high refresh rates. This change increases the maxAcquiredBufferCount on the buffer queue for all surfaces, and removes the hwui-specific extra buffer allocations. All Surfaces connected to SurfaceFlinger will have now enough buffers to account for configured 'debug.sf.late.app.duration' value. Test: Run backpressure based game on 60Hz and 120Hz and collect traces Bug: 188553729 Change-Id: Ib8fda5db3f48c3bfc6fbf07167b4313674512cee
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
-rw-r--r--libs/gui/BLASTBufferQueue.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index b9a293f4c3..8024482531 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -29,9 +29,10 @@
#include <gui/IProducerListener.h>
#include <gui/Surface.h>
#include <utils/Singleton.h>
-
#include <utils/Trace.h>
+#include <private/gui/ComposerService.h>
+
#include <chrono>
using namespace std::chrono_literals;
@@ -158,6 +159,11 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceCont
mBufferItemConsumer->setDefaultBufferFormat(convertBufferFormat(format));
mBufferItemConsumer->setBlastBufferQueue(this);
+ int extraBufferCount = 0;
+ ComposerService::getComposerService()->getExtraBufferCount(&extraBufferCount);
+ mMaxAcquiredBuffers = 1 + extraBufferCount;
+ mBufferItemConsumer->setMaxAcquiredBufferCount(mMaxAcquiredBuffers);
+
mTransformHint = mSurfaceControl->getTransformHint();
mBufferItemConsumer->setTransformHint(mTransformHint);
SurfaceComposerClient::Transaction()
@@ -567,7 +573,7 @@ void BLASTBufferQueue::setTransactionCompleteCallback(
// includeExtraAcquire is true to include this buffer to the count. Since this depends on the state
// of the buffer, the next acquire may return with NO_BUFFER_AVAILABLE.
bool BLASTBufferQueue::maxBuffersAcquired(bool includeExtraAcquire) const {
- int maxAcquiredBuffers = MAX_ACQUIRED_BUFFERS + (includeExtraAcquire ? 2 : 1);
+ int maxAcquiredBuffers = mMaxAcquiredBuffers + (includeExtraAcquire ? 2 : 1);
return mNumAcquired == maxAcquiredBuffers;
}