tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 5fbcff55e74183afdf81a7e3422f8222fb7ad3e1
parent 12f7fad6164ba5466dd6160f5d00600f8fb7dee8
Author: Jamie Nicol <jnicol@mozilla.com>
Date:   Fri, 19 Dec 2025 16:17:09 +0000

Bug 2007127 - Avoid warming up webrender shader cache on devices where glProgramBinary is slow. r=mstange

Loading cached program binaries on the Samsung Xclipse driver on
Android 14 is slightly faster than compiling shaders from source, so
we still want to keep the disk cache enabled. However, it is slow
enough that eagerly warming up the cache with shaders which may not be
required can negatively impact performance. This patch avoids running
the warm up step on such devices.

Differential Revision: https://phabricator.services.mozilla.com/D277196

Diffstat:
Mgfx/config/gfxVars.h | 1+
Mgfx/thebes/gfxPlatform.cpp | 17+++++++++++++++++
Mgfx/webrender_bindings/RenderThread.cpp | 2+-
3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/gfx/config/gfxVars.h b/gfx/config/gfxVars.h @@ -47,6 +47,7 @@ class MOZ_STACK_CLASS gfxVarsCollectUpdates; _(UseWebRenderTripleBufferingWin, bool, false) \ _(UseWebRenderCompositor, bool, false) \ _(UseWebRenderProgramBinaryDisk, bool, false) \ + _(ShouldWarmUpWebRenderProgramBinaries, bool, false) \ _(UseWebRenderOptimizedShaders, bool, false) \ _(UseWebRenderScissoredCacheClears, bool, true) \ _(WebRenderProfilerUI, nsCString, nsCString()) \ diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp @@ -2614,6 +2614,23 @@ void gfxPlatform::InitWebRenderConfig() { if (gfxConfig::IsEnabled(Feature::WEBRENDER_SHADER_CACHE)) { gfxVars::SetUseWebRenderProgramBinaryDisk(true); + bool warmUp = true; +#ifdef MOZ_WIDGET_ANDROID + // Loading cached program binaries on the Samsung Xclipse driver on Android + // 14 is slightly faster than compiling shaders from source, so we still + // want to keep the disk cache enabled. However, it is slow enough that + // eagerly warming up the cache with shaders which may not be required can + // negatively impact performance. See bug 2007127. + if (jni::GetAPIVersion() == 34) { + const nsCOMPtr<nsIGfxInfo> gfxInfo = components::GfxInfo::Service(); + nsAutoString renderer; + gfxInfo->GetAdapterDeviceID(renderer); + if (renderer.Find(u"Samsung Xclipse") != -1) { + warmUp = false; + } + } +#endif + gfxVars::SetShouldWarmUpWebRenderProgramBinaries(warmUp); } gfxVars::SetUseWebRenderOptimizedShaders( diff --git a/gfx/webrender_bindings/RenderThread.cpp b/gfx/webrender_bindings/RenderThread.cpp @@ -1289,7 +1289,7 @@ void RenderThread::InitDeviceTask() { } void RenderThread::BeginShaderWarmupIfNeeded() { - if (mShaders) { + if (mShaders && gfx::gfxVars::ShouldWarmUpWebRenderProgramBinaries()) { PostResumeShaderWarmupRunnable(); } }