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

Commit 3a7346ce authored by Vishnu Nair's avatar Vishnu Nair
Browse files

[Shadows] Create a new composition layer for shadows [6/n]

When generating the list of composition layers, generate one to render
shadows based on the layer settings.

The function passes in  the display view port to calculate shadow
position. When rendering a screenshot, use the layerstack of the
root layer to find the display and its viewport since the shadows
on the screenshot have to match how it was rendered on display.

Pass in display or target output dataspace so shadows do not have to
do any color conversion.

Bug: 136561771
Test: go/wm-smoke
Test: libcompositionengine_test
Change-Id: I89795707f054b6a08dabc278d80ed393a0da0a7e
parent 08f6eae0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -93,6 +93,13 @@ public:
    virtual std::optional<renderengine::LayerSettings> prepareClientComposition(
            ClientCompositionTargetSettings&) = 0;

    // Returns the LayerSettings used to draw shadows around a layer. It is passed
    // to RenderEngine::drawLayers. Returns nullopt_t if the layer does not render
    // shadows.
    virtual std::optional<renderengine::LayerSettings> prepareShadowClientComposition(
            const renderengine::LayerSettings& layerSettings, const Rect& displayViewport,
            ui::Dataspace outputDataspace) = 0;

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

+1 −1
Original line number Diff line number Diff line
@@ -272,7 +272,7 @@ protected:
    virtual bool getSkipColorTransform() const = 0;
    virtual FrameFences presentAndGetFrameFences() = 0;
    virtual std::vector<renderengine::LayerSettings> generateClientCompositionRequests(
            bool supportsProtectedContent, Region& clearRegion) = 0;
            bool supportsProtectedContent, Region& clearRegion, ui::Dataspace outputDataspace) = 0;
    virtual void appendRegionFlashRequests(
            const Region& flashRegion,
            std::vector<renderengine::LayerSettings>& clientCompositionLayers) = 0;
+2 −1
Original line number Diff line number Diff line
@@ -97,7 +97,8 @@ protected:
    bool getSkipColorTransform() const override;
    compositionengine::Output::FrameFences presentAndGetFrameFences() override;
    std::vector<renderengine::LayerSettings> generateClientCompositionRequests(
            bool supportsProtectedContent, Region& clearRegion) override;
            bool supportsProtectedContent, Region& clearRegion,
            ui::Dataspace outputDataspace) override;
    void appendRegionFlashRequests(const Region&,
                                   std::vector<renderengine::LayerSettings>&) override;
    void setExpensiveRenderingExpected(bool enabled) override;
+4 −0
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@ public:
    MOCK_METHOD1(prepareClientComposition,
                 std::optional<renderengine::LayerSettings>(
                         compositionengine::LayerFE::ClientCompositionTargetSettings&));
    MOCK_METHOD3(prepareShadowClientComposition,
                 std::optional<renderengine::LayerSettings>(const renderengine::LayerSettings&,
                                                            const Rect&, ui::Dataspace));

    MOCK_METHOD1(onLayerDisplayed, void(const sp<Fence>&));

    MOCK_CONST_METHOD0(getDebugName, const char*());
+2 −2
Original line number Diff line number Diff line
@@ -106,8 +106,8 @@ public:
    MOCK_METHOD0(postFramebuffer, void());
    MOCK_METHOD0(presentAndGetFrameFences, compositionengine::Output::FrameFences());

    MOCK_METHOD2(generateClientCompositionRequests,
                 std::vector<renderengine::LayerSettings>(bool, Region&));
    MOCK_METHOD3(generateClientCompositionRequests,
                 std::vector<renderengine::LayerSettings>(bool, Region&, ui::Dataspace));
    MOCK_METHOD2(appendRegionFlashRequests,
                 void(const Region&, std::vector<renderengine::LayerSettings>&));
    MOCK_METHOD1(setExpensiveRenderingExpected, void(bool));
Loading