summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/Android.mk12
-rw-r--r--opengl/libs/GLES2/gl2.cpp14
-rw-r--r--opengl/libs/GLES_CM/gl.cpp14
3 files changed, 34 insertions, 6 deletions
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 9578452..6d20e80 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -32,6 +32,10 @@ ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
LOCAL_CFLAGS += -DADRENO130=1
endif
+ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
+ LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
+endif
+
include $(BUILD_SHARED_LIBRARY)
installed_libEGL := $(LOCAL_INSTALLED_MODULE)
@@ -78,6 +82,10 @@ LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv1\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
LOCAL_CFLAGS += -fvisibility=hidden
+ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
+ LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
+endif
+
include $(BUILD_SHARED_LIBRARY)
@@ -107,4 +115,8 @@ LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv2\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
LOCAL_CFLAGS += -fvisibility=hidden
+ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
+ LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
+endif
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index 4c0ba88..b8e3283 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -41,12 +41,20 @@ using namespace android;
#if USE_FAST_TLS_KEY
+ #ifdef HAVE_ARM_TLS_REGISTER
+ #define GET_TLS(reg) \
+ "mrc p15, 0, " #reg ", c13, c0, 3 \n"
+ #else
+ #define GET_TLS(reg) \
+ "mov " #reg ", #0xFFFF0FFF \n" \
+ "ldr " #reg ", [" #reg ", #-15] \n"
+ #endif
+
#define API_ENTRY(_api) __attribute__((naked)) _api
#define CALL_GL_API(_api, ...) \
asm volatile( \
- "mov r12, #0xFFFF0FFF \n" \
- "ldr r12, [r12, #-15] \n" \
+ GET_TLS(r12) \
"ldr r12, [r12, %[tls]] \n" \
"cmp r12, #0 \n" \
"ldrne pc, [r12, %[api]] \n" \
@@ -56,7 +64,7 @@ using namespace android;
[api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
: \
);
-
+
#define CALL_GL_API_RETURN(_api, ...) \
CALL_GL_API(_api, __VA_ARGS__) \
return 0; // placate gcc's warnings. never reached.
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 1e4c136..0c9352e 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -76,12 +76,20 @@ void glVertexPointerBounds(GLint size, GLenum type,
#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS
+ #ifdef HAVE_ARM_TLS_REGISTER
+ #define GET_TLS(reg) \
+ "mrc p15, 0, " #reg ", c13, c0, 3 \n"
+ #else
+ #define GET_TLS(reg) \
+ "mov " #reg ", #0xFFFF0FFF \n" \
+ "ldr " #reg ", [" #reg ", #-15] \n"
+ #endif
+
#define API_ENTRY(_api) __attribute__((naked)) _api
#define CALL_GL_API(_api, ...) \
asm volatile( \
- "mov r12, #0xFFFF0FFF \n" \
- "ldr r12, [r12, #-15] \n" \
+ GET_TLS(r12) \
"ldr r12, [r12, %[tls]] \n" \
"cmp r12, #0 \n" \
"ldrne pc, [r12, %[api]] \n" \
@@ -91,7 +99,7 @@ void glVertexPointerBounds(GLint size, GLenum type,
[api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
: \
);
-
+
#define CALL_GL_API_RETURN(_api, ...) \
CALL_GL_API(_api, __VA_ARGS__) \
return 0; // placate gcc's warnings. never reached.