Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a70e91c9 authored by Robert Carr's avatar Robert Carr
Browse files

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
parent b552ff5e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -772,6 +772,8 @@ bool Layer::setLayer(int32_t z) {
    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 @@ bool Layer::setRelativeLayer(const sp<IBinder>& relativeToHandle, int32_t relati
        return false;
    }

    mFlinger->mSomeChildrenChanged = true;

    mDrawingState.sequence++;
    mDrawingState.modified = true;
    mDrawingState.z = relativeZ;
+5 −2
Original line number Diff line number Diff line
@@ -3224,9 +3224,12 @@ void SurfaceFlinger::commitTransactionLocked() {
    // clear the "changed" flags in current state
    mCurrentState.colorMatrixChanged = false;

    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) {