OSDN Git Service

SF: Prime shader cache before boot animation
authorDan Stoza <stoza@google.com>
Thu, 28 Jul 2016 20:31:51 +0000 (13:31 -0700)
committerDan Stoza <stoza@google.com>
Thu, 28 Jul 2016 20:31:51 +0000 (13:31 -0700)
Primes the shader cache before launching boot animation to avoid
janking when we eventually fall into GLES composition.

Bug: 30040263
Change-Id: I76ba66e92c5e6bb05930c325f384f3b774e91101

services/surfaceflinger/RenderEngine/RenderEngine.cpp
services/surfaceflinger/RenderEngine/RenderEngine.h
services/surfaceflinger/SurfaceFlinger.cpp
services/surfaceflinger/SurfaceFlinger_hwc1.cpp

index 27357b9..d6a032f 100644 (file)
@@ -436,6 +436,13 @@ EGLConfig RenderEngine::chooseEglConfig(EGLDisplay display, int format) {
     return config;
 }
 
+
+void RenderEngine::primeCache() const {
+    // Getting the ProgramCache instance causes it to prime its shader cache,
+    // which is performed in its constructor
+    ProgramCache::getInstance();
+}
+
 // ---------------------------------------------------------------------------
 }; // namespace android
 // ---------------------------------------------------------------------------
index 9cc1ed7..0259881 100644 (file)
@@ -63,6 +63,8 @@ public:
 
     static EGLConfig chooseEglConfig(EGLDisplay display, int format);
 
+    void primeCache() const;
+
     // dump the extension strings. always call the base class.
     virtual void dump(String8& result);
 
index e2bd19f..5a0f706 100644 (file)
@@ -509,6 +509,8 @@ void SurfaceFlinger::init() {
     // set initial conditions (e.g. unblank default device)
     initializeDisplays();
 
+    mRenderEngine->primeCache();
+
     // start boot animation
     startBootAnim();
 
index 6fe2358..b20868a 100644 (file)
@@ -538,6 +538,8 @@ void SurfaceFlinger::init() {
     // set initial conditions (e.g. unblank default device)
     initializeDisplays();
 
+    mRenderEngine->primeCache();
+
     // start boot animation
     startBootAnim();
 }