@@ -2977,6 +2977,8 @@ CompositeResultsPerDisplay SurfaceFlinger::composite(
29772977 int index = 0 ;
29782978 ftl::StaticVector<char , WorkloadTracer::COMPOSITION_SUMMARY_SIZE> compositionSummary;
29792979 auto lastLayerStack = ui::INVALID_LAYER_STACK;
2980+
2981+ uint64_t prevOverrideBufferId = 0 ;
29802982 for (auto & [layer, layerFE] : layers) {
29812983 CompositionResult compositionResult{layerFE->stealCompositionResult ()};
29822984 if (lastLayerStack != layerFE->mSnapshot ->outputFilter .layerStack ) {
@@ -2986,8 +2988,37 @@ CompositeResultsPerDisplay SurfaceFlinger::composite(
29862988 }
29872989 lastLayerStack = layerFE->mSnapshot ->outputFilter .layerStack ;
29882990 }
2991+
2992+ // If there are N layers in a cached set they should all share the same buffer id.
2993+ // The first layer in the cached set will be not skipped and layers 1..N-1 will be skipped.
2994+ // We expect all layers in the cached set to be marked as composited by HWC.
2995+ // Here is a made up example of how it is visualized
2996+ //
2997+ // [b:rrc][s:cc]
2998+ //
2999+ // This should be interpreted to mean that there are 2 cached sets.
3000+ // So there are only 2 non skipped layers -- b and s.
3001+ // The layers rrc and cc are flattened into layers b and s respectively.
3002+ const LayerFE::HwcLayerDebugState &hwcState = layerFE->getLastHwcState ();
3003+ if (hwcState.overrideBufferId != prevOverrideBufferId) {
3004+ // End the existing run.
3005+ if (prevOverrideBufferId) {
3006+ compositionSummary.push_back (' ]' );
3007+ }
3008+ // Start a new run.
3009+ if (hwcState.overrideBufferId ) {
3010+ compositionSummary.push_back (' [' );
3011+ }
3012+ }
3013+
29893014 compositionSummary.push_back (
2990- layerFE->mSnapshot ->classifyCompositionForDebug (layerFE->getHwcCompositionType ()));
3015+ layerFE->mSnapshot ->classifyCompositionForDebug (hwcState));
3016+
3017+ if (hwcState.overrideBufferId && !hwcState.wasSkipped ) {
3018+ compositionSummary.push_back (' :' );
3019+ }
3020+ prevOverrideBufferId = hwcState.overrideBufferId ;
3021+
29913022 if (layerFE->mSnapshot ->hasEffect ()) {
29923023 compositedWorkload |= adpf::Workload::EFFECTS;
29933024 }
@@ -2999,6 +3030,10 @@ CompositeResultsPerDisplay SurfaceFlinger::composite(
29993030 mActivePictureTracker .onLayerComposed (*layer, *layerFE, compositionResult);
30003031 }
30013032 }
3033+ // End the last run.
3034+ if (prevOverrideBufferId) {
3035+ compositionSummary.push_back (' ]' );
3036+ }
30023037
30033038 // Concisely describe the layers composited this frame using single chars. GPU composited layers
30043039 // are uppercase, DPU composited are lowercase. Special chars denote effects (blur, shadow,
0 commit comments