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

Commit a83776ca authored by Lloyd Pique's avatar Lloyd Pique
Browse files

SF: Move/Refactor Layer::setGeometry() to compositionengine::OutputLayer

The front-end Layer now implements only a small bit of functionality
to compute the geometry state of the layer, traversing the parent
hierarchy as needed. The geometry is written to data added to
LayerFECompositionState.

compositionengine::OutputLayer then computes the actual state for the output
the layer is on, storing the result in OutputLayerCompositionState. A
second new function then takes the output-specific layer state (and
output-independent layer state) and sends it to the HWC layer.

Implements partial tests for the new functions.

Test: atest libsurfaceflinger_unittest libcompositionengine_test
Bug: 121291683
Change-Id: Idc770e6c84d046555cc11d75d53fa22c4be4ae58
parent 3cbee173
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -105,6 +105,10 @@ bool BufferLayer::isFixedSize() const {
    return getEffectiveScalingMode() != NATIVE_WINDOW_SCALING_MODE_FREEZE;
}

bool BufferLayer::usesSourceCrop() const {
    return true;
}

static constexpr mat4 inverseOrientation(uint32_t transform) {
    const mat4 flipH(-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1);
    const mat4 flipV(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1);
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ public:
    // isFixedSize - true if content has a fixed size
    bool isFixedSize() const override;

    bool usesSourceCrop() const override;

    bool isHdrY410() const override;

    void setPerFrameData(const sp<const DisplayDevice>& display, const ui::Transform& transform,
+4 −5
Original line number Diff line number Diff line
@@ -46,11 +46,10 @@ public:
    bool onPreComposition(nsecs_t /*refreshStartTime*/) override { return false; }

protected:
    FloatRect computeCrop(const sp<const DisplayDevice>& /*display*/) const override { return {}; }
    bool prepareClientLayer(const RenderArea& renderArea, const Region& clip,
    virtual bool prepareClientLayer(const RenderArea& renderArea, const Region& clip,
                                    bool useIdentityTransform, Region& clearRegion,
                                    const bool supportProtectedContent,
                            renderengine::LayerSettings& layer) override;
                                    renderengine::LayerSettings& layer);

private:
    std::shared_ptr<compositionengine::Layer> mCompositionLayer;
+9 −0
Original line number Diff line number Diff line
@@ -24,12 +24,21 @@ class Fence;

namespace compositionengine {

struct LayerFECompositionState;

// Defines the interface used by the CompositionEngine to make requests
// of the front-end layer
class LayerFE : public virtual RefBase {
public:
    // Latches the output-independent state. If includeGeometry is false, the
    // geometry state can be skipped.
    virtual void latchCompositionState(LayerFECompositionState&, bool includeGeometry) const = 0;

    // Called after the layer is displayed to update the presentation fence
    virtual void onLayerDisplayed(const sp<Fence>&) = 0;

    // Gets some kind of identifier for the layer for debug purposes.
    virtual const char* getDebugName() const = 0;
};

} // namespace compositionengine
+16 −0
Original line number Diff line number Diff line
@@ -40,6 +40,22 @@ struct LayerFECompositionState {
    // value recomputed / set every frame.
    Region geomVisibleRegion;

    /*
     * Geometry state
     */

    bool isSecure{false};
    bool geomUsesSourceCrop{false};
    bool geomBufferUsesDisplayInverseTransform{false};
    uint32_t geomBufferTransform{0};
    ui::Transform geomLayerTransform;
    ui::Transform geomInverseLayerTransform;
    Rect geomBufferSize;
    Rect geomContentCrop;
    Rect geomCrop;
    Region geomActiveTransparentRegion;
    FloatRect geomLayerBounds;

    /*
     * Presentation
     */
Loading