Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9aadd30 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Some fixes to TrustedPresentationListener"

parents a0b01033 545da0e1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -97,6 +97,8 @@ struct CompositionRefreshArgs {
    std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime;

    std::vector<BorderRenderInfo> borderInfoList;

    bool hasTrustedPresentationListener = false;
};

} // namespace android::compositionengine
+2 −0
Original line number Diff line number Diff line
@@ -212,6 +212,8 @@ struct LayerFECompositionState {
    float currentSdrHdrRatio = 1.f;
    float desiredSdrHdrRatio = 1.f;

    bool isInternalDisplayOverlay = false;

    virtual ~LayerFECompositionState();

    // Debugging
+4 −0
Original line number Diff line number Diff line
@@ -153,6 +153,10 @@ public:
        Region aboveOpaqueLayers;
        // The region of the output which should be considered dirty
        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();
+7 −1
Original line number Diff line number Diff line
@@ -63,9 +63,15 @@ struct OutputLayerCompositionState {
    // The portion of the layer that is not obscured and is also opaque
    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;

    // 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
    Region outputSpaceVisibleRegion;

+22 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <ftl/future.h>
#include <gui/TraceUtils.h>

#include <optional>
#include <thread>

#include "renderengine/ExternalTexture.h"
@@ -480,6 +481,9 @@ void Output::rebuildLayerStacks(const compositionengine::CompositionRefreshArgs&

    // Process the layers to determine visibility and coverage
    compositionengine::Output::CoverageState coverage{layerFESet};
    coverage.aboveCoveredLayersExcludingOverlays = refreshArgs.hasTrustedPresentationListener
            ? std::make_optional<Region>()
            : std::nullopt;
    collectVisibleLayers(refreshArgs, coverage);

    // Compute the resulting coverage for this output, and store it for later
@@ -534,6 +538,9 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE,
        return;
    }

    bool computeAboveCoveredExcludingOverlays =
            coverage.aboveCoveredLayersExcludingOverlays && !layerFEState->isInternalDisplayOverlay;

    /*
     * opaqueRegion: area of a surface that is fully opaque.
     */
@@ -575,6 +582,11 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE,
     */
    Region shadowRegion;

    /**
     * covered region above excluding internal display overlay layers
     */
    std::optional<Region> coveredRegionExcludingDisplayOverlays = std::nullopt;

    const ui::Transform& tr = layerFEState->geomLayerTransform;

    // Get the visible region
@@ -647,6 +659,12 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE,
    // Update accumAboveCoveredLayers for next (lower) layer
    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
    visibleRegion.subtractSelf(coverage.aboveOpaqueLayers);

@@ -733,6 +751,10 @@ void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE,
            ? outputState.transform.transform(
                      transparentRegion.intersect(outputState.layerStackSpace.getContent()))
            : Region();
    if (CC_UNLIKELY(computeAboveCoveredExcludingOverlays)) {
        outputLayerState.coveredRegionExcludingDisplayOverlays =
                std::move(coveredRegionExcludingDisplayOverlays);
    }
}

void Output::setReleasedLayers(const compositionengine::CompositionRefreshArgs&) {
Loading