Make a GLESv1 only entries for GLESv1 driver loading
This change creates a separate entry list for initializing gles1 apis
from the driver. With this change, the gl driver loading time for one
particular device reduced from ~180ms to ~40ms.
Bug: b/117526831
Test: dEQP-EGL.* and systrace on multiple devices
Change-Id: Ic2f6f1b8f4cd8f17db64b6e288769e2d6a7859eb
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 1421a48..f8cfacb 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -273,6 +273,7 @@
void Loader::init_api(void* dso,
char const * const * api,
+ char const * const * ref_api,
__eglMustCastToProperFunctionPointerType* curr,
getProcAddressType getProcAddress)
{
@@ -282,6 +283,15 @@
char scrap[SIZE];
while (*api) {
char const * name = *api;
+ if (ref_api) {
+ char const * ref_name = *ref_api;
+ if (std::strcmp(name, ref_name) != 0) {
+ *curr++ = nullptr;
+ ref_api++;
+ continue;
+ }
+ }
+
__eglMustCastToProperFunctionPointerType f =
(__eglMustCastToProperFunctionPointerType)dlsym(dso, name);
if (f == nullptr) {
@@ -326,6 +336,7 @@
}
*curr++ = f;
api++;
+ if (ref_api) ref_api++;
}
}
@@ -648,14 +659,14 @@
}
if (mask & GLESv1_CM) {
- init_api(dso, gl_names,
+ init_api(dso, gl_names_1, gl_names,
(__eglMustCastToProperFunctionPointerType*)
&cnx->hooks[egl_connection_t::GLESv1_INDEX]->gl,
getProcAddress);
}
if (mask & GLESv2) {
- init_api(dso, gl_names,
+ init_api(dso, gl_names, nullptr,
(__eglMustCastToProperFunctionPointerType*)
&cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl,
getProcAddress);