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

Commit fa959a0a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "SF: Add ability to get basic geometry"

parents dd3d0268 c668734c
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -39,9 +39,26 @@ public:
    // process.
    virtual bool onPreComposition(nsecs_t refreshStartTime) = 0;

    // Latches the output-independent state. If includeGeometry is false, the
    // geometry state can be skipped.
    virtual void latchCompositionState(LayerFECompositionState&, bool includeGeometry) const = 0;
    // Used with latchCompositionState()
    enum class StateSubset {
        // Gets the basic geometry (bounds, transparent region, visibility,
        // transforms, alpha) for the layer, for computing visibility and
        // coverage.
        BasicGeometry,

        // Gets the full geometry (crops, buffer transforms, metadata) and
        // content (buffer or color) state for the layer.
        GeometryAndContent,

        // Gets the per frame content (buffer or color) state the layer.
        Content,
    };

    // Latches the output-independent composition state for the layer. The
    // StateSubset argument selects what portion of the state is actually needed
    // by the CompositionEngine code, since computing everything may be
    // expensive.
    virtual void latchCompositionState(LayerFECompositionState&, StateSubset) const = 0;

    // Latches the minimal bit of state for the cursor for a fast asynchronous
    // update.
+39 −17
Original line number Diff line number Diff line
@@ -40,6 +40,45 @@ struct LayerFECompositionState {
    // the next geometry change.
    bool forceClientComposition{false};

    // TODO(b/121291683): Reorganize and rename the contents of this structure

    /*
     * Visibility state
     */
    // the layer stack this layer belongs to
    std::optional<uint32_t> layerStackId;

    // If true, this layer should be only visible on the internal display
    bool internalOnly{false};

    // If false, this layer should not be considered visible
    bool isVisible{true};

    // True if the layer is completely opaque
    bool isOpaque{true};

    // If true, invalidates the entire visible region
    bool contentDirty{false};

    // The alpha value for this layer
    float alpha{1.f};

    // The transform from layer local coordinates to composition coordinates
    ui::Transform geomLayerTransform;

    // The inverse of the layer transform
    ui::Transform geomInverseLayerTransform;

    // The hint from the layer producer as to what portion of the layer is
    // transparent.
    Region transparentRegionHint;

    // The blend mode for this layer
    Hwc2::IComposerClient::BlendMode blendMode{Hwc2::IComposerClient::BlendMode::INVALID};

    // The bounds of the layer in layer local coordinates
    FloatRect geomLayerBounds;

    /*
     * Geometry state
     */
@@ -48,23 +87,9 @@ struct LayerFECompositionState {
    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
     */

    // The blend mode for this layer
    Hwc2::IComposerClient::BlendMode blendMode{Hwc2::IComposerClient::BlendMode::INVALID};

    // The alpha value for this layer
    float alpha{1.f};

    /*
     * Extra metadata
@@ -113,9 +138,6 @@ struct LayerFECompositionState {
    mat4 colorTransform;
    bool colorTransformIsIdentity{true};

    // True if the layer is completely opaque
    bool isOpaque{true};

    // True if the layer has protected content
    bool hasProtectedContent{false};

+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ public:
    // A layer belongs to the output if its layerStackId matches. Additionally
    // if the layer should only show in the internal (primary) display only and
    // this output allows that.
    virtual bool belongsInOutput(uint32_t layerStackId, bool internalOnly) const = 0;
    virtual bool belongsInOutput(std::optional<uint32_t> layerStackId, bool internalOnly) const = 0;

    // Returns a pointer to the output layer corresponding to the given layer on
    // this output, or nullptr if the layer does not have one
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public:
    OutputCompositionState& editState() override;

    Region getDirtyRegion(bool repaintEverything) const override;
    bool belongsInOutput(uint32_t, bool) const override;
    bool belongsInOutput(std::optional<uint32_t>, bool) const override;

    compositionengine::OutputLayer* getOutputLayerForLayer(
            compositionengine::Layer*) const override;
+2 −1
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ public:

    MOCK_METHOD1(onPreComposition, bool(nsecs_t));

    MOCK_CONST_METHOD2(latchCompositionState, void(LayerFECompositionState&, bool));
    MOCK_CONST_METHOD2(latchCompositionState,
                       void(LayerFECompositionState&, compositionengine::LayerFE::StateSubset));
    MOCK_CONST_METHOD1(latchCursorCompositionState, void(LayerFECompositionState&));
    MOCK_METHOD1(prepareClientComposition,
                 std::optional<renderengine::LayerSettings>(
Loading