diff options
| author | 2018-11-27 18:31:16 +0000 | |
|---|---|---|
| committer | 2018-11-27 18:31:16 +0000 | |
| commit | b49bb9150a4abc1561ea6b13b79a6ea86d6e81f2 (patch) | |
| tree | f843d385b9cda2c7e9fcd19724f62aa383a376dd | |
| parent | f2f18f7b8aef326a92fdad2caf534988100168be (diff) | |
| parent | dcec0bca4da5ab98384bb6e0b40757cf688583eb (diff) | |
Merge "SF: Clear mCompositionInfo before recomputing visible layers"
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index ae0a9578e9..af7334615b 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -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"); |