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

Commit 9aa25c2e authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

SF rounded corners: include geometry when reordering

Bug: 184729207
Bug: 163076219
Test: TODO

In Id721cd451209ab50e5cd8badf5f3e0917506e728, we started updating
geometry if we had an override buffer, or if the last frame did. Also do
so for a peekThroughLayer, since its blend mode changes. In addition,
the z has changed for layers starting with the peekThroughLayer, so
update geometry for those, too.

Move isPeekingThrough to a local variable and parameter. It does not
need the lifetime of overrideInfo. Add it and zIsOverridden to
writeStateToHWC to ensure we restore the order in HWC when the
peekThroughLayer is no longer needed.

Change-Id: I4b2dda504dc52ec06795a2d2b6236b0472702880
parent ff3c57e9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -93,8 +93,11 @@ public:
    // skipped. If skipLayer is true, then the alpha of the layer is forced to
    // 0 so that HWC will ignore it. z specifies the order to draw the layer in
    // (starting with 0 for the back layer, and increasing for each following
    // layer).
    virtual void writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z) = 0;
    // layer). zIsOverridden specifies whether the layer has been reordered.
    // isPeekingThrough specifies whether this layer will be shown through a
    // hole punch in a layer above it.
    virtual void writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z,
                                 bool zIsOverridden, bool isPeekingThrough) = 0;

    // Updates the cursor position with the HWC
    virtual void writeCursorPositionToHWC() const = 0;
+4 −2
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ public:

    void updateCompositionState(bool includeGeometry, bool forceClientComposition,
                                ui::Transform::RotationFlags) override;
    void writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z) override;
    void writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t z, bool zIsOverridden,
                         bool isPeekingThrough) override;
    void writeCursorPositionToHWC() const override;

    HWC2::Layer* getHwcLayer() const override;
@@ -76,7 +77,8 @@ private:
    void writeSolidColorStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeSidebandStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeBufferStateToHWC(HWC2::Layer*, const LayerFECompositionState&);
    void writeCompositionTypeToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition);
    void writeCompositionTypeToHWC(HWC2::Layer*, Hwc2::IComposerClient::Composition,
                                   bool isPeekingThrough);
    void detectDisallowedCompositionTypeChange(Hwc2::IComposerClient::Composition from,
                                               Hwc2::IComposerClient::Composition to) const;
};
+0 −5
Original line number Diff line number Diff line
@@ -103,11 +103,6 @@ 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;

    /*
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public:
    MOCK_METHOD0(editState, impl::OutputLayerCompositionState&());

    MOCK_METHOD3(updateCompositionState, void(bool, bool, ui::Transform::RotationFlags));
    MOCK_METHOD3(writeStateToHWC, void(bool, bool, uint32_t));
    MOCK_METHOD5(writeStateToHWC, void(bool, bool, uint32_t, bool, bool));
    MOCK_CONST_METHOD0(writeCursorPositionToHWC, void());

    MOCK_CONST_METHOD0(getHwcLayer, HWC2::Layer*());
+9 −5
Original line number Diff line number Diff line
@@ -709,7 +709,9 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr

    OutputLayer* peekThroughLayer = nullptr;
    sp<GraphicBuffer> previousOverride = nullptr;
    bool includeGeometry = refreshArgs.updatingGeometryThisFrame;
    uint32_t z = 0;
    bool overrideZ = false;
    for (auto* layer : getOutputLayersOrderedByZ()) {
        if (layer == peekThroughLayer) {
            // No longer needed, although it should not show up again, so
@@ -729,19 +731,21 @@ 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++);
                    overrideZ = true;
                    includeGeometry = true;
                    constexpr bool isPeekingThrough = true;
                    peekThroughLayer->writeStateToHWC(includeGeometry, false, z++, overrideZ,
                                                      isPeekingThrough);
                }

                previousOverride = overrideInfo.buffer->getBuffer();
            }
        }

        const bool includeGeometry = refreshArgs.updatingGeometryThisFrame;
        layer->writeStateToHWC(includeGeometry, skipLayer, z++);
        constexpr bool isPeekingThrough = false;
        layer->writeStateToHWC(includeGeometry, skipLayer, z++, overrideZ, isPeekingThrough);
    }
}

Loading