Add a system prop to control shader cache priming
Shader cache priming in surface flinger can take a significant amount of
time at system start, during which the device is basically stuck. Add a
system property to allow devices to disable shader cache priming if they
want.
Bug: 136204746
Test: Added logs locally to confirm setting the prop works as expected:
0 = don't do shader cache priming; any other value = do shader cache
priming. Default value is 1.
Change-Id: Iafd1823bcb6a96d69ca0bc7a4c0b847f8ceb9e77
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 99440a6..1c8cc35 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -703,7 +703,11 @@
// set initial conditions (e.g. unblank default device)
initializeDisplays();
- getRenderEngine().primeCache();
+ char primeShaderCache[PROPERTY_VALUE_MAX];
+ property_get("service.sf.prime_shader_cache", primeShaderCache, "1");
+ if (atoi(primeShaderCache)) {
+ getRenderEngine().primeCache();
+ }
// Inform native graphics APIs whether the present timestamp is supported: