summaryrefslogtreecommitdiff
path: root/libs/gui/BLASTBufferQueue.cpp
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2021-06-29 14:30:48 -0700
committer Vishnu Nair <vishnun@google.com> 2021-06-29 14:33:59 -0700
commit5fa91c276a6f67a33effceee27ef91d2cd935002 (patch)
tree70bc84f2c752969624abd9d6d028093eed18d294 /libs/gui/BLASTBufferQueue.cpp
parente1c1b1c55dfc8ec89fd1dd4bb1325bd3428a03a1 (diff)
BBQ: Update the transform hint if the SC layer handle does not change
We are now passing the transform hint from WM to the client. In BBQ, we were not getting the updated transform hint in some cases because we did not update the SurfaceControl if the layer handle was the same. Fix this by always updating the SC object in BBQ. Test: rotate phone with messages app and check buffer transforms Fixes: 184842607 Change-Id: I83158f810a9820285c84ecfff294689f63ff3113
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
-rw-r--r--libs/gui/BLASTBufferQueue.cpp17
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()));
}