Loading opengl/libs/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ LOCAL_SRC_FILES:= \ EGL/eglApi.cpp \ EGL/trace.cpp \ EGL/getProcAddress.cpp.arm \ EGL/hooks.cpp \ EGL/Loader.cpp \ # Loading opengl/libs/EGL/Loader.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -26,11 +26,10 @@ #include <EGL/egl.h> #include "egldefs.h" #include "glesv2dbg.h" #include "hooks.h" #include "egl_impl.h" #include "Loader.h" #include "glesv2dbg.h" // ---------------------------------------------------------------------------- namespace android { Loading opengl/libs/EGL/egl.cpp +66 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include <utils/String8.h> #include "egldefs.h" #include "egl_impl.h" #include "egl_tls.h" #include "glesv2dbg.h" Loading Loading @@ -278,6 +279,71 @@ EGLBoolean egl_init_drivers() { return res; } void gl_unimplemented() { LOGE("called unimplemented OpenGL ES API"); } // ---------------------------------------------------------------------------- #if USE_FAST_TLS_KEY // We have a dedicated TLS slot in bionic static inline gl_hooks_t const * volatile * get_tls_hooks() { volatile void *tls_base = __get_tls(); gl_hooks_t const * volatile * tls_hooks = reinterpret_cast<gl_hooks_t const * volatile *>(tls_base); return tls_hooks; } void setGlThreadSpecific(gl_hooks_t const *value) { gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); tls_hooks[TLS_SLOT_OPENGL_API] = value; } gl_hooks_t const* getGlThreadSpecific() { gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API]; if (hooks) return hooks; return &gHooksNoContext; } #else void setGlThreadSpecific(gl_hooks_t const *value) { pthread_setspecific(gGLWrapperKey, value); } gl_hooks_t const* getGlThreadSpecific() { gl_hooks_t const* hooks = static_cast<gl_hooks_t*>(pthread_getspecific(gGLWrapperKey)); if (hooks) return hooks; return &gHooksNoContext; } #endif // ---------------------------------------------------------------------------- // GL / EGL hooks // ---------------------------------------------------------------------------- #undef GL_ENTRY #undef EGL_ENTRY #define GL_ENTRY(_r, _api, ...) #_api, #define EGL_ENTRY(_r, _api, ...) #_api, char const * const gl_names[] = { #include "entries.in" NULL }; char const * const egl_names[] = { #include "egl_entries.in" NULL }; #undef GL_ENTRY #undef EGL_ENTRY // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- Loading opengl/libs/EGL/egl_display.h +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <utils/SortedVector.h> #include <utils/threads.h> #include "egldefs.h" #include "hooks.h" // ---------------------------------------------------------------------------- Loading opengl/libs/EGL/egl_tls.h +15 −0 Original line number Diff line number Diff line Loading @@ -21,7 +21,12 @@ #include <EGL/egl.h> #include "egldefs.h" #include "hooks.h" // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- class DbgContext; Loading Loading @@ -58,6 +63,16 @@ public: #define setError(_e, _r) egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r) // ---------------------------------------------------------------------------- #if EGL_TRACE extern gl_hooks_t const* getGLTraceThreadSpecific(); #endif // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- #endif // ANDROID_EGL_TLS_H Loading
opengl/libs/Android.mk +0 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ LOCAL_SRC_FILES:= \ EGL/eglApi.cpp \ EGL/trace.cpp \ EGL/getProcAddress.cpp.arm \ EGL/hooks.cpp \ EGL/Loader.cpp \ # Loading
opengl/libs/EGL/Loader.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -26,11 +26,10 @@ #include <EGL/egl.h> #include "egldefs.h" #include "glesv2dbg.h" #include "hooks.h" #include "egl_impl.h" #include "Loader.h" #include "glesv2dbg.h" // ---------------------------------------------------------------------------- namespace android { Loading
opengl/libs/EGL/egl.cpp +66 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include <utils/String8.h> #include "egldefs.h" #include "egl_impl.h" #include "egl_tls.h" #include "glesv2dbg.h" Loading Loading @@ -278,6 +279,71 @@ EGLBoolean egl_init_drivers() { return res; } void gl_unimplemented() { LOGE("called unimplemented OpenGL ES API"); } // ---------------------------------------------------------------------------- #if USE_FAST_TLS_KEY // We have a dedicated TLS slot in bionic static inline gl_hooks_t const * volatile * get_tls_hooks() { volatile void *tls_base = __get_tls(); gl_hooks_t const * volatile * tls_hooks = reinterpret_cast<gl_hooks_t const * volatile *>(tls_base); return tls_hooks; } void setGlThreadSpecific(gl_hooks_t const *value) { gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); tls_hooks[TLS_SLOT_OPENGL_API] = value; } gl_hooks_t const* getGlThreadSpecific() { gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API]; if (hooks) return hooks; return &gHooksNoContext; } #else void setGlThreadSpecific(gl_hooks_t const *value) { pthread_setspecific(gGLWrapperKey, value); } gl_hooks_t const* getGlThreadSpecific() { gl_hooks_t const* hooks = static_cast<gl_hooks_t*>(pthread_getspecific(gGLWrapperKey)); if (hooks) return hooks; return &gHooksNoContext; } #endif // ---------------------------------------------------------------------------- // GL / EGL hooks // ---------------------------------------------------------------------------- #undef GL_ENTRY #undef EGL_ENTRY #define GL_ENTRY(_r, _api, ...) #_api, #define EGL_ENTRY(_r, _api, ...) #_api, char const * const gl_names[] = { #include "entries.in" NULL }; char const * const egl_names[] = { #include "egl_entries.in" NULL }; #undef GL_ENTRY #undef EGL_ENTRY // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- Loading
opengl/libs/EGL/egl_display.h +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <utils/SortedVector.h> #include <utils/threads.h> #include "egldefs.h" #include "hooks.h" // ---------------------------------------------------------------------------- Loading
opengl/libs/EGL/egl_tls.h +15 −0 Original line number Diff line number Diff line Loading @@ -21,7 +21,12 @@ #include <EGL/egl.h> #include "egldefs.h" #include "hooks.h" // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- class DbgContext; Loading Loading @@ -58,6 +63,16 @@ public: #define setError(_e, _r) egl_tls_t::setErrorEtc(__FUNCTION__, __LINE__, _e, _r) // ---------------------------------------------------------------------------- #if EGL_TRACE extern gl_hooks_t const* getGLTraceThreadSpecific(); #endif // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- #endif // ANDROID_EGL_TLS_H