Loading services/surfaceflinger/CompositionEngine/src/Output.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -1147,6 +1147,15 @@ void Output::prepareFrame() { std::optional<android::HWComposer::DeviceRequestedChanges> changes; bool success = chooseCompositionStrategy(&changes); if (success && changes.has_value()) { for (const compositionengine::OutputLayer* layer : getOutputLayersOrderedByZ()) { HWC2::Layer* hwcLayer = layer->getHwcLayer(); if (!hwcLayer || changes->changedTypes.contains(hwcLayer)) continue; changes->changedTypes[hwcLayer] = layer->getState().hwc->hwcCompositionType; } } resetCompositionStrategy(); outputState.strategyPrediction = CompositionStrategyPredictionState::DISABLED; outputState.previousDeviceRequestedChanges = changes; Loading Loading @@ -1178,6 +1187,14 @@ GpuCompositionResult Output::prepareFrameAsync() { const auto& previousChanges = state.previousDeviceRequestedChanges; std::optional<android::HWComposer::DeviceRequestedChanges> changes; resetCompositionStrategy(); // Store all layer composition types before appplying composition strategy android::HWComposer::DeviceRequestedChanges::ChangedTypes backups; for (const compositionengine::OutputLayer* layer : getOutputLayersOrderedByZ()) { HWC2::Layer* hwcLayer = layer->getHwcLayer(); if (!hwcLayer) continue; backups[hwcLayer] = layer->getState().hwc->hwcCompositionType; } auto hwcResult = chooseCompositionStrategyAsync(&changes); if (state.previousDeviceRequestedSuccess) { applyCompositionStrategy(previousChanges); Loading @@ -1198,6 +1215,14 @@ GpuCompositionResult Output::prepareFrameAsync() { } auto chooseCompositionSuccess = hwcResult.get(); if (chooseCompositionSuccess && changes.has_value()) { // Keep track of all layer composition types, not just changes for (const compositionengine::OutputLayer* layer : getOutputLayersOrderedByZ()) { HWC2::Layer* hwcLayer = layer->getHwcLayer(); if (!hwcLayer || changes->changedTypes.contains(hwcLayer)) continue; changes->changedTypes[hwcLayer] = backups[hwcLayer]; } } const bool predictionSucceeded = dequeueSucceeded && changes == previousChanges; state.strategyPrediction = predictionSucceeded ? CompositionStrategyPredictionState::SUCCESS : CompositionStrategyPredictionState::FAIL; Loading services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -970,6 +970,11 @@ void OutputLayer::applyDeviceCompositionTypeChange(Composition compositionType) LOG_FATAL_IF(!state.hwc); auto& hwcState = *state.hwc; if (hwcState.hwcCompositionType == compositionType) { // no changes return; } // Only detected disallowed changes if this was not a skip layer, because the // validated composition type may be arbitrary (usually DEVICE, to reflect that there were // fewer GPU layers) Loading Loading
services/surfaceflinger/CompositionEngine/src/Output.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -1147,6 +1147,15 @@ void Output::prepareFrame() { std::optional<android::HWComposer::DeviceRequestedChanges> changes; bool success = chooseCompositionStrategy(&changes); if (success && changes.has_value()) { for (const compositionengine::OutputLayer* layer : getOutputLayersOrderedByZ()) { HWC2::Layer* hwcLayer = layer->getHwcLayer(); if (!hwcLayer || changes->changedTypes.contains(hwcLayer)) continue; changes->changedTypes[hwcLayer] = layer->getState().hwc->hwcCompositionType; } } resetCompositionStrategy(); outputState.strategyPrediction = CompositionStrategyPredictionState::DISABLED; outputState.previousDeviceRequestedChanges = changes; Loading Loading @@ -1178,6 +1187,14 @@ GpuCompositionResult Output::prepareFrameAsync() { const auto& previousChanges = state.previousDeviceRequestedChanges; std::optional<android::HWComposer::DeviceRequestedChanges> changes; resetCompositionStrategy(); // Store all layer composition types before appplying composition strategy android::HWComposer::DeviceRequestedChanges::ChangedTypes backups; for (const compositionengine::OutputLayer* layer : getOutputLayersOrderedByZ()) { HWC2::Layer* hwcLayer = layer->getHwcLayer(); if (!hwcLayer) continue; backups[hwcLayer] = layer->getState().hwc->hwcCompositionType; } auto hwcResult = chooseCompositionStrategyAsync(&changes); if (state.previousDeviceRequestedSuccess) { applyCompositionStrategy(previousChanges); Loading @@ -1198,6 +1215,14 @@ GpuCompositionResult Output::prepareFrameAsync() { } auto chooseCompositionSuccess = hwcResult.get(); if (chooseCompositionSuccess && changes.has_value()) { // Keep track of all layer composition types, not just changes for (const compositionengine::OutputLayer* layer : getOutputLayersOrderedByZ()) { HWC2::Layer* hwcLayer = layer->getHwcLayer(); if (!hwcLayer || changes->changedTypes.contains(hwcLayer)) continue; changes->changedTypes[hwcLayer] = backups[hwcLayer]; } } const bool predictionSucceeded = dequeueSucceeded && changes == previousChanges; state.strategyPrediction = predictionSucceeded ? CompositionStrategyPredictionState::SUCCESS : CompositionStrategyPredictionState::FAIL; Loading
services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -970,6 +970,11 @@ void OutputLayer::applyDeviceCompositionTypeChange(Composition compositionType) LOG_FATAL_IF(!state.hwc); auto& hwcState = *state.hwc; if (hwcState.hwcCompositionType == compositionType) { // no changes return; } // Only detected disallowed changes if this was not a skip layer, because the // validated composition type may be arbitrary (usually DEVICE, to reflect that there were // fewer GPU layers) Loading