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

Commit 54edd91c authored by Garfield Tan's avatar Garfield Tan
Browse files

Query composition engine for transform hint.

Some composition engines may want to use different transform and
transform hint. For example they may choose to delegate to another
compositor for composition, in which case they may not want SF to
transform layers and let the delegate compositor transform them. In the
meanwhile they also would like to provide the correct transform hint so
that the delgate compositor can still choose to use HW overlay when
display isn't in its natural orientation.

Bug: 170880203
Test: atest libcompositionengine_test
Change-Id: I600e78e47adc676632f4c59c74f4041abd553040
parent b05b9099
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -167,6 +167,11 @@ public:
                               const Rect& orientedDisplaySpaceRect) = 0;
    // Sets the bounds to use
    virtual void setDisplaySize(const ui::Size&) = 0;
    // Gets the transform hint used in layers that belong to this output. Used to guide
    // composition orientation so that HW overlay can be used when display isn't in its natural
    // orientation on some devices. Therefore usually we only use transform hint from display
    // output.
    virtual ui::Transform::RotationFlags getTransformHint() const = 0;

    // Sets the layer stack filtering settings for this output. See
    // belongsInOutput for full details.
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public:
                       const Rect& orientedDisplaySpaceRect) override;
    void setDisplaySize(const ui::Size&) override;
    void setLayerStackFilter(uint32_t layerStackId, bool isInternal) override;
    ui::Transform::RotationFlags getTransformHint() const override;

    void setColorTransform(const compositionengine::CompositionRefreshArgs&) override;
    void setColorProfile(const ColorProfile&) override;
+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public:
    MOCK_METHOD3(setProjection, void(ui::Rotation, const Rect&, const Rect&));
    MOCK_METHOD1(setDisplaySize, void(const ui::Size&));
    MOCK_METHOD2(setLayerStackFilter, void(uint32_t, bool));
    MOCK_CONST_METHOD0(getTransformHint, ui::Transform::RotationFlags());

    MOCK_METHOD1(setColorTransform, void(const compositionengine::CompositionRefreshArgs&));
    MOCK_METHOD1(setColorProfile, void(const ColorProfile&));
+4 −0
Original line number Diff line number Diff line
@@ -192,6 +192,10 @@ void Output::setDisplaySize(const ui::Size& size) {
    dirtyEntireOutput();
}

ui::Transform::RotationFlags Output::getTransformHint() const {
    return static_cast<ui::Transform::RotationFlags>(getState().transform.getOrientation());
}

void Output::setLayerStackFilter(uint32_t layerStackId, bool isInternal) {
    auto& outputState = editState();
    outputState.layerStackId = layerStackId;
+2 −0
Original line number Diff line number Diff line
@@ -268,6 +268,8 @@ TEST_F(OutputTest, setProjectionWorks) {
    EXPECT_EQ(orientation, state.framebufferSpace.orientation);

    EXPECT_EQ(state.displaySpace.content, state.transform.transform(state.layerStackSpace.content));

    EXPECT_EQ(ui::Transform::ROT_90, mOutput->getTransformHint());
}

TEST_F(OutputTest, setProjectionWithSmallFramebufferWorks) {
Loading