From 71fcf918ac5b8b3f870451e547aca25982d7cfe8 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Tue, 18 Oct 2022 09:14:20 -0700 Subject: SF: Avoid updating clients with stale or incorrect transform hints When the layer is removed from a display or the display the layer is on is turned off, the client will continue to receive transform hint updates via the transaction complete callback using the default/active displays install orientation. Once the layer is back on the display and it does not submit a new frame, a buffer with a suboptimal transform may remain on display. Fix this by not reporting stale/incorrect values via the callback. Once the layer is reparent back to the display and the display state is not OFF, it will continue to get hints via the callback. For special cases where we want the app to draw its first frame before the display is available, we rely on WMS and DMS to provide the right information so the client can calculate the hint. Bug: 251360251 Test: move app between displays, rotate, check final buffer transforms Change-Id: I0a9abac7e9cf4ade1c49ec400e73b634c8269b4b --- libs/gui/BLASTBufferQueue.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libs/gui/BLASTBufferQueue.cpp') diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 8b9a878598..7fcb8e8b50 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -334,9 +334,11 @@ void BLASTBufferQueue::transactionCallback(nsecs_t /*latchTime*/, const sp statsOptional = findMatchingStat(stats, pendingSC); if (statsOptional) { SurfaceControlStats stat = *statsOptional; - mTransformHint = stat.transformHint; - mBufferItemConsumer->setTransformHint(mTransformHint); - BQA_LOGV("updated mTransformHint=%d", mTransformHint); + if (stat.transformHint) { + mTransformHint = *stat.transformHint; + mBufferItemConsumer->setTransformHint(mTransformHint); + BQA_LOGV("updated mTransformHint=%d", mTransformHint); + } // Update frametime stamps if the frame was latched and presented, indicated by a // valid latch time. if (stat.latchTime > 0) { -- cgit v1.2.3-59-g8ed1b