Protect committing child list behind visible regions changed
This can be further optimized but as a first pass checking for
visible regions will improve the buffer update path. In Layer.cpp,
we need to be sure updating Z-order sets the mVisibleRegionsChanged
flag directly rather than relying on doTransaction (as this now occurs
too late after being coalesced in to handlePageFlip).
Test: Existing tests pass. simpleperf
Bug: 186200583
Change-Id: I24be38594f13e774d20a2a32ad12676a4e3c3052
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 467446e..d460567 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3224,9 +3224,12 @@
// clear the "changed" flags in current state
mCurrentState.colorMatrixChanged = false;
- for (const auto& rootLayer : mDrawingState.layersSortedByZ) {
- rootLayer->commitChildList();
+ if (mVisibleRegionsDirty) {
+ for (const auto& rootLayer : mDrawingState.layersSortedByZ) {
+ rootLayer->commitChildList();
+ }
}
+
// TODO(b/163019109): See if this traversal is needed at all...
if (!mOffscreenLayers.empty()) {
mDrawingState.traverse([&](Layer* layer) {