opengl: defer GLESV1 library loading until context creation time
Test: boot and run GLESV1 test app
Bug: b/147019446
Change-Id: Ia3925a96c745d9bbb966b0e3bda9f0a1332e2a14
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 25b1009..768d3b5 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -202,6 +202,15 @@
return cnx->dso ? EGL_TRUE : EGL_FALSE;
}
+static EGLBoolean egl_init_glesv1_drivers_locked() {
+ // get our driver loader
+ Loader& loader(Loader::getInstance());
+
+ // dynamically load our GLESV1 implementation
+ egl_connection_t* cnx = &gEGLImpl;
+ return loader.load_glesv1_driver(cnx);
+}
+
static pthread_mutex_t sInitDriverMutex = PTHREAD_MUTEX_INITIALIZER;
EGLBoolean egl_init_drivers() {
@@ -212,6 +221,14 @@
return res;
}
+EGLBoolean egl_init_glesv1_drivers() {
+ EGLBoolean res;
+ pthread_mutex_lock(&sInitDriverMutex);
+ res = egl_init_glesv1_drivers_locked();
+ pthread_mutex_unlock(&sInitDriverMutex);
+ return res;
+}
+
static pthread_mutex_t sLogPrintMutex = PTHREAD_MUTEX_INITIALIZER;
static std::chrono::steady_clock::time_point sLogPrintTime;
static constexpr std::chrono::seconds DURATION(1);