SF: Clean up updateTransformHint() processing.
While working on ag/3368935, an unintentional duplicate call was added
to Layer::updateTransform() from
SurfaceFlinger::handleTransactionLocked(). This patch removes the
duplicate call.
In examining the code, the update conditions also did not appear to be
set correctly. They have been adjusted so that a display change or a
significant layer change (such as a layer being added) will result in an
update.
Bug: 76223411
Test: No immediate issues observed on a Pixel XL.
Change-Id: I59220837b22ae1f76d7d9d376c1ebd24d8d14105
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f2cbc89..7201f19 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2357,7 +2357,7 @@
processDisplayHotplugEventsLocked();
}
- if (transactionFlags & (eTraversalNeeded|eDisplayTransactionNeeded)) {
+ if (transactionFlags & (eDisplayLayerStackChanged|eDisplayTransactionNeeded)) {
// The transform hint might have changed for some layers
// (either because a display has changed, or because a layer
// as changed).
@@ -2404,18 +2404,18 @@
}
}
- if (transactionFlags & eDisplayTransactionNeeded) {
- if (disp == nullptr) {
- // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to
- // redraw after transform hint changes. See bug 8508397.
+ if (disp == nullptr) {
+ // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to
+ // redraw after transform hint changes. See bug 8508397.
- // could be null when this layer is using a layerStack
- // that is not visible on any display. Also can occur at
- // screen off/on times.
- disp = getDefaultDisplayDeviceLocked();
- }
- layer->updateTransformHint(disp);
+ // could be null when this layer is using a layerStack
+ // that is not visible on any display. Also can occur at
+ // screen off/on times.
+ disp = getDefaultDisplayDeviceLocked();
}
+
+ // disp can be null if there is no display available at all to get
+ // the transform hint from.
if (disp != nullptr) {
layer->updateTransformHint(disp);
}
@@ -3250,7 +3250,7 @@
mCurrentState.layersSortedByZ.add(layer);
// we need traversal (state changed)
// AND transaction (list changed)
- flags |= eTransactionNeeded|eTraversalNeeded;
+ flags |= eTransactionNeeded|eTraversalNeeded|eDisplayLayerStackChanged;
}
}
if (what & layer_state_t::eDeferTransaction) {