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

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

CE: Allow the final class to set the types used

Modifies the various CompositionEngine implementation classes so that
they no longer store instances of the state structures they manipulate.

Instead the implementation gets access to the state using an accessor,
which is only implemented by a final derived class type.

Doing this allows for implementation inheritance, where a derived
implementation can leverage covariance to work with a more specialized type.

Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: go/wm-smoke
Bug: 121291683
Change-Id: I26366900fc4c7869f4de91f25e43b3bec917f63d
parent 685e1781
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ public:
    virtual ~CompositionEngine();

    // Create a composition Display
    virtual std::shared_ptr<Display> createDisplay(DisplayCreationArgs&&) = 0;
    virtual std::shared_ptr<Layer> createLayer(LayerCreationArgs&&) = 0;
    virtual std::shared_ptr<Display> createDisplay(const DisplayCreationArgs&) = 0;
    virtual std::shared_ptr<Layer> createLayer(const LayerCreationArgs&) = 0;

    virtual HWComposer& getHwComposer() const = 0;
    virtual void setHwComposer(std::unique_ptr<HWComposer>) = 0;
+2 −2
Original line number Diff line number Diff line
@@ -47,10 +47,10 @@ public:
    virtual void disconnect() = 0;

    // Creates a render color mode for the display
    virtual void createDisplayColorProfile(DisplayColorProfileCreationArgs&&) = 0;
    virtual void createDisplayColorProfile(const DisplayColorProfileCreationArgs&) = 0;

    // Creates a render surface for the display
    virtual void createRenderSurface(RenderSurfaceCreationArgs&&) = 0;
    virtual void createRenderSurface(const RenderSurfaceCreationArgs&) = 0;

protected:
    ~Display() = default;
+1 −8
Original line number Diff line number Diff line
@@ -30,9 +30,6 @@ class CompositionEngine;
 * A parameter object for creating Display instances
 */
struct DisplayCreationArgs {
    // True if this display is secure
    bool isSecure = false;

    // True if this display is a virtual display
    bool isVirtual = false;

@@ -54,17 +51,13 @@ struct DisplayCreationArgs {
 *
 * Prefer:
 *
 *  DisplayCreationArgsBuilder().setIsSecure(false).setIsVirtual(false)
 *  DisplayCreationArgsBuilder().setIsVirtual(false)
 *      .setDisplayId(displayId).build();
 */
class DisplayCreationArgsBuilder {
public:
    DisplayCreationArgs build() { return std::move(mArgs); }

    DisplayCreationArgsBuilder& setIsSecure(bool isSecure) {
        mArgs.isSecure = isSecure;
        return *this;
    }
    DisplayCreationArgsBuilder& setIsVirtual(bool isVirtual) {
        mArgs.isVirtual = isVirtual;
        return *this;
+0 −6
Original line number Diff line number Diff line
@@ -162,12 +162,6 @@ public:
    virtual std::unique_ptr<OutputLayer> createOutputLayer(const std::shared_ptr<Layer>&,
                                                           const sp<LayerFE>&) const = 0;

    // Gets the OutputLayer corresponding to the input Layer instance from the
    // current ordered set of output layers. If there is no such layer, a new
    // one is created and returned.
    virtual std::unique_ptr<OutputLayer> getOrCreateOutputLayer(std::shared_ptr<Layer>,
                                                                sp<LayerFE>) = 0;

    // Sets the new ordered set of output layers for this output
    virtual void setOutputLayersOrderedByZ(OutputLayers&&) = 0;

+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public:

    // Queues the drawn buffer for consumption by HWC. readyFence is the fence
    // which will fire when the buffer is ready for consumption.
    virtual void queueBuffer(base::unique_fd&& readyFence) = 0;
    virtual void queueBuffer(base::unique_fd readyFence) = 0;

    // Called after the HWC calls are made to present the display
    virtual void onPresentDisplayCompleted() = 0;
Loading