Loading services/surfaceflinger/CompositionEngine/include/compositionengine/CompositionRefreshArgs.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -97,6 +97,8 @@ struct CompositionRefreshArgs { std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; std::vector<BorderRenderInfo> borderInfoList; std::vector<BorderRenderInfo> borderInfoList; bool hasTrustedPresentationListener = false; }; }; } // namespace android::compositionengine } // namespace android::compositionengine services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -212,6 +212,8 @@ struct LayerFECompositionState { float currentSdrHdrRatio = 1.f; float currentSdrHdrRatio = 1.f; float desiredSdrHdrRatio = 1.f; float desiredSdrHdrRatio = 1.f; bool isInternalDisplayOverlay = false; virtual ~LayerFECompositionState(); virtual ~LayerFECompositionState(); // Debugging // Debugging Loading services/surfaceflinger/CompositionEngine/include/compositionengine/Output.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -153,6 +153,10 @@ public: Region aboveOpaqueLayers; Region aboveOpaqueLayers; // The region of the output which should be considered dirty // The region of the output which should be considered dirty Region dirtyRegion; Region dirtyRegion; // The region of the output which is covered by layers, excluding display overlays. This // only has a value if there's something needing it, like when a TrustedPresentationListener // is set std::optional<Region> aboveCoveredLayersExcludingOverlays; }; }; virtual ~Output(); virtual ~Output(); Loading services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h +7 −1 Original line number Original line Diff line number Diff line Loading @@ -63,9 +63,15 @@ struct OutputLayerCompositionState { // The portion of the layer that is not obscured and is also opaque // The portion of the layer that is not obscured and is also opaque Region visibleNonTransparentRegion; Region visibleNonTransparentRegion; // The portion of the layer that is obscured by opaque layers on top // The portion of the layer that is obscured by all layers on top. This includes transparent and // opaque. Region coveredRegion; Region coveredRegion; // The portion of the layer that is obscured by all layers on top excluding display overlays. // This only has a value if there's something needing it, like when a // TrustedPresentationListener is set. std::optional<Region> coveredRegionExcludingDisplayOverlays; // The visibleRegion transformed to output space // The visibleRegion transformed to output space Region outputSpaceVisibleRegion; Region outputSpaceVisibleRegion; Loading services/surfaceflinger/CompositionEngine/src/Output.cpp +22 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <ftl/future.h> #include <ftl/future.h> #include <gui/TraceUtils.h> #include <gui/TraceUtils.h> #include <optional> #include <thread> #include <thread> #include "renderengine/ExternalTexture.h" #include "renderengine/ExternalTexture.h" Loading Loading @@ -480,6 +481,9 @@ void Output::rebuildLayerStacks(const compositionengine::CompositionRefreshArgs& // Process the layers to determine visibility and coverage // Process the layers to determine visibility and coverage compositionengine::Output::CoverageState coverage{layerFESet}; compositionengine::Output::CoverageState coverage{layerFESet}; coverage.aboveCoveredLayersExcludingOverlays = refreshArgs.hasTrustedPresentationListener ? std::make_optional<Region>() : std::nullopt; collectVisibleLayers(refreshArgs, coverage); collectVisibleLayers(refreshArgs, coverage); // Compute the resulting coverage for this output, and store it for later // Compute the resulting coverage for this output, and store it for later Loading Loading @@ -534,6 +538,9 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, return; return; } } bool computeAboveCoveredExcludingOverlays = coverage.aboveCoveredLayersExcludingOverlays && !layerFEState->isInternalDisplayOverlay; /* /* * opaqueRegion: area of a surface that is fully opaque. * opaqueRegion: area of a surface that is fully opaque. */ */ Loading Loading @@ -575,6 +582,11 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, */ */ Region shadowRegion; Region shadowRegion; /** * covered region above excluding internal display overlay layers */ std::optional<Region> coveredRegionExcludingDisplayOverlays = std::nullopt; const ui::Transform& tr = layerFEState->geomLayerTransform; const ui::Transform& tr = layerFEState->geomLayerTransform; // Get the visible region // Get the visible region Loading Loading @@ -647,6 +659,12 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, // Update accumAboveCoveredLayers for next (lower) layer // Update accumAboveCoveredLayers for next (lower) layer coverage.aboveCoveredLayers.orSelf(visibleRegion); coverage.aboveCoveredLayers.orSelf(visibleRegion); if (CC_UNLIKELY(computeAboveCoveredExcludingOverlays)) { coveredRegionExcludingDisplayOverlays = coverage.aboveCoveredLayersExcludingOverlays->intersect(visibleRegion); coverage.aboveCoveredLayersExcludingOverlays->orSelf(visibleRegion); } // subtract the opaque region covered by the layers above us // subtract the opaque region covered by the layers above us visibleRegion.subtractSelf(coverage.aboveOpaqueLayers); visibleRegion.subtractSelf(coverage.aboveOpaqueLayers); Loading Loading @@ -733,6 +751,10 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, ? outputState.transform.transform( ? outputState.transform.transform( transparentRegion.intersect(outputState.layerStackSpace.getContent())) transparentRegion.intersect(outputState.layerStackSpace.getContent())) : Region(); : Region(); if (CC_UNLIKELY(computeAboveCoveredExcludingOverlays)) { outputLayerState.coveredRegionExcludingDisplayOverlays = std::move(coveredRegionExcludingDisplayOverlays); } } } void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) { void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) { Loading Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/CompositionRefreshArgs.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -97,6 +97,8 @@ struct CompositionRefreshArgs { std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; std::vector<BorderRenderInfo> borderInfoList; std::vector<BorderRenderInfo> borderInfoList; bool hasTrustedPresentationListener = false; }; }; } // namespace android::compositionengine } // namespace android::compositionengine
services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h +2 −0 Original line number Original line Diff line number Diff line Loading @@ -212,6 +212,8 @@ struct LayerFECompositionState { float currentSdrHdrRatio = 1.f; float currentSdrHdrRatio = 1.f; float desiredSdrHdrRatio = 1.f; float desiredSdrHdrRatio = 1.f; bool isInternalDisplayOverlay = false; virtual ~LayerFECompositionState(); virtual ~LayerFECompositionState(); // Debugging // Debugging Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/Output.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -153,6 +153,10 @@ public: Region aboveOpaqueLayers; Region aboveOpaqueLayers; // The region of the output which should be considered dirty // The region of the output which should be considered dirty Region dirtyRegion; Region dirtyRegion; // The region of the output which is covered by layers, excluding display overlays. This // only has a value if there's something needing it, like when a TrustedPresentationListener // is set std::optional<Region> aboveCoveredLayersExcludingOverlays; }; }; virtual ~Output(); virtual ~Output(); Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputLayerCompositionState.h +7 −1 Original line number Original line Diff line number Diff line Loading @@ -63,9 +63,15 @@ struct OutputLayerCompositionState { // The portion of the layer that is not obscured and is also opaque // The portion of the layer that is not obscured and is also opaque Region visibleNonTransparentRegion; Region visibleNonTransparentRegion; // The portion of the layer that is obscured by opaque layers on top // The portion of the layer that is obscured by all layers on top. This includes transparent and // opaque. Region coveredRegion; Region coveredRegion; // The portion of the layer that is obscured by all layers on top excluding display overlays. // This only has a value if there's something needing it, like when a // TrustedPresentationListener is set. std::optional<Region> coveredRegionExcludingDisplayOverlays; // The visibleRegion transformed to output space // The visibleRegion transformed to output space Region outputSpaceVisibleRegion; Region outputSpaceVisibleRegion; Loading
services/surfaceflinger/CompositionEngine/src/Output.cpp +22 −0 Original line number Original line Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <ftl/future.h> #include <ftl/future.h> #include <gui/TraceUtils.h> #include <gui/TraceUtils.h> #include <optional> #include <thread> #include <thread> #include "renderengine/ExternalTexture.h" #include "renderengine/ExternalTexture.h" Loading Loading @@ -480,6 +481,9 @@ void Output::rebuildLayerStacks(const compositionengine::CompositionRefreshArgs& // Process the layers to determine visibility and coverage // Process the layers to determine visibility and coverage compositionengine::Output::CoverageState coverage{layerFESet}; compositionengine::Output::CoverageState coverage{layerFESet}; coverage.aboveCoveredLayersExcludingOverlays = refreshArgs.hasTrustedPresentationListener ? std::make_optional<Region>() : std::nullopt; collectVisibleLayers(refreshArgs, coverage); collectVisibleLayers(refreshArgs, coverage); // Compute the resulting coverage for this output, and store it for later // Compute the resulting coverage for this output, and store it for later Loading Loading @@ -534,6 +538,9 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, return; return; } } bool computeAboveCoveredExcludingOverlays = coverage.aboveCoveredLayersExcludingOverlays && !layerFEState->isInternalDisplayOverlay; /* /* * opaqueRegion: area of a surface that is fully opaque. * opaqueRegion: area of a surface that is fully opaque. */ */ Loading Loading @@ -575,6 +582,11 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, */ */ Region shadowRegion; Region shadowRegion; /** * covered region above excluding internal display overlay layers */ std::optional<Region> coveredRegionExcludingDisplayOverlays = std::nullopt; const ui::Transform& tr = layerFEState->geomLayerTransform; const ui::Transform& tr = layerFEState->geomLayerTransform; // Get the visible region // Get the visible region Loading Loading @@ -647,6 +659,12 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, // Update accumAboveCoveredLayers for next (lower) layer // Update accumAboveCoveredLayers for next (lower) layer coverage.aboveCoveredLayers.orSelf(visibleRegion); coverage.aboveCoveredLayers.orSelf(visibleRegion); if (CC_UNLIKELY(computeAboveCoveredExcludingOverlays)) { coveredRegionExcludingDisplayOverlays = coverage.aboveCoveredLayersExcludingOverlays->intersect(visibleRegion); coverage.aboveCoveredLayersExcludingOverlays->orSelf(visibleRegion); } // subtract the opaque region covered by the layers above us // subtract the opaque region covered by the layers above us visibleRegion.subtractSelf(coverage.aboveOpaqueLayers); visibleRegion.subtractSelf(coverage.aboveOpaqueLayers); Loading Loading @@ -733,6 +751,10 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE, ? outputState.transform.transform( ? outputState.transform.transform( transparentRegion.intersect(outputState.layerStackSpace.getContent())) transparentRegion.intersect(outputState.layerStackSpace.getContent())) : Region(); : Region(); if (CC_UNLIKELY(computeAboveCoveredExcludingOverlays)) { outputLayerState.coveredRegionExcludingDisplayOverlays = std::move(coveredRegionExcludingDisplayOverlays); } } } void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) { void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) { Loading