Loading opengl/libs/EGL/Loader.cpp +12 −1 Original line number Original line Diff line number Diff line Loading @@ -175,6 +175,12 @@ Loader::~Loader() GLTrace_stop(); GLTrace_stop(); } } static void* load_wrapper(const char* path) { void* so = dlopen(path, RTLD_NOW | RTLD_LOCAL); ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror()); return so; } void* Loader::open(egl_connection_t* cnx) void* Loader::open(egl_connection_t* cnx) { { void* dso; void* dso; Loading @@ -201,6 +207,11 @@ void* Loader::open(egl_connection_t* cnx) "couldn't find the default OpenGL ES implementation " "couldn't find the default OpenGL ES implementation " "for default display"); "for default display"); cnx->libGles2 = load_wrapper("system/lib/libGLESv2.so"); cnx->libGles1 = load_wrapper("system/lib/libGLESv1_CM.so"); LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1, "couldn't load system OpenGL ES wrapper libraries"); return (void*)hnd; return (void*)hnd; } } Loading opengl/libs/EGL/eglApi.cpp +17 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include <dlfcn.h> #include <ctype.h> #include <ctype.h> #include <stdlib.h> #include <stdlib.h> #include <string.h> #include <string.h> Loading Loading @@ -777,6 +778,20 @@ EGLint eglGetError(void) return err; return err; } } static __eglMustCastToProperFunctionPointerType findBuiltinGLWrapper( const char* procname) { const egl_connection_t* cnx = &gEGLImpl; void* proc = NULL; proc = dlsym(cnx->libGles2, procname); if (proc) return (__eglMustCastToProperFunctionPointerType)proc; proc = dlsym(cnx->libGles1, procname); if (proc) return (__eglMustCastToProperFunctionPointerType)proc; return NULL; } __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) { { // eglGetProcAddress() could be the very first function called // eglGetProcAddress() could be the very first function called Loading @@ -798,6 +813,8 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) addr = findProcAddress(procname, sExtensionMap, NELEM(sExtensionMap)); addr = findProcAddress(procname, sExtensionMap, NELEM(sExtensionMap)); if (addr) return addr; if (addr) return addr; addr = findBuiltinGLWrapper(procname); if (addr) return addr; // this protects accesses to sGLExtentionMap and sGLExtentionSlot // this protects accesses to sGLExtentionMap and sGLExtentionSlot pthread_mutex_lock(&sExtensionMapMutex); pthread_mutex_lock(&sExtensionMapMutex); Loading opengl/libs/EGL/egldefs.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,9 @@ struct egl_connection_t { EGLint major; EGLint major; EGLint minor; EGLint minor; egl_t egl; egl_t egl; void* libGles1; void* libGles2; }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading Loading
opengl/libs/EGL/Loader.cpp +12 −1 Original line number Original line Diff line number Diff line Loading @@ -175,6 +175,12 @@ Loader::~Loader() GLTrace_stop(); GLTrace_stop(); } } static void* load_wrapper(const char* path) { void* so = dlopen(path, RTLD_NOW | RTLD_LOCAL); ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror()); return so; } void* Loader::open(egl_connection_t* cnx) void* Loader::open(egl_connection_t* cnx) { { void* dso; void* dso; Loading @@ -201,6 +207,11 @@ void* Loader::open(egl_connection_t* cnx) "couldn't find the default OpenGL ES implementation " "couldn't find the default OpenGL ES implementation " "for default display"); "for default display"); cnx->libGles2 = load_wrapper("system/lib/libGLESv2.so"); cnx->libGles1 = load_wrapper("system/lib/libGLESv1_CM.so"); LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1, "couldn't load system OpenGL ES wrapper libraries"); return (void*)hnd; return (void*)hnd; } } Loading
opengl/libs/EGL/eglApi.cpp +17 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS #define ATRACE_TAG ATRACE_TAG_GRAPHICS #include <dlfcn.h> #include <ctype.h> #include <ctype.h> #include <stdlib.h> #include <stdlib.h> #include <string.h> #include <string.h> Loading Loading @@ -777,6 +778,20 @@ EGLint eglGetError(void) return err; return err; } } static __eglMustCastToProperFunctionPointerType findBuiltinGLWrapper( const char* procname) { const egl_connection_t* cnx = &gEGLImpl; void* proc = NULL; proc = dlsym(cnx->libGles2, procname); if (proc) return (__eglMustCastToProperFunctionPointerType)proc; proc = dlsym(cnx->libGles1, procname); if (proc) return (__eglMustCastToProperFunctionPointerType)proc; return NULL; } __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) { { // eglGetProcAddress() could be the very first function called // eglGetProcAddress() could be the very first function called Loading @@ -798,6 +813,8 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) addr = findProcAddress(procname, sExtensionMap, NELEM(sExtensionMap)); addr = findProcAddress(procname, sExtensionMap, NELEM(sExtensionMap)); if (addr) return addr; if (addr) return addr; addr = findBuiltinGLWrapper(procname); if (addr) return addr; // this protects accesses to sGLExtentionMap and sGLExtentionSlot // this protects accesses to sGLExtentionMap and sGLExtentionSlot pthread_mutex_lock(&sExtensionMapMutex); pthread_mutex_lock(&sExtensionMapMutex); Loading
opengl/libs/EGL/egldefs.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,9 @@ struct egl_connection_t { EGLint major; EGLint major; EGLint minor; EGLint minor; egl_t egl; egl_t egl; void* libGles1; void* libGles2; }; }; // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- Loading