summaryrefslogtreecommitdiff
path: root/libs/gui/BLASTBufferQueue.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2021-01-29 17:52:52 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-01-29 17:52:52 +0000
commit31999efbac943af5c43c64a6929d5fe5857c6532 (patch)
tree596a67ae387127da902645f1029b1d298ba40b63 /libs/gui/BLASTBufferQueue.cpp
parentaebf2476c302a93fe177a8e9f1824c530d9f216b (diff)
parentf6eddb6b42a9548f1298e899ea06a7a042182783 (diff)
Merge "Enable backpressure for BufferStateLayer" into sc-dev
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
-rw-r--r--libs/gui/BLASTBufferQueue.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index f9b152cce5..42d2895950 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -146,6 +146,10 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceCont
mTransformHint = mSurfaceControl->getTransformHint();
mBufferItemConsumer->setTransformHint(mTransformHint);
+ SurfaceComposerClient::Transaction()
+ .setFlags(surface, layer_state_t::eEnableBackpressure,
+ layer_state_t::eEnableBackpressure)
+ .apply();
mNumAcquired = 0;
mNumFrameAvailable = 0;
@@ -169,13 +173,20 @@ BLASTBufferQueue::~BLASTBufferQueue() {
void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width, uint32_t height,
int32_t format) {
std::unique_lock _lock{mMutex};
- mSurfaceControl = surface;
-
if (mFormat != format) {
mFormat = format;
mBufferItemConsumer->setDefaultBufferFormat(format);
}
+ SurfaceComposerClient::Transaction t;
+ bool applyTransaction = false;
+ if (!SurfaceControl::isSameSurface(mSurfaceControl, surface)) {
+ mSurfaceControl = surface;
+ t.setFlags(mSurfaceControl, layer_state_t::eEnableBackpressure,
+ layer_state_t::eEnableBackpressure);
+ applyTransaction = true;
+ }
+
ui::Size newSize(width, height);
if (mRequestedSize != newSize) {
mRequestedSize.set(newSize);
@@ -184,13 +195,15 @@ void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width,
// If the buffer supports scaling, update the frame immediately since the client may
// want to scale the existing buffer to the new size.
mSize = mRequestedSize;
- SurfaceComposerClient::Transaction t;
t.setFrame(mSurfaceControl,
{0, 0, static_cast<int32_t>(mSize.width),
static_cast<int32_t>(mSize.height)});
- t.apply();
+ applyTransaction = true;
}
}
+ if (applyTransaction) {
+ t.apply();
+ }
}
static void transactionCallbackThunk(void* context, nsecs_t latchTime,