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

Commit d305ef28 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

SF: Ignore rounded corners if the layer can peek through

Bug: 163076219
Test: manual
Test: I53fc851eca876d44ba7cb9347f1c62d659c38932

In Layer::preparePerFrameCompositionState, no longer set
forceClientComposition to true based on the presence of rounded corners.
This will be determined later, based on whether the Layer will peek
through a Layer with a hole-punch.

In CachedSet::requiresHolePunch, return false if the layer must be
client composited for reasons other than rounded corners (which no
longer force client composition). While we could still use a hole punch,
it would not provide the desired effect (preventing waking up the GPU).

Add an extra field to overrideInfo, denoting whether this layer will
peek through another layer. Set it on a peekThroughLayer before sending
it to the HWC. If it's not set, and the layer has rounded corners, the
layer must be client composited, as before.

Change-Id: I3b4341d049c0fa5020dfd89ca9e765588a457eb1
parent e2ee040d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -103,6 +103,11 @@ struct OutputLayerCompositionState {
        // be visible through it. Unowned - the OutputLayer's lifetime will
        // outlast this.)
        OutputLayer* peekThroughLayer = nullptr;

        // True if the OutputLayer represented by this CompositionState is
        // peeking through another layer, so it can be device composited even if
        // it should visually have rounded corners.
        bool isPeekingThrough = false;
    } overrideInfo;

    /*
+3 −1
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr
            continue;
        }
        bool skipLayer = false;
        auto& overrideInfo = layer->getState().overrideInfo;
        const auto& overrideInfo = layer->getState().overrideInfo;
        if (overrideInfo.buffer != nullptr) {
            if (previousOverride && overrideInfo.buffer->getBuffer() == previousOverride) {
                ALOGV("Skipping redundant buffer");
@@ -729,6 +729,8 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr
                // First layer with the override buffer.
                if (overrideInfo.peekThroughLayer) {
                    peekThroughLayer = overrideInfo.peekThroughLayer;
                    peekThroughLayer->editState().overrideInfo.isPeekingThrough = true;

                    // Draw peekThroughLayer first.
                    const bool includeGeometry = refreshArgs.updatingGeometryThisFrame;
                    peekThroughLayer->writeStateToHWC(includeGeometry, false, z++);
+2 −1
Original line number Diff line number Diff line
@@ -567,7 +567,8 @@ void OutputLayer::writeCompositionTypeToHWC(HWC2::Layer* hwcLayer,
    auto& outputDependentState = editState();

    // If we are forcing client composition, we need to tell the HWC
    if (outputDependentState.forceClientComposition) {
    if (outputDependentState.forceClientComposition ||
        (!getState().overrideInfo.isPeekingThrough && getLayerFE().hasRoundedCorners())) {
        requestedCompositionType = hal::Composition::CLIENT;
    }

+4 −0
Original line number Diff line number Diff line
@@ -271,6 +271,10 @@ bool CachedSet::requiresHolePunch() const {
    }

    const auto& layerFE = mLayers[0].getState()->getOutputLayer()->getLayerFE();
    if (layerFE.getCompositionState()->forceClientComposition) {
        return false;
    }

    return layerFE.hasRoundedCorners();
}

+3 −1
Original line number Diff line number Diff line
@@ -531,7 +531,9 @@ void Layer::preparePerFrameCompositionState() {
            isOpaque(drawingState) && !usesRoundedCorners && getAlpha() == 1.0_hf;

    // Force client composition for special cases known only to the front-end.
    if (isHdrY410() || usesRoundedCorners || drawShadows() || drawingState.blurRegions.size() > 0 ||
    // Rounded corners no longer force client composition, since we may use a
    // hole punch so that the layer will appear to have rounded corners.
    if (isHdrY410() || drawShadows() || drawingState.blurRegions.size() > 0 ||
        compositionState->stretchEffect.hasEffect()) {
        compositionState->forceClientComposition = true;
    }