Created
May 25, 2017 10:19
-
-
Save neochapay/afeb73f2ee89c88fc16a6cfe35b5cfd8 to your computer and use it in GitHub Desktop.
Android/frameworks/native patch for hybris
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk | |
index cc5d544..00b1a56 100644 | |
--- a/opengl/libs/Android.mk | |
+++ b/opengl/libs/Android.mk | |
@@ -32,7 +32,7 @@ LOCAL_SRC_FILES:= \ | |
EGL/Loader.cpp \ | |
# | |
-LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libGLES_trace | |
+LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libGLES_trace libdsyscalls | |
LOCAL_MODULE:= libEGL | |
LOCAL_LDFLAGS += -Wl,--exclude-libs=ALL | |
LOCAL_SHARED_LIBRARIES += libdl | |
@@ -77,7 +77,7 @@ LOCAL_SRC_FILES:= \ | |
GLES_CM/gl.cpp.arm \ | |
# | |
-LOCAL_SHARED_LIBRARIES += libcutils liblog libEGL | |
+LOCAL_SHARED_LIBRARIES += libcutils liblog libEGL libdsyscalls | |
LOCAL_MODULE:= libGLESv1_CM | |
LOCAL_SHARED_LIBRARIES += libdl | |
@@ -101,7 +101,7 @@ LOCAL_SRC_FILES:= \ | |
GLES2/gl2.cpp.arm \ | |
# | |
-LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libEGL | |
+LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libEGL libdsyscalls | |
LOCAL_MODULE:= libGLESv2 | |
LOCAL_SHARED_LIBRARIES += libdl | |
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp | |
index 1fcc048..5d9c595 100644 | |
--- a/opengl/libs/EGL/Loader.cpp | |
+++ b/opengl/libs/EGL/Loader.cpp | |
@@ -192,9 +192,9 @@ void* Loader::open(egl_connection_t* cnx) | |
cnx->libGles2 = load_wrapper("/system/lib64/libGLESv2.so"); | |
cnx->libGles1 = load_wrapper("/system/lib64/libGLESv1_CM.so"); | |
#else | |
- cnx->libEgl = load_wrapper("/system/lib/libEGL.so"); | |
- cnx->libGles2 = load_wrapper("/system/lib/libGLESv2.so"); | |
- cnx->libGles1 = load_wrapper("/system/lib/libGLESv1_CM.so"); | |
+ cnx->libEgl = load_wrapper("libEGL.so"); | |
+ cnx->libGles2 = load_wrapper("libGLESv2.so"); | |
+ cnx->libGles1 = load_wrapper("libGLESv1_CM.so"); | |
#endif | |
LOG_ALWAYS_FATAL_IF(!cnx->libEgl, | |
"couldn't load system EGL wrapper libraries"); | |
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp | |
index 7c70fa0..2ae46ba 100644 | |
--- a/opengl/libs/EGL/egl.cpp | |
+++ b/opengl/libs/EGL/egl.cpp | |
@@ -359,7 +359,7 @@ void gl_noop() { | |
// ---------------------------------------------------------------------------- | |
void setGlThreadSpecific(gl_hooks_t const *value) { | |
- gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); | |
+ gl_hooks_t const * volatile * tls_hooks = __get_tls_hooks(); | |
tls_hooks[TLS_SLOT_OPENGL_API] = value; | |
} | |
diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h | |
index 3f36b7d..4516826 100644 | |
--- a/opengl/libs/hooks.h | |
+++ b/opengl/libs/hooks.h | |
@@ -33,7 +33,7 @@ | |
#include <GLES3/gl31.h> | |
// set to 1 for debugging | |
-#define USE_SLOW_BINDING 0 | |
+#define USE_SLOW_BINDING 1 | |
#undef NELEM | |
#define NELEM(x) (sizeof(x)/sizeof(*(x))) | |
@@ -75,16 +75,10 @@ struct gl_hooks_t { | |
EGLAPI void setGlThreadSpecific(gl_hooks_t const *value); | |
-// We have a dedicated TLS slot in bionic | |
-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; | |
-} | |
+extern "C" gl_hooks_t const **__get_tls_hooks(); | |
inline EGLAPI gl_hooks_t const* getGlThreadSpecific() { | |
- gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); | |
+ gl_hooks_t const ** tls_hooks = __get_tls_hooks(); | |
gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API]; | |
return hooks; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment