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

Commit 9c8fce0b authored by Alec Mouri's avatar Alec Mouri
Browse files

Add output dataspace to CachedSet rendering

This ensures that:
* The proper color conversion is applied to the rendered output.
* Color information is correctly provided when passing the cached buffer
over to HWC

Also rename dataspace to outputDataspace whenever the dataspace is used
for output, so that it's less confusing than just "dataspace"

Bug: 181192086
Bug: 181192080
Test: libcompositionengine_test
Change-Id: I024ab471a9139209d2a51add145e6b14d9ed3745
parent ead2fee4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ struct OutputLayerCompositionState {
        sp<GraphicBuffer> buffer = nullptr;
        sp<Fence> acquireFence = nullptr;
        Rect displayFrame = {};
        ui::Dataspace dataspace{ui::Dataspace::UNKNOWN};
    } overrideInfo;

    /*
+5 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public:
    size_t getAge() const { return mAge; }
    const sp<GraphicBuffer>& getBuffer() const { return mTexture.getBuffer(); }
    const sp<Fence>& getDrawFence() const { return mDrawFence; }
    ui::Dataspace getOutputDataspace() const { return mOutputDataspace; }

    NonBufferHash getNonBufferHash() const;

@@ -80,6 +81,7 @@ public:
    void setLastUpdate(std::chrono::steady_clock::time_point now) { mLastUpdate = now; }
    void append(const CachedSet& other) {
        mTexture.setBuffer(nullptr, nullptr);
        mOutputDataspace = ui::Dataspace::UNKNOWN;
        mDrawFence = nullptr;

        mLayers.insert(mLayers.end(), other.mLayers.cbegin(), other.mLayers.cend());
@@ -90,7 +92,8 @@ public:
    }
    void incrementAge() { ++mAge; }

    void render(renderengine::RenderEngine&);
    // Renders the cached set with the supplied output dataspace.
    void render(renderengine::RenderEngine&, ui::Dataspace outputDataspace);

    void dump(std::string& result) const;

@@ -129,6 +132,7 @@ private:

    Texture mTexture;
    sp<Fence> mDrawFence;
    ui::Dataspace mOutputDataspace;

    static const bool sDebugHighlighLayers;
};
+2 −1
Original line number Diff line number Diff line
@@ -42,7 +42,8 @@ public:
    NonBufferHash flattenLayers(const std::vector<const LayerState*>& layers, NonBufferHash,
                                std::chrono::steady_clock::time_point now);

    void renderCachedSets(renderengine::RenderEngine&);
    // Renders the newest cached sets with the supplied output dataspace
    void renderCachedSets(renderengine::RenderEngine&, ui::Dataspace outputDataspace);

    void reset();

+3 −3
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ private:
                           }};

    using DataspaceState = OutputLayerState<ui::Dataspace, LayerStateField::Dataspace>;
    DataspaceState mDataspace{[](auto layer) { return layer->getState().dataspace; },
    DataspaceState mOutputDataspace{[](auto layer) { return layer->getState().dataspace; },
                                    DataspaceState::getHalToStrings()};

    // TODO(b/180638831): Buffer format
@@ -341,7 +341,7 @@ private:
    std::array<const StateInterface*, 13> getNonUniqueFields() const {
        return {
                &mDisplayFrame,   &mSourceCrop,      &mZOrder,         &mBufferTransform,
                &mBlendMode,      &mAlpha,           &mVisibleRegion,  &mDataspace,
                &mBlendMode,      &mAlpha,           &mVisibleRegion,  &mOutputDataspace,
                &mColorTransform, &mCompositionType, &mSidebandStream, &mBuffer,
                &mSolidColor,
        };
+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public:
            compositionengine::Output::OutputLayersEnumerator<compositionengine::Output>&& layers);

    // The planner will call to the Flattener to render any pending cached set
    void renderCachedSets(renderengine::RenderEngine&);
    void renderCachedSets(renderengine::RenderEngine&, ui::Dataspace outputDataspace);

    void dump(const Vector<String16>& args, std::string&);

Loading