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/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 1b07663..bb1d3fc 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -772,6 +772,8 @@
     mDrawingState.z = z;
     mDrawingState.modified = true;
 
+    mFlinger->mSomeChildrenChanged = true;
+
     // Discard all relative layering.
     if (mDrawingState.zOrderRelativeOf != nullptr) {
         sp<Layer> strongRelative = mDrawingState.zOrderRelativeOf.promote();
@@ -822,6 +824,8 @@
         return false;
     }
 
+    mFlinger->mSomeChildrenChanged = true;
+
     mDrawingState.sequence++;
     mDrawingState.modified = true;
     mDrawingState.z = relativeZ;