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

Commit b9216dc3 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

Implement SkiaGLRenderEngine::primeCache

Bug: 178661709
Test: perfetto/systrace

SkiaGLRenderEngine is unable to write to disk, so it cannot have a
persistent cache for shaders. Instead, warm up the cache by calling
drawLayers in the ways we expect to see it called during actual use.

Currently, this just uses parameters seen when opening the dialer, which
required compiling several shaders. Future CLs will expand this to cover
other cases.

Remove the const modifier from primeCache. Conceptually, it is not
const, since we want to change some state (what's in the cache). More
practically, it is now calling drawLayers, which is not const.

Change-Id: I4bad4ff6cf79d4cd81eef1a5bee6530b3bdc0e84
parent 8503741e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ filegroup {
    name: "librenderengine_skia_sources",
    srcs: [
        "skia/AutoBackendTexture.cpp",
        "skia/Cache.cpp",
        "skia/ColorSpaces.cpp",
        "skia/SkiaRenderEngine.cpp",
        "skia/SkiaGLRenderEngine.cpp",
+1 −1
Original line number Diff line number Diff line
@@ -515,7 +515,7 @@ Framebuffer* GLESRenderEngine::getFramebufferForDrawing() {
    return mDrawingBuffer.get();
}

void GLESRenderEngine::primeCache() const {
void GLESRenderEngine::primeCache() {
    ProgramCache::getInstance().primeCache(mInProtectedContext ? mProtectedEGLContext : mEGLContext,
                                           mUseColorManagement, mPrecacheToneMapperShaderOnly);
}
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ public:
                     EGLSurface protectedStub);
    ~GLESRenderEngine() override EXCLUDES(mRenderingMutex);

    void primeCache() const override;
    void primeCache() override;
    void genTextures(size_t count, uint32_t* names) override;
    void deleteTextures(size_t count, uint32_t const* names) override;
    void cacheExternalTextureBuffer(const sp<GraphicBuffer>& buffer) EXCLUDES(mRenderingMutex);
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public:
    // This interface, while still in use until a suitable replacement is built,
    // should be considered deprecated, minus some methods which still may be
    // used to support legacy behavior.
    virtual void primeCache() const = 0;
    virtual void primeCache() = 0;

    // dump the extension strings. always call the base class.
    virtual void dump(std::string& result) = 0;
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public:
    RenderEngine();
    ~RenderEngine() override;

    MOCK_CONST_METHOD0(primeCache, void());
    MOCK_METHOD0(primeCache, void());
    MOCK_METHOD1(dump, void(std::string&));
    MOCK_METHOD2(genTextures, void(size_t, uint32_t*));
    MOCK_METHOD2(deleteTextures, void(size_t, uint32_t const*));
Loading