diff options
author | 2025-02-05 11:11:50 -0800 | |
---|---|---|
committer | 2025-02-05 11:11:50 -0800 | |
commit | ad9d51479938dba2b99df5fbd069dde9ee53bf49 (patch) | |
tree | daec36cec518e18982059913c96ec7ee3fc93f2f /services/surfaceflinger/SurfaceFlinger.cpp | |
parent | 01e3f8a348b379917f331d9b8ad2611e13b42928 (diff) |
Demarcate cached sets in composition summary
Previously, the composition summary indicated that HWC was compositing
more layers than it actually was.
Example when youtube video open and playing in a free form window
Before: bbrrrRrbbb
After: [b:brr]r[R:rbbb]
So there are 2 cached sets and 1 uncached set. One cached set and one uncached layer is composited by HWC, the other cached set is composed by the GPU.
Bug: 391428079
Flag: EXEMPT log only update
Test: Capture perfetto trace and confirm layers are skipped and overridden as expected
Change-Id: I4ffda43f5248ef8bb690cdaca0eeca7ffac3d997
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index eecdd72727..f24e441a54 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2980,6 +2980,8 @@ CompositeResultsPerDisplay SurfaceFlinger::composite( int index = 0; ftl::StaticVector<char, WorkloadTracer::COMPOSITION_SUMMARY_SIZE> compositionSummary; auto lastLayerStack = ui::INVALID_LAYER_STACK; + + uint64_t prevOverrideBufferId = 0; for (auto& [layer, layerFE] : layers) { CompositionResult compositionResult{layerFE->stealCompositionResult()}; if (lastLayerStack != layerFE->mSnapshot->outputFilter.layerStack) { @@ -2989,8 +2991,37 @@ CompositeResultsPerDisplay SurfaceFlinger::composite( } lastLayerStack = layerFE->mSnapshot->outputFilter.layerStack; } + + // If there are N layers in a cached set they should all share the same buffer id. + // The first layer in the cached set will be not skipped and layers 1..N-1 will be skipped. + // We expect all layers in the cached set to be marked as composited by HWC. + // Here is a made up example of how it is visualized + // + // [b:rrc][s:cc] + // + // This should be interpreted to mean that there are 2 cached sets. + // So there are only 2 non skipped layers -- b and s. + // The layers rrc and cc are flattened into layers b and s respectively. + const LayerFE::HwcLayerDebugState &hwcState = layerFE->getLastHwcState(); + if (hwcState.overrideBufferId != prevOverrideBufferId) { + // End the existing run. + if (prevOverrideBufferId) { + compositionSummary.push_back(']'); + } + // Start a new run. + if (hwcState.overrideBufferId) { + compositionSummary.push_back('['); + } + } + compositionSummary.push_back( - layerFE->mSnapshot->classifyCompositionForDebug(layerFE->getHwcCompositionType())); + layerFE->mSnapshot->classifyCompositionForDebug(hwcState)); + + if (hwcState.overrideBufferId && !hwcState.wasSkipped) { + compositionSummary.push_back(':'); + } + prevOverrideBufferId = hwcState.overrideBufferId; + if (layerFE->mSnapshot->hasEffect()) { compositedWorkload |= adpf::Workload::EFFECTS; } @@ -3002,6 +3033,10 @@ CompositeResultsPerDisplay SurfaceFlinger::composite( mActivePictureTracker.onLayerComposed(*layer, *layerFE, compositionResult); } } + // End the last run. + if (prevOverrideBufferId) { + compositionSummary.push_back(']'); + } // Concisely describe the layers composited this frame using single chars. GPU composited layers // are uppercase, DPU composited are lowercase. Special chars denote effects (blur, shadow, |