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

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

SF: include number of Skia shaders in perfetto traces

When a new shader is compiled in SurfaceFlinger (tracked by the ATRACE
tag "shader_compile"), SkSLCacheMonitor::store will be called.
(Eventually, we'd like to store the shader in a persistent cache - this
is blocked on b/119203607.) Use this method to keep track of the total
number of shaders used since boot. Print this number in the perfetto
trace.

This can be used to verify whether we have compiled enough shaders to
require cache eviction, and can also be used to determine how much
larger the cache should be. We are currently using
GrContextOptions.fRuntimeProgramCacheSize's default of 256.

Bug: 226662927
Bug: 222355787
Bug: 222109133
Bug: 190487656
Test: perfetto trace
Change-Id: Ifa99a8a2e16c136dc6f19e2a8dda0692aa4358a8
parent c8c33325
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -292,6 +292,8 @@ sk_sp<SkData> SkiaGLRenderEngine::SkSLCacheMonitor::load(const SkData& key) {
void SkiaGLRenderEngine::SkSLCacheMonitor::store(const SkData& key, const SkData& data,
                                                 const SkString& description) {
    mShadersCachedSinceLastCall++;
    mTotalShadersCompiled++;
    ATRACE_FORMAT("SF cache: %i shaders", mTotalShadersCompiled);
}

void SkiaGLRenderEngine::assertShadersCompiled(int numShaders) {
+1 −0
Original line number Diff line number Diff line
@@ -180,6 +180,7 @@ private:

    private:
        int mShadersCachedSinceLastCall = 0;
        int mTotalShadersCompiled = 0;
    };

    SkSLCacheMonitor mSkSLCacheMonitor;