summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2015-01-22 18:50:55 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-22 18:50:55 +0000
commit0cfe43a0ad9ee43590c4f181662dc0d7d91e384d (patch)
tree4d4d09c71f74d8477e39f87df6daf6988ef8c513 /opengl
parent471ec6b4284f645b5e933537fda88de867105fb2 (diff)
parentf551e1c1a59ae7ac906e2b204c3704d0dbf926a8 (diff)
downloadframeworks_native-0cfe43a0ad9ee43590c4f181662dc0d7d91e384d.tar.gz
frameworks_native-0cfe43a0ad9ee43590c4f181662dc0d7d91e384d.tar.bz2
frameworks_native-0cfe43a0ad9ee43590c4f181662dc0d7d91e384d.zip
am f551e1c1: Merge "[MIPS] Further opengl support for mips64 and mipsr6"
* commit 'f551e1c1a59ae7ac906e2b204c3704d0dbf926a8': [MIPS] Further opengl support for mips64 and mipsr6
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libs/EGL/getProcAddress.cpp41
-rw-r--r--opengl/libs/GLES2/gl2.cpp44
-rw-r--r--opengl/libs/GLES_CM/gl.cpp44
3 files changed, 115 insertions, 14 deletions
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index dcac2b207..25cffaec9 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -120,6 +120,38 @@ namespace android {
: "cc" \
);
+#elif defined(__mips64)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_EXTENSION_API(_api, ...) \
+ register unsigned int _t0 asm("t0"); \
+ register unsigned int _fn asm("t1"); \
+ register unsigned int _tls asm("v1"); \
+ asm volatile( \
+ ".set push\n\t" \
+ ".set noreorder\n\t" \
+ "rdhwr %[tls], $29\n\t" \
+ "ld %[t0], %[OPENGL_API](%[tls])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " move %[fn], $ra\n\t" \
+ "ld %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
+ "1:\n\t" \
+ "jalr $0, %[fn]\n\t" \
+ " nop\n\t" \
+ ".set pop\n\t" \
+ : [fn] "=c"(_fn), \
+ [tls] "=&r"(_tls), \
+ [t0] "=&r"(_t0) \
+ : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*4), \
+ [API] "I"(__builtin_offsetof(gl_hooks_t, \
+ ext.extensions[_api])) \
+ : \
+ );
+
#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
@@ -131,15 +163,16 @@ namespace android {
asm volatile( \
".set push\n\t" \
".set noreorder\n\t" \
- ".set mips32r2\n\t" \
"rdhwr %[tls], $29\n\t" \
"lw %[t0], %[OPENGL_API](%[tls])\n\t" \
"beqz %[t0], 1f\n\t" \
" move %[fn], $ra\n\t" \
- "lw %[fn], %[API](%[t0])\n\t" \
- "movz %[fn], $ra, %[fn]\n\t" \
+ "lw %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
"1:\n\t" \
- "j %[fn]\n\t" \
+ "jalr $0, %[fn]\n\t" \
" nop\n\t" \
".set pop\n\t" \
: [fn] "=c"(_fn), \
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index 0fb8965f8..dfd19f209 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -118,27 +118,61 @@ using namespace android;
: "cc" \
);
+#elif defined(__mips64)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_API(_api, ...) \
+ register unsigned long _t0 asm("t0"); \
+ register unsigned long _fn asm("t9"); \
+ register unsigned long _tls asm("v1"); \
+ register unsigned long _v0 asm("v0"); \
+ asm volatile( \
+ ".set push\n\t" \
+ ".set noreorder\n\t" \
+ "rdhwr %[tls], $29\n\t" \
+ "ld %[t0], %[OPENGL_API](%[tls])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " move %[fn], $ra\n\t" \
+ "ld %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
+ "1:\n\t" \
+ "jalr $0, %[fn]\n\t" \
+ " move %[v0], $0\n\t" \
+ ".set pop\n\t" \
+ : [fn] "=c"(_fn), \
+ [tls] "=&r"(_tls), \
+ [t0] "=&r"(_t0), \
+ [v0] "=&r"(_v0) \
+ : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*sizeof(void*)),\
+ [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : \
+ );
+
#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
#define CALL_GL_API(_api, ...) \
register unsigned int _t0 asm("t0"); \
- register unsigned int _fn asm("t1"); \
+ register unsigned int _fn asm("t9"); \
register unsigned int _tls asm("v1"); \
register unsigned int _v0 asm("v0"); \
asm volatile( \
".set push\n\t" \
".set noreorder\n\t" \
- ".set mips32r2\n\t" \
"rdhwr %[tls], $29\n\t" \
"lw %[t0], %[OPENGL_API](%[tls])\n\t" \
"beqz %[t0], 1f\n\t" \
" move %[fn],$ra\n\t" \
- "lw %[fn], %[API](%[t0])\n\t" \
- "movz %[fn], $ra, %[fn]\n\t" \
+ "lw %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
"1:\n\t" \
- "j %[fn]\n\t" \
+ "jalr $0, %[fn]\n\t" \
" move %[v0], $0\n\t" \
".set pop\n\t" \
: [fn] "=c"(_fn), \
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 7896a6f1c..1297ac47a 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -174,27 +174,61 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
: "cc" \
);
+#elif defined(__mips64)
+
+ #define API_ENTRY(_api) __attribute__((noinline)) _api
+
+ #define CALL_GL_API(_api, ...) \
+ register unsigned long _t0 asm("t0"); \
+ register unsigned long _fn asm("t9"); \
+ register unsigned long _tls asm("v1"); \
+ register unsigned long _v0 asm("v0"); \
+ asm volatile( \
+ ".set push\n\t" \
+ ".set noreorder\n\t" \
+ "rdhwr %[tls], $29\n\t" \
+ "ld %[t0], %[OPENGL_API](%[tls])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " move %[fn], $ra\n\t" \
+ "ld %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
+ "1:\n\t" \
+ "jalr $0, %[fn]\n\t" \
+ " move %[v0], $0\n\t" \
+ ".set pop\n\t" \
+ : [fn] "=c"(_fn), \
+ [tls] "=&r"(_tls), \
+ [t0] "=&r"(_t0), \
+ [v0] "=&r"(_v0) \
+ : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*sizeof(void*)),\
+ [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : \
+ );
+
#elif defined(__mips__)
#define API_ENTRY(_api) __attribute__((noinline)) _api
#define CALL_GL_API(_api, ...) \
register unsigned int _t0 asm("t0"); \
- register unsigned int _fn asm("t1"); \
+ register unsigned int _fn asm("t9"); \
register unsigned int _tls asm("v1"); \
register unsigned int _v0 asm("v0"); \
asm volatile( \
".set push\n\t" \
".set noreorder\n\t" \
- ".set mips32r2\n\t" \
"rdhwr %[tls], $29\n\t" \
"lw %[t0], %[OPENGL_API](%[tls])\n\t" \
"beqz %[t0], 1f\n\t" \
" move %[fn], $ra\n\t" \
- "lw %[fn], %[API](%[t0])\n\t" \
- "movz %[fn], $ra, %[fn]\n\t" \
+ "lw %[t0], %[API](%[t0])\n\t" \
+ "beqz %[t0], 1f\n\t" \
+ " nop\n\t" \
+ "move %[fn], %[t0]\n\t" \
"1:\n\t" \
- "j %[fn]\n\t" \
+ "jalr $0, %[fn]\n\t" \
" move %[v0], $0\n\t" \
".set pop\n\t" \
: [fn] "=c"(_fn), \