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

Commit dfc3f7ca authored by Peiyong Lin's avatar Peiyong Lin
Browse files

Plumb client target property.

After validation, the hardware composer can request client target
properties and expect the client to use those to setup the client
target. This patch plumbs the API through to make sure buffer format is
set correctly accordingly.

Bug: b/145968912
Test: manual
Change-Id: I4a21f741e640f35883f64392c463c61029ec6ff0
parent 50f6c0e2
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,12 @@ public:
    // Sets the dataspace used for rendering the surface
    // Sets the dataspace used for rendering the surface
    virtual void setBufferDataspace(ui::Dataspace) = 0;
    virtual void setBufferDataspace(ui::Dataspace) = 0;


    // Sets the pixel format used for rendering the surface.
    // Changing the pixel format of the buffer will result in buffer
    // reallocation as well as some reconfiguration of the graphics context,
    // which are both expensive operations.
    virtual void setBufferPixelFormat(ui::PixelFormat) = 0;

    // Configures the protected rendering on the surface
    // Configures the protected rendering on the surface
    virtual void setProtected(bool useProtected) = 0;
    virtual void setProtected(bool useProtected) = 0;


+2 −0
Original line number Original line Diff line number Diff line
@@ -70,11 +70,13 @@ public:
    using ChangedTypes = android::HWComposer::DeviceRequestedChanges::ChangedTypes;
    using ChangedTypes = android::HWComposer::DeviceRequestedChanges::ChangedTypes;
    using DisplayRequests = android::HWComposer::DeviceRequestedChanges::DisplayRequests;
    using DisplayRequests = android::HWComposer::DeviceRequestedChanges::DisplayRequests;
    using LayerRequests = android::HWComposer::DeviceRequestedChanges::LayerRequests;
    using LayerRequests = android::HWComposer::DeviceRequestedChanges::LayerRequests;
    using ClientTargetProperty = android::HWComposer::DeviceRequestedChanges::ClientTargetProperty;
    virtual bool anyLayersRequireClientComposition() const;
    virtual bool anyLayersRequireClientComposition() const;
    virtual bool allLayersRequireClientComposition() const;
    virtual bool allLayersRequireClientComposition() const;
    virtual void applyChangedTypesToLayers(const ChangedTypes&);
    virtual void applyChangedTypesToLayers(const ChangedTypes&);
    virtual void applyDisplayRequests(const DisplayRequests&);
    virtual void applyDisplayRequests(const DisplayRequests&);
    virtual void applyLayerRequestsToLayers(const LayerRequests&);
    virtual void applyLayerRequestsToLayers(const LayerRequests&);
    virtual void applyClientTargetRequests(const ClientTargetProperty&);


    // Internal
    // Internal
    virtual void setConfiguration(const compositionengine::DisplayCreationArgs&);
    virtual void setConfiguration(const compositionengine::DisplayCreationArgs&);
+1 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,7 @@ public:


    const sp<Fence>& getClientTargetAcquireFence() const override;
    const sp<Fence>& getClientTargetAcquireFence() const override;
    void setBufferDataspace(ui::Dataspace) override;
    void setBufferDataspace(ui::Dataspace) override;
    void setBufferPixelFormat(ui::PixelFormat) override;
    void setDisplaySize(const ui::Size&) override;
    void setDisplaySize(const ui::Size&) override;
    void setProtected(bool useProtected) override;
    void setProtected(bool useProtected) override;
    status_t beginFrame(bool mustRecompose) override;
    status_t beginFrame(bool mustRecompose) override;
+1 −0
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ public:
    MOCK_METHOD1(setDisplaySize, void(const ui::Size&));
    MOCK_METHOD1(setDisplaySize, void(const ui::Size&));
    MOCK_METHOD1(setProtected, void(bool));
    MOCK_METHOD1(setProtected, void(bool));
    MOCK_METHOD1(setBufferDataspace, void(ui::Dataspace));
    MOCK_METHOD1(setBufferDataspace, void(ui::Dataspace));
    MOCK_METHOD1(setBufferPixelFormat, void(ui::PixelFormat));
    MOCK_METHOD1(beginFrame, status_t(bool mustRecompose));
    MOCK_METHOD1(beginFrame, status_t(bool mustRecompose));
    MOCK_METHOD2(prepareFrame, void(bool, bool));
    MOCK_METHOD2(prepareFrame, void(bool, bool));
    MOCK_METHOD1(dequeueBuffer, sp<GraphicBuffer>(base::unique_fd*));
    MOCK_METHOD1(dequeueBuffer, sp<GraphicBuffer>(base::unique_fd*));
+11 −0
Original line number Original line Diff line number Diff line
@@ -259,6 +259,7 @@ void Display::chooseCompositionStrategy() {
        applyChangedTypesToLayers(changes->changedTypes);
        applyChangedTypesToLayers(changes->changedTypes);
        applyDisplayRequests(changes->displayRequests);
        applyDisplayRequests(changes->displayRequests);
        applyLayerRequestsToLayers(changes->layerRequests);
        applyLayerRequestsToLayers(changes->layerRequests);
        applyClientTargetRequests(changes->clientTargetProperty);
    }
    }


    // Determine what type of composition we are doing from the final state
    // Determine what type of composition we are doing from the final state
@@ -326,6 +327,16 @@ void Display::applyLayerRequestsToLayers(const LayerRequests& layerRequests) {
    }
    }
}
}


void Display::applyClientTargetRequests(const ClientTargetProperty& clientTargetProperty) {
    if (clientTargetProperty.dataspace == ui::Dataspace::UNKNOWN) {
        return;
    }
    auto outputState = editState();
    outputState.dataspace = clientTargetProperty.dataspace;
    getRenderSurface()->setBufferDataspace(clientTargetProperty.dataspace);
    getRenderSurface()->setBufferPixelFormat(clientTargetProperty.pixelFormat);
}

compositionengine::Output::FrameFences Display::presentAndGetFrameFences() {
compositionengine::Output::FrameFences Display::presentAndGetFrameFences() {
    auto result = impl::Output::presentAndGetFrameFences();
    auto result = impl::Output::presentAndGetFrameFences();


Loading