summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2014-05-30 23:32:12 -0700
committerJesse Hall <jessehall@google.com>2014-06-06 16:31:53 -0700
commit30a41aa1ccc47de41642308a243fa5df2bfeec06 (patch)
treee8c137e767954a917f5c2323c470c7e88f49cb76 /opengl
parente86420e399993e0f49e5d7733b5fc87eb9fe179b (diff)
downloadframeworks_native-30a41aa1ccc47de41642308a243fa5df2bfeec06.zip
frameworks_native-30a41aa1ccc47de41642308a243fa5df2bfeec06.tar.gz
frameworks_native-30a41aa1ccc47de41642308a243fa5df2bfeec06.tar.bz2
Add aarch64 EGL/GLES trampolines
Change-Id: Ia90e18d26ff3bdb7e643aff8d77cbaddd2ac2a03
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/getProcAddress.cpp22
-rw-r--r--opengl/libs/GLES2/gl2.cpp44
-rw-r--r--opengl/libs/GLES_CM/gl.cpp44
3 files changed, 83 insertions, 27 deletions
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index 5470d81..fc61134 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -53,9 +53,29 @@ namespace android {
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
[api] "J"(__builtin_offsetof(gl_hooks_t, \
ext.extensions[_api])) \
- : \
+ : "r12" \
);
+#elif defined(__aarch64__)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_EXTENSION_API(_api) \
+ asm volatile( \
+ "mrs x16, tpidr_el0\n" \
+ "ldr x16, [x16, %[tls]]\n" \
+ "cbz x16, 1f\n" \
+ "ldr x16, [x16, %[api]]\n" \
+ "cbz x16, 1f\n" \
+ "br x16\n" \
+ "1:\n" \
+ : \
+ : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \
+ [api] "i" (__builtin_offsetof(gl_hooks_t, \
+ ext.extensions[_api])) \
+ : "x16" \
+ );
+
#elif defined(__i386__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index ab6fb51..e112fec 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -40,7 +40,15 @@ using namespace android;
#undef CALL_GL_API
#undef CALL_GL_API_RETURN
-#if defined(__arm__) && !USE_SLOW_BINDING
+#if USE_SLOW_BINDING
+
+ #define API_ENTRY(_api) _api
+
+ #define CALL_GL_API(_api, ...) \
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
+ if (_c) return _c->_api(__VA_ARGS__);
+
+#elif defined(__arm__)
#define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
@@ -55,10 +63,28 @@ using namespace android;
: \
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
[api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
- : \
+ : "r12" \
);
-#elif defined(__i386__) && !USE_SLOW_BINDING
+#elif defined(__aarch64__)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_API(_api, ...) \
+ asm volatile( \
+ "mrs x16, tpidr_el0\n" \
+ "ldr x16, [x16, %[tls]]\n" \
+ "cbz x16, 1f\n" \
+ "ldr x16, [x16, %[api]]\n" \
+ "br x16\n" \
+ "1:\n" \
+ : \
+ : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \
+ [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : "x16" \
+ );
+
+#elif defined(__i386__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -77,7 +103,7 @@ using namespace android;
: "cc" \
);
-#elif defined(__x86_64__) && !USE_SLOW_BINDING
+#elif defined(__x86_64__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -96,7 +122,7 @@ using namespace android;
: "cc" \
);
-#elif defined(__mips__) && !USE_SLOW_BINDING
+#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -128,14 +154,6 @@ using namespace android;
: \
);
-#else
-
- #define API_ENTRY(_api) _api
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- if (_c) return _c->_api(__VA_ARGS__);
-
#endif
#define CALL_GL_API_RETURN(_api, ...) \
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 5873391..71fbed1 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -92,7 +92,15 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
#undef CALL_GL_API
#undef CALL_GL_API_RETURN
-#if defined(__arm__) && !USE_SLOW_BINDING
+#if USE_SLOW_BINDING
+
+ #define API_ENTRY(_api) _api
+
+ #define CALL_GL_API(_api, ...) \
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
+ if (_c) return _c->_api(__VA_ARGS__);
+
+#elif defined(__arm__)
#define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
@@ -107,10 +115,28 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
: \
: [tls] "J"(TLS_SLOT_OPENGL_API*4), \
[api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \
- : \
+ : "r12" \
);
-#elif defined(__i386__) && !USE_SLOW_BINDING
+#elif defined(__aarch64__)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_API(_api, ...) \
+ asm volatile( \
+ "mrs x16, tpidr_el0\n" \
+ "ldr x16, [x16, %[tls]]\n" \
+ "cbz x16, 1f\n" \
+ "ldr x16, [x16, %[api]]\n" \
+ "br x16\n" \
+ "1:\n" \
+ : \
+ : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \
+ [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : "x16" \
+ );
+
+#elif defined(__i386__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -129,7 +155,7 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
: "cc" \
);
-#elif defined(__x86_64__) && !USE_SLOW_BINDING
+#elif defined(__x86_64__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -148,7 +174,7 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
: "cc" \
);
-#elif defined(__mips__) && !USE_SLOW_BINDING
+#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -180,14 +206,6 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
: \
);
-#else
-
- #define API_ENTRY(_api) _api
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- if (_c) return _c->_api(__VA_ARGS__);
-
#endif
#define CALL_GL_API_RETURN(_api, ...) \