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

Commit b49bb915 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: Clear mCompositionInfo before recomputing visible layers"

parents f2f18f7b dcec0bca
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -1679,8 +1679,6 @@ void SurfaceFlinger::calculateWorkingSet() {
    mDrawingState.colorMatrixChanged = false;

    for (const auto& [token, display] : mDisplays) {
        getBE().mCompositionInfo[token].clear();

        for (auto& layer : display->getVisibleLayersSortedByZ()) {
            const auto displayId = display->getId();
            layer->getBE().compositionInfo.compositionType = layer->getCompositionType(displayId);
@@ -1964,6 +1962,17 @@ void SurfaceFlinger::rebuildLayerStacks() {
    ATRACE_CALL();
    ALOGV("rebuildLayerStacks");

    // We need to clear these out now as these may be holding on to a
    // HWC2::Layer reference at the same time as the LayerBE::HWCInfo structure
    // also holds a reference. When the set of visible layers is recomputed,
    // some layers may be destroyed if the only thing keeping them alive was
    // that list of visible layers associated with each display. The layer
    // destruction code asserts that the HWC2::Layer is properly destroyed, but
    // that doesn't happen if SurfaceFlingerBE::mCompositionInfo keeps it alive.
    for (const auto& [token, display] : mDisplays) {
        getBE().mCompositionInfo[token].clear();
    }

    // rebuild the visible layer list per screen
    if (CC_UNLIKELY(mVisibleRegionsDirty)) {
        ATRACE_NAME("rebuildLayerStacks VR Dirty");