diff options
| author | 2021-06-30 01:48:26 +0000 | |
|---|---|---|
| committer | 2021-06-30 01:48:26 +0000 | |
| commit | 3e27b3c6f5d0e82b34e6b9c41473b9814e1c31e1 (patch) | |
| tree | 784f2e54a9c05090c8cf52172e55affede9d207c /libs/gui/BLASTBufferQueue.cpp | |
| parent | 8bc8dc78a5ba088b4e034a6f4d3f16644ab3ecf1 (diff) | |
| parent | e89521f7c24f04045b2bbf6cb73857e17381ff9e (diff) | |
Merge "BBQ: Update the transform hint if the SC layer handle does not change" into sc-dev am: e89521f7c2
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15140323
Change-Id: I4542c8726f6727ff59d1cc0bf99d91f4c3723e01
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
| -rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 29701168e7..ac8feaa0c2 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -197,15 +197,18 @@ void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width, } SurfaceComposerClient::Transaction t; + const bool setBackpressureFlag = !SurfaceControl::isSameSurface(mSurfaceControl, surface); bool applyTransaction = false; - if (!SurfaceControl::isSameSurface(mSurfaceControl, surface)) { - mSurfaceControl = surface; - t.setFlags(mSurfaceControl, layer_state_t::eEnableBackpressure, - layer_state_t::eEnableBackpressure); - applyTransaction = true; - } + // Always update the native object even though they might have the same layer handle, so we can + // get the updated transform hint from WM. + mSurfaceControl = surface; if (mSurfaceControl != nullptr) { + if (setBackpressureFlag) { + t.setFlags(mSurfaceControl, layer_state_t::eEnableBackpressure, + layer_state_t::eEnableBackpressure); + applyTransaction = true; + } mTransformHint = mSurfaceControl->getTransformHint(); mBufferItemConsumer->setTransformHint(mTransformHint); } @@ -221,7 +224,7 @@ void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width, // We only need to update the scale if we've received at least one buffer. The reason // for this is the scale is calculated based on the requested size and buffer size. // If there's no buffer, the scale will always be 1. - if (mLastBufferInfo.hasBuffer) { + if (mSurfaceControl != nullptr && mLastBufferInfo.hasBuffer) { t.setDestinationFrame(mSurfaceControl, Rect(0, 0, newSize.getWidth(), newSize.getHeight())); } |