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

Commit ba074263 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "SF: Enable Layer Caching Texture Pool only for the active display" into...

Merge "SF: Enable Layer Caching Texture Pool only for the active display" into sc-v2-dev am: 69f548e5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15315818

Change-Id: I3e4fd080831d6bbf01b9089f8dc17d8f2d0601ac
parents 3c122b5c 69f548e5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -166,6 +166,9 @@ public:
    // Enables (or disables) layer caching on this output
    virtual void setLayerCachingEnabled(bool) = 0;

    // Enables (or disables) layer caching texture pool on this output
    virtual void setLayerCachingTexturePoolEnabled(bool) = 0;

    // Sets the projection state to use
    virtual void setProjection(ui::Rotation orientation, const Rect& layerStackSpaceRect,
                               const Rect& orientedDisplaySpaceRect) = 0;
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ public:
    std::optional<DisplayId> getDisplayId() const override;
    void setCompositionEnabled(bool) override;
    void setLayerCachingEnabled(bool) override;
    void setLayerCachingTexturePoolEnabled(bool) override;
    void setProjection(ui::Rotation orientation, const Rect& layerStackSpaceRect,
                       const Rect& orientedDisplaySpaceRect) override;
    void setDisplaySize(const ui::Size&) override;
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ public:
    void renderCachedSets(const OutputCompositionState& outputState,
                          std::optional<std::chrono::steady_clock::time_point> renderDeadline);

    void setTexturePoolEnabled(bool enabled) { mTexturePool.setEnabled(enabled); }

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

+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ public:
    void renderCachedSets(const OutputCompositionState& outputState,
                          std::optional<std::chrono::steady_clock::time_point> renderDeadline);

    void setTexturePoolEnabled(bool enabled) { mFlattener.setTexturePoolEnabled(enabled); }

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

private:
+10 −1
Original line number Diff line number Diff line
@@ -63,7 +63,8 @@ public:
        sp<Fence> mFence;
    };

    TexturePool(renderengine::RenderEngine& renderEngine) : mRenderEngine(renderEngine) {}
    TexturePool(renderengine::RenderEngine& renderEngine)
          : mRenderEngine(renderEngine), mEnabled(false) {}

    virtual ~TexturePool() = default;

@@ -78,6 +79,12 @@ public:
    // to the pool.
    std::shared_ptr<AutoTexture> borrowTexture();

    // Enables or disables the pool. When the pool is disabled, no buffers will
    // be held by the pool. This is useful when the active display changes.
    void setEnabled(bool enable);

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

protected:
    // Proteted visibility so that they can be used for testing
    const static constexpr size_t kMinPoolSize = 3;
@@ -95,8 +102,10 @@ private:
    // Returns a previously borrowed texture to the pool.
    void returnTexture(std::shared_ptr<renderengine::ExternalTexture>&& texture,
                       const sp<Fence>& fence);
    void allocatePool();
    renderengine::RenderEngine& mRenderEngine;
    ui::Size mSize;
    bool mEnabled;
};

} // namespace android::compositionengine::impl::planner
Loading