summaryrefslogtreecommitdiffstats
path: root/opengl/libs
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/libs')
-rw-r--r--opengl/libs/Android.mk29
-rw-r--r--opengl/libs/EGL/egl.cpp54
-rw-r--r--opengl/libs/EGL/eglApi.cpp101
-rw-r--r--opengl/libs/EGL/egl_cache.cpp6
-rw-r--r--opengl/libs/EGL/egl_display.cpp15
-rw-r--r--opengl/libs/EGL/egl_entries.in2
-rw-r--r--opengl/libs/EGL/getProcAddress.cpp46
-rw-r--r--opengl/libs/EGL/trace.cpp103
-rw-r--r--opengl/libs/GLES2/gl2.cpp65
-rw-r--r--opengl/libs/GLES2/gl2_api.in4
-rw-r--r--opengl/libs/GLES_CM/gl.cpp47
-rw-r--r--opengl/libs/GLES_trace/Android.mk9
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_api.cpp8
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_api.h4
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_context.cpp12
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_context.h4
-rw-r--r--opengl/libs/GLES_trace/src/gltrace_fixup.cpp15
-rw-r--r--opengl/libs/entries.in4
-rw-r--r--opengl/libs/hooks.h2
-rw-r--r--opengl/libs/trace.in4
20 files changed, 430 insertions, 104 deletions
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 42aaa24..d025ae8 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -23,11 +23,6 @@ LOCAL_LDLIBS := -lpthread -ldl
LOCAL_MODULE:= libEGL
LOCAL_LDFLAGS += -Wl,--exclude-libs=ALL
LOCAL_SHARED_LIBRARIES += libdl
-# Bionic's private TLS header relies on the ARCH_ARM_HAVE_TLS_REGISTER to
-# select the appropriate TLS codepath
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
# we need to access the private Bionic header <bionic_tls.h>
LOCAL_C_INCLUDES += bionic/libc/private
@@ -49,14 +44,14 @@ ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
LOCAL_CFLAGS += -DSYSTEMUI_PBSIZE_HACK=1
endif
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-
ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE)
endif
+ifneq ($(MAX_EGL_CACHE_KEY_SIZE),)
+ LOCAL_CFLAGS += -DMAX_EGL_CACHE_KEY_SIZE=$(MAX_EGL_CACHE_KEY_SIZE)
+endif
+
ifneq ($(MAX_EGL_CACHE_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
endif
@@ -96,19 +91,12 @@ LOCAL_MODULE:= libGLESv1_CM
LOCAL_SHARED_LIBRARIES += libdl
# we need to access the private Bionic header <bionic_tls.h>
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
LOCAL_C_INCLUDES += bionic/libc/private
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)
@@ -122,25 +110,18 @@ LOCAL_SRC_FILES:= \
GLES2/gl2.cpp.arm \
#
-LOCAL_SHARED_LIBRARIES += libcutils libEGL
+LOCAL_SHARED_LIBRARIES += libcutils libutils libEGL
LOCAL_LDLIBS := -lpthread -ldl
LOCAL_MODULE:= libGLESv2
LOCAL_SHARED_LIBRARIES += libdl
# we need to access the private Bionic header <bionic_tls.h>
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
LOCAL_C_INCLUDES += bionic/libc/private
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/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index b658240..0d4bed5 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -62,12 +62,18 @@ EGLAPI pthread_key_t gGLTraceKey = -1;
// ----------------------------------------------------------------------------
/**
- * There are two different tracing methods:
- * 1. libs/EGL/trace.cpp: Traces all functions to logcat.
+ * There are three different tracing methods:
+ * 1. libs/EGL/trace.cpp: Traces all functions to systrace.
+ * To enable:
+ * - set system property "debug.egl.trace" to "systrace" to trace all apps.
+ * 2. libs/EGL/trace.cpp: Logs a stack trace for GL errors after each function call.
+ * To enable:
+ * - set system property "debug.egl.trace" to "error" to trace all apps.
+ * 3. libs/EGL/trace.cpp: Traces all functions to logcat.
* To enable:
* - set system property "debug.egl.trace" to 1 to trace all apps.
* - or call setGLTraceLevel(1) from an app to enable tracing for that app.
- * 2. libs/GLES_trace: Traces all functions via protobuf to host.
+ * 4. libs/GLES_trace: Traces all functions via protobuf to host.
* To enable:
* - set system property "debug.egl.debug_proc" to the application name.
* - or call setGLDebugLevel(1) from the app.
@@ -75,10 +81,15 @@ EGLAPI pthread_key_t gGLTraceKey = -1;
static int sEGLTraceLevel;
static int sEGLApplicationTraceLevel;
+static bool sEGLSystraceEnabled;
+static bool sEGLGetErrorEnabled;
+
int gEGLDebugLevel;
static int sEGLApplicationDebugLevel;
extern gl_hooks_t gHooksTrace;
+extern gl_hooks_t gHooksSystrace;
+extern gl_hooks_t gHooksErrorTrace;
static inline void setGlTraceThreadSpecific(gl_hooks_t const *value) {
pthread_setspecific(gGLTraceKey, value);
@@ -91,6 +102,20 @@ gl_hooks_t const* getGLTraceThreadSpecific() {
void initEglTraceLevel() {
char value[PROPERTY_VALUE_MAX];
property_get("debug.egl.trace", value, "0");
+
+ sEGLGetErrorEnabled = !strcasecmp(value, "error");
+ if (sEGLGetErrorEnabled) {
+ sEGLSystraceEnabled = false;
+ sEGLTraceLevel = 0;
+ return;
+ }
+
+ sEGLSystraceEnabled = !strcasecmp(value, "systrace");
+ if (sEGLSystraceEnabled) {
+ sEGLTraceLevel = 0;
+ return;
+ }
+
int propertyLevel = atoi(value);
int applicationLevel = sEGLApplicationTraceLevel;
sEGLTraceLevel = propertyLevel > applicationLevel ? propertyLevel : applicationLevel;
@@ -99,6 +124,12 @@ void initEglTraceLevel() {
void initEglDebugLevel() {
int propertyLevel = 0;
char value[PROPERTY_VALUE_MAX];
+
+ // check system property only on userdebug or eng builds
+ property_get("ro.debuggable", value, "0");
+ if (value[0] == '0')
+ return;
+
property_get("debug.egl.debug_proc", value, "");
if (strlen(value) > 0) {
long pid = getpid();
@@ -125,7 +156,13 @@ void initEglDebugLevel() {
}
void setGLHooksThreadSpecific(gl_hooks_t const *value) {
- if (sEGLTraceLevel > 0) {
+ if (sEGLGetErrorEnabled) {
+ setGlTraceThreadSpecific(value);
+ setGlThreadSpecific(&gHooksErrorTrace);
+ } else if (sEGLSystraceEnabled) {
+ setGlTraceThreadSpecific(value);
+ setGlThreadSpecific(&gHooksSystrace);
+ } else if (sEGLTraceLevel > 0) {
setGlTraceThreadSpecific(value);
setGlThreadSpecific(&gHooksTrace);
} else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) {
@@ -166,8 +203,13 @@ void setGLHooksThreadSpecific(gl_hooks_t const *value) {
static int gl_no_context() {
if (egl_tls_t::logNoContextCall()) {
- ALOGE("call to OpenGL ES API with no current context "
- "(logged once per thread)");
+ char const* const error = "call to OpenGL ES API with "
+ "no current context (logged once per thread)";
+ if (LOG_NDEBUG) {
+ ALOGE(error);
+ } else {
+ LOG_ALWAYS_FATAL(error);
+ }
char value[PROPERTY_VALUE_MAX];
property_get("debug.egl.callstack", value, "0");
if (atoi(value)) {
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index c943ec1..c25612d 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -204,6 +204,59 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso) {
+ if (attrib_list) {
+ char value[PROPERTY_VALUE_MAX];
+ property_get("debug.egl.force_msaa", value, "false");
+
+ if (!strcmp(value, "true")) {
+ size_t attribCount = 0;
+ EGLint attrib = attrib_list[0];
+
+ // Only enable MSAA if the context is OpenGL ES 2.0 and
+ // if no caveat is requested
+ const EGLint *attribRendererable = NULL;
+ const EGLint *attribCaveat = NULL;
+
+ // Count the number of attributes and look for
+ // EGL_RENDERABLE_TYPE and EGL_CONFIG_CAVEAT
+ while (attrib != EGL_NONE) {
+ attrib = attrib_list[attribCount];
+ switch (attrib) {
+ case EGL_RENDERABLE_TYPE:
+ attribRendererable = &attrib_list[attribCount];
+ break;
+ case EGL_CONFIG_CAVEAT:
+ attribCaveat = &attrib_list[attribCount];
+ break;
+ }
+ attribCount++;
+ }
+
+ if (attribRendererable && attribRendererable[1] == EGL_OPENGL_ES2_BIT &&
+ (!attribCaveat || attribCaveat[1] != EGL_NONE)) {
+
+ // Insert 2 extra attributes to force-enable MSAA 4x
+ EGLint aaAttribs[attribCount + 4];
+ aaAttribs[0] = EGL_SAMPLE_BUFFERS;
+ aaAttribs[1] = 1;
+ aaAttribs[2] = EGL_SAMPLES;
+ aaAttribs[3] = 4;
+
+ memcpy(&aaAttribs[4], attrib_list, attribCount * sizeof(EGLint));
+
+ EGLint numConfigAA;
+ EGLBoolean resAA = cnx->egl.eglChooseConfig(
+ dp->disp.dpy, aaAttribs, configs, config_size, &numConfigAA);
+
+ if (resAA == EGL_TRUE && numConfigAA > 0) {
+ ALOGD("Enabling MSAA 4x");
+ *num_config = numConfigAA;
+ return resAA;
+ }
+ }
+ }
+ }
+
res = cnx->egl.eglChooseConfig(
dp->disp.dpy, attrib_list, configs, config_size, num_config);
}
@@ -419,6 +472,12 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
GLTrace_eglCreateContext(version, c);
#endif
return c;
+ } else {
+ EGLint error = eglGetError();
+ ALOGE_IF(error == EGL_SUCCESS,
+ "eglCreateContext(%p, %p, %p, %p) returned EGL_NO_CONTEXT "
+ "but no EGL error!",
+ dpy, config, share_list, attrib_list);
}
}
return EGL_NO_CONTEXT;
@@ -657,6 +716,8 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
// These extensions should not be exposed to applications. They're used
// internally by the Android EGL layer.
if (!strcmp(procname, "eglSetBlobCacheFuncsANDROID") ||
+ !strcmp(procname, "eglDupNativeFenceFDANDROID") ||
+ !strcmp(procname, "eglWaitSyncANDROID") ||
!strcmp(procname, "eglHibernateProcessIMG") ||
!strcmp(procname, "eglAwakenProcessIMG")) {
return NULL;
@@ -704,8 +765,8 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglGetProcAddress) {
- found = true;
// Extensions are independent of the bound context
+ addr =
cnx->hooks[egl_connection_t::GLESv1_INDEX]->ext.extensions[slot] =
cnx->hooks[egl_connection_t::GLESv2_INDEX]->ext.extensions[slot] =
#if EGL_TRACE
@@ -713,10 +774,13 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
gHooksTrace.ext.extensions[slot] =
#endif
cnx->egl.eglGetProcAddress(procname);
+ if (addr) found = true;
}
if (found) {
+#if USE_FAST_TLS_KEY
addr = gExtensionForwarders[slot];
+#endif
sGLExtentionMap.add(name, addr);
sGLExtentionSlot++;
}
@@ -1115,11 +1179,12 @@ EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
const egl_display_ptr dp = validate_display(dpy);
if (!dp) return EGL_FALSE;
+ EGLBoolean result = EGL_FALSE;
egl_connection_t* const cnx = &gEGLImpl;
if (cnx->dso && cnx->egl.eglDestroyImageKHR) {
- cnx->egl.eglDestroyImageKHR(dp->disp.dpy, img);
+ result = cnx->egl.eglDestroyImageKHR(dp->disp.dpy, img);
}
- return EGL_TRUE;
+ return result;
}
// ----------------------------------------------------------------------------
@@ -1195,7 +1260,35 @@ EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync,
// ANDROID extensions
// ----------------------------------------------------------------------------
-/* ANDROID extensions entry-point go here */
+EGLint eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_NO_NATIVE_FENCE_FD_ANDROID;
+
+ EGLint result = EGL_NO_NATIVE_FENCE_FD_ANDROID;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglDupNativeFenceFDANDROID) {
+ result = cnx->egl.eglDupNativeFenceFDANDROID(dp->disp.dpy, sync);
+ }
+ return result;
+}
+
+EGLint eglWaitSyncANDROID(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_NO_NATIVE_FENCE_FD_ANDROID;
+
+ EGLint result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglWaitSyncANDROID) {
+ result = cnx->egl.eglWaitSyncANDROID(dp->disp.dpy, sync, flags);
+ }
+ return result;
+}
// ----------------------------------------------------------------------------
// NVIDIA extensions
diff --git a/opengl/libs/EGL/egl_cache.cpp b/opengl/libs/EGL/egl_cache.cpp
index ed2bef3..72655df 100644
--- a/opengl/libs/EGL/egl_cache.cpp
+++ b/opengl/libs/EGL/egl_cache.cpp
@@ -29,12 +29,16 @@
#define MAX_EGL_CACHE_ENTRY_SIZE (16 * 1024);
#endif
+#ifndef MAX_EGL_CACHE_KEY_SIZE
+#define MAX_EGL_CACHE_KEY_SIZE (1024);
+#endif
+
#ifndef MAX_EGL_CACHE_SIZE
#define MAX_EGL_CACHE_SIZE (64 * 1024);
#endif
// Cache size limits.
-static const size_t maxKeySize = 1024;
+static const size_t maxKeySize = MAX_EGL_CACHE_KEY_SIZE;
static const size_t maxValueSize = MAX_EGL_CACHE_ENTRY_SIZE;
static const size_t maxTotalSize = MAX_EGL_CACHE_SIZE;
diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp
index a46aa38..7ca9e40 100644
--- a/opengl/libs/EGL/egl_display.cpp
+++ b/opengl/libs/EGL/egl_display.cpp
@@ -52,13 +52,16 @@ static char const * const sExtensionString =
"EGL_KHR_gl_texture_cubemap_image "
"EGL_KHR_gl_renderbuffer_image "
"EGL_KHR_fence_sync "
+ "EGL_EXT_create_context_robustness "
"EGL_NV_system_time "
"EGL_ANDROID_image_native_buffer " // mandatory
;
// extensions not exposed to applications but used by the ANDROID system
// "EGL_ANDROID_recordable " // mandatory
+// "EGL_ANDROID_framebuffer_target " // mandatory for HWC 1.1
// "EGL_ANDROID_blob_cache " // strongly recommended
+// "EGL_ANDROID_native_fence_sync " // strongly recommended
// "EGL_IMG_hibernate_process " // optional
extern void initEglTraceLevel();
@@ -263,7 +266,13 @@ EGLBoolean egl_display_t::terminate() {
Mutex::Autolock _l(lock);
if (refs == 0) {
- return setError(EGL_NOT_INITIALIZED, EGL_FALSE);
+ /*
+ * From the EGL spec (3.2):
+ * "Termination of a display that has already been terminated,
+ * (...), is allowed, but the only effect of such a call is
+ * to return EGL_TRUE (...)
+ */
+ return EGL_TRUE;
}
// this is specific to Android, display termination is ref-counted.
@@ -286,6 +295,10 @@ EGLBoolean egl_display_t::terminate() {
mHibernation.setDisplayValid(false);
+ // Reset the extension string since it will be regenerated if we get
+ // reinitialized.
+ mExtensionString.setTo("");
+
// Mark all objects remaining in the list as terminated, unless
// there are no reference to them, it which case, we're free to
// delete them.
diff --git a/opengl/libs/EGL/egl_entries.in b/opengl/libs/EGL/egl_entries.in
index 9feb716..2ffd417 100644
--- a/opengl/libs/EGL/egl_entries.in
+++ b/opengl/libs/EGL/egl_entries.in
@@ -62,6 +62,8 @@ EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint,
EGL_ENTRY(EGLBoolean, eglSetSwapRectangleANDROID, EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint)
EGL_ENTRY(EGLClientBuffer, eglGetRenderBufferANDROID, EGLDisplay, EGLSurface)
+EGL_ENTRY(EGLint, eglDupNativeFenceFDANDROID, EGLDisplay, EGLSyncKHR)
+EGL_ENTRY(EGLint, eglWaitSyncANDROID, EGLDisplay, EGLSyncKHR, EGLint)
/* NVIDIA extensions */
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index 8dcf38d..d23da7a 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -37,14 +37,9 @@ 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
+ #if defined(__arm__)
+
+ #define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
#define API_ENTRY(_api) __attribute__((naked)) _api
@@ -64,6 +59,41 @@ namespace android {
: \
);
+ #elif defined(__mips__)
+
+ #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" \
+ ".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" \
+ "1:\n\t" \
+ "j %[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])) \
+ : \
+ );
+
+ #else
+ #error Unsupported architecture
+ #endif
+
#define GL_EXTENSION_NAME(_n) __glExtFwd##_n
#define GL_EXTENSION(_n) \
diff --git a/opengl/libs/EGL/trace.cpp b/opengl/libs/EGL/trace.cpp
index 52907c1..a51b086 100644
--- a/opengl/libs/EGL/trace.cpp
+++ b/opengl/libs/EGL/trace.cpp
@@ -26,6 +26,11 @@
#include <cutils/log.h>
+#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include <utils/Trace.h>
+
+#include <utils/CallStack.h>
+
#include "egl_tls.h"
#include "hooks.h"
@@ -314,6 +319,10 @@ static void TraceGL(const char* name, int numArgs, ...) {
va_end(argp);
}
+///////////////////////////////////////////////////////////////////////////
+// Log trace
+///////////////////////////////////////////////////////////////////////////
+
#undef TRACE_GL_VOID
#undef TRACE_GL
@@ -349,7 +358,6 @@ EGLAPI gl_hooks_t gHooksTrace = {
};
#undef GL_ENTRY
-
#undef TRACE_GL_VOID
#undef TRACE_GL
@@ -372,6 +380,99 @@ extern "C" {
#include "../debug.in"
}
+///////////////////////////////////////////////////////////////////////////
+// Systrace
+///////////////////////////////////////////////////////////////////////////
+
+#undef TRACE_GL_VOID
+#undef TRACE_GL
+
+#define TRACE_GL_VOID(_api, _args, _argList, ...) \
+static void Systrace_ ## _api _args { \
+ ATRACE_NAME(#_api); \
+ gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
+ _c->_api _argList; \
+}
+
+#define TRACE_GL(_type, _api, _args, _argList, ...) \
+static _type Systrace_ ## _api _args { \
+ ATRACE_NAME(#_api); \
+ gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
+ return _c->_api _argList; \
+}
+
+extern "C" {
+#include "../trace.in"
+}
+
+#undef TRACE_GL_VOID
+#undef TRACE_GL
+
+#define GL_ENTRY(_r, _api, ...) Systrace_ ## _api,
+EGLAPI gl_hooks_t gHooksSystrace = {
+ {
+ #include "entries.in"
+ },
+ {
+ {0}
+ }
+};
+#undef GL_ENTRY
+
+///////////////////////////////////////////////////////////////////////////
+//
+///////////////////////////////////////////////////////////////////////////
+
+#undef TRACE_GL_VOID
+#undef TRACE_GL
+
+#define CHECK_ERROR(_c, _api) \
+ GLenum status = GL_NO_ERROR; \
+ bool error = false; \
+ while ((status = _c->glGetError()) != GL_NO_ERROR) { \
+ ALOGD("[" #_api "] 0x%x", status); \
+ error = true; \
+ } \
+ if (error) { \
+ CallStack s; \
+ s.update(); \
+ s.dump("glGetError:" #_api); \
+ } \
+
+#define TRACE_GL_VOID(_api, _args, _argList, ...) \
+static void ErrorTrace_ ## _api _args { \
+ gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
+ _c->_api _argList; \
+ CHECK_ERROR(_c, _api); \
+}
+
+#define TRACE_GL(_type, _api, _args, _argList, ...) \
+static _type ErrorTrace_ ## _api _args { \
+ gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \
+ _type _r = _c->_api _argList; \
+ CHECK_ERROR(_c, _api); \
+ return _r; \
+}
+
+extern "C" {
+#include "../trace.in"
+}
+
+#undef TRACE_GL_VOID
+#undef TRACE_GL
+
+#define GL_ENTRY(_r, _api, ...) ErrorTrace_ ## _api,
+EGLAPI gl_hooks_t gHooksErrorTrace = {
+ {
+ #include "entries.in"
+ },
+ {
+ {0}
+ }
+};
+#undef GL_ENTRY
+#undef CHECK_ERROR
+
#undef TRACE_GL_VOID
#undef TRACE_GL
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index 4345c2b..fb890fc 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -39,18 +39,11 @@ using namespace android;
#undef CALL_GL_API
#undef CALL_GL_API_RETURN
-#define DEBUG_CALL_GL_API 0
-
#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
+ #if defined(__arm__)
+
+ #define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
#define API_ENTRY(_api) __attribute__((naked)) _api
@@ -68,6 +61,44 @@ using namespace android;
: \
);
+ #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 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" \
+ "1:\n\t" \
+ "j %[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*4), \
+ [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : \
+ );
+
+ #else
+
+ #error Unsupported architecture
+
+ #endif
+
#define CALL_GL_API_RETURN(_api, ...) \
CALL_GL_API(_api, __VA_ARGS__) \
return 0; // placate gcc's warnings. never reached.
@@ -76,24 +107,10 @@ using namespace android;
#define API_ENTRY(_api) _api
-#if DEBUG_CALL_GL_API
-
- #define CALL_GL_API(_api, ...) \
- gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
- _c->_api(__VA_ARGS__); \
- GLenum status = GL_NO_ERROR; \
- while ((status = glGetError()) != GL_NO_ERROR) { \
- ALOGD("[" #_api "] 0x%x", status); \
- }
-
-#else
-
#define CALL_GL_API(_api, ...) \
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
_c->_api(__VA_ARGS__);
-#endif
-
#define CALL_GL_API_RETURN(_api, ...) \
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \
return _c->_api(__VA_ARGS__)
diff --git a/opengl/libs/GLES2/gl2_api.in b/opengl/libs/GLES2/gl2_api.in
index 9a89a52..cccf46c 100644
--- a/opengl/libs/GLES2/gl2_api.in
+++ b/opengl/libs/GLES2/gl2_api.in
@@ -169,7 +169,7 @@ void API_ENTRY(glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize
void API_ENTRY(glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) {
CALL_GL_API(glGetAttachedShaders, program, maxcount, count, shaders);
}
-int API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) {
+GLint API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) {
CALL_GL_API_RETURN(glGetAttribLocation, program, name);
}
void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean* params) {
@@ -226,7 +226,7 @@ void API_ENTRY(glGetUniformfv)(GLuint program, GLint location, GLfloat* params)
void API_ENTRY(glGetUniformiv)(GLuint program, GLint location, GLint* params) {
CALL_GL_API(glGetUniformiv, program, location, params);
}
-int API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) {
+GLint API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) {
CALL_GL_API_RETURN(glGetUniformLocation, program, name);
}
void API_ENTRY(glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params) {
diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index adcb60d..bd08942 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -97,14 +97,9 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(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
+ #if defined(__arm__)
+
+ #define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
#define API_ENTRY(_api) __attribute__((naked)) _api
@@ -122,6 +117,42 @@ GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
: \
);
+ #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 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" \
+ "1:\n\t" \
+ "j %[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*4), \
+ [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \
+ : \
+ );
+
+ #else
+ #error Unsupported architecture
+ #endif
+
#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_trace/Android.mk b/opengl/libs/GLES_trace/Android.mk
index 465b6b2..9dec020 100644
--- a/opengl/libs/GLES_trace/Android.mk
+++ b/opengl/libs/GLES_trace/Android.mk
@@ -24,18 +24,9 @@ LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI
LOCAL_STATIC_LIBRARIES := libprotobuf-cpp-2.3.0-lite liblzf
LOCAL_SHARED_LIBRARIES := libcutils libutils libstlport
-ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
-
LOCAL_CFLAGS += -DLOG_TAG=\"libGLES_trace\"
# we need to access the private Bionic header <bionic_tls.h>
-# on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER
-# behavior from the bionic Android.mk file
-ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true)
- LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER
-endif
LOCAL_C_INCLUDES += bionic/libc/private
LOCAL_MODULE:= libGLES_trace
diff --git a/opengl/libs/GLES_trace/src/gltrace_api.cpp b/opengl/libs/GLES_trace/src/gltrace_api.cpp
index cef6cbb..2ae4b11 100644
--- a/opengl/libs/GLES_trace/src/gltrace_api.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_api.cpp
@@ -2214,7 +2214,7 @@ void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* cou
glContext->traceGLMessage(&glmsg);
}
-int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) {
+GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) {
GLMessage glmsg;
GLTraceContext *glContext = getGLTraceContext();
@@ -2235,7 +2235,7 @@ int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) {
// call function
nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- int retValue = glContext->hooks->gl.glGetAttribLocation(program, name);
+ GLint retValue = glContext->hooks->gl.glGetAttribLocation(program, name);
nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
@@ -2996,7 +2996,7 @@ void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params) {
glContext->traceGLMessage(&glmsg);
}
-int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) {
+GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) {
GLMessage glmsg;
GLTraceContext *glContext = getGLTraceContext();
@@ -3017,7 +3017,7 @@ int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) {
// call function
nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD);
- int retValue = glContext->hooks->gl.glGetUniformLocation(program, name);
+ GLint retValue = glContext->hooks->gl.glGetUniformLocation(program, name);
nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD);
nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC);
diff --git a/opengl/libs/GLES_trace/src/gltrace_api.h b/opengl/libs/GLES_trace/src/gltrace_api.h
index debcac0..309afcb 100644
--- a/opengl/libs/GLES_trace/src/gltrace_api.h
+++ b/opengl/libs/GLES_trace/src/gltrace_api.h
@@ -78,7 +78,7 @@ void GLTrace_glGenTextures(GLsizei n, GLuint* textures);
void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
-int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name);
+GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar* name);
void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params);
void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
GLenum GLTrace_glGetError(void);
@@ -97,7 +97,7 @@ void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params);
void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params);
void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params);
-int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name);
+GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar* name);
void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
diff --git a/opengl/libs/GLES_trace/src/gltrace_context.cpp b/opengl/libs/GLES_trace/src/gltrace_context.cpp
index 45dbb43..3a8decc 100644
--- a/opengl/libs/GLES_trace/src/gltrace_context.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_context.cpp
@@ -119,7 +119,7 @@ GLTraceContext *GLTraceState::createTraceContext(int version, EGLContext eglCont
const size_t DEFAULT_BUFFER_SIZE = 8192;
BufferedOutputStream *stream = new BufferedOutputStream(mStream, DEFAULT_BUFFER_SIZE);
- GLTraceContext *traceContext = new GLTraceContext(id, this, stream);
+ GLTraceContext *traceContext = new GLTraceContext(id, version, this, stream);
mPerContextState[eglContext] = traceContext;
return traceContext;
@@ -129,8 +129,10 @@ GLTraceContext *GLTraceState::getTraceContext(EGLContext c) {
return mPerContextState[c];
}
-GLTraceContext::GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream) :
+GLTraceContext::GLTraceContext(int id, int version, GLTraceState *state,
+ BufferedOutputStream *stream) :
mId(id),
+ mVersion(version),
mState(state),
mBufferedOutputStream(stream),
mElementArrayBuffers(DefaultKeyedVector<GLuint, ElementArrayBuffer*>(NULL))
@@ -143,6 +145,10 @@ int GLTraceContext::getId() {
return mId;
}
+int GLTraceContext::getVersion() {
+ return mVersion;
+}
+
GLTraceState *GLTraceContext::getGlobalTraceState() {
return mState;
}
@@ -203,6 +209,8 @@ void GLTraceContext::traceGLMessage(GLMessage *msg) {
GLMessage_Function func = msg->function();
if (func == GLMessage::eglSwapBuffers
+ || func == GLMessage::eglCreateContext
+ || func == GLMessage::eglMakeCurrent
|| func == GLMessage::glDrawArrays
|| func == GLMessage::glDrawElements) {
mBufferedOutputStream->flush();
diff --git a/opengl/libs/GLES_trace/src/gltrace_context.h b/opengl/libs/GLES_trace/src/gltrace_context.h
index 323cfdc..4c38bba 100644
--- a/opengl/libs/GLES_trace/src/gltrace_context.h
+++ b/opengl/libs/GLES_trace/src/gltrace_context.h
@@ -50,6 +50,7 @@ public:
/** GL Trace Context info associated with each EGLContext */
class GLTraceContext {
int mId; /* unique context id */
+ int mVersion; /* GL version, e.g: egl_connection_t::GLESv2_INDEX */
GLTraceState *mState; /* parent GL Trace state (for per process GL Trace State Info) */
void *fbcontents; /* memory area to read framebuffer contents */
@@ -65,8 +66,9 @@ class GLTraceContext {
public:
gl_hooks_t *hooks;
- GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream);
+ GLTraceContext(int id, int version, GLTraceState *state, BufferedOutputStream *stream);
int getId();
+ int getVersion();
GLTraceState *getGlobalTraceState();
void getCompressedFB(void **fb, unsigned *fbsize,
unsigned *fbwidth, unsigned *fbheight,
diff --git a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
index 3597b26..36ae314 100644
--- a/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
+++ b/opengl/libs/GLES_trace/src/gltrace_fixup.cpp
@@ -15,6 +15,7 @@
*/
#include <cutils/log.h>
+#include <EGL/egldefs.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
@@ -340,7 +341,7 @@ void fixup_glLinkProgram(GLMessage *glmsg) {
/** Given a glGetActive[Uniform|Attrib] call, obtain the location
* of the variable of given name in the call.
*/
-int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) {
+GLint getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) {
GLMessage_Function func = glmsg->function();
if (func != GLMessage::glGetActiveAttrib && func != GLMessage::glGetActiveUniform) {
return -1;
@@ -373,7 +374,7 @@ void fixup_glGetActiveAttribOrUniform(GLTraceContext *context, GLMessage *glmsg,
// In order to make things simpler for the debugger, we also pass
// a hidden location argument that stores the actual location.
// append the location value to the end of the argument list
- int location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]);
+ GLint location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]);
GLMessage_DataType *arg_location = glmsg->add_args();
arg_location->set_isarray(false);
arg_location->set_type(GLMessage::DataType::INT);
@@ -592,6 +593,11 @@ void trace_VertexAttribPointerData(GLTraceContext *context,
}
void trace_VertexAttribPointerDataForGlDrawArrays(GLTraceContext *context, GLMessage *glmsg) {
+ if (context->getVersion() == egl_connection_t::GLESv1_INDEX) {
+ // only supported for GLES2 and above
+ return;
+ }
+
/* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */
GLsizei count = glmsg->args(2).intvalue(0);
@@ -604,6 +610,11 @@ void trace_VertexAttribPointerDataForGlDrawArrays(GLTraceContext *context, GLMes
void trace_VertexAttribPointerDataForGlDrawElements(GLTraceContext *context, GLMessage *glmsg,
GLvoid *indices) {
+ if (context->getVersion() == egl_connection_t::GLESv1_INDEX) {
+ // only supported for GLES2 and above
+ return;
+ }
+
/* void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) */
GLsizei count = glmsg->args(1).intvalue(0);
GLenum type = glmsg->args(2).intvalue(0);
diff --git a/opengl/libs/entries.in b/opengl/libs/entries.in
index 6316d78..b9a51a4 100644
--- a/opengl/libs/entries.in
+++ b/opengl/libs/entries.in
@@ -160,7 +160,7 @@ GL_ENTRY(void, glGenerateMipmapOES, GLenum target)
GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-GL_ENTRY(int, glGetAttribLocation, GLuint program, const GLchar* name)
+GL_ENTRY(GLint, glGetAttribLocation, GLuint program, const GLchar* name)
GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params)
GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params)
GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid ** params)
@@ -218,7 +218,7 @@ GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params
GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params)
GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params)
GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params)
-GL_ENTRY(int, glGetUniformLocation, GLuint program, const GLchar* name)
+GL_ENTRY(GLint, glGetUniformLocation, GLuint program, const GLchar* name)
GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat* params)
GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint* params)
GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer)
diff --git a/opengl/libs/hooks.h b/opengl/libs/hooks.h
index 8b1b389..e0ceb60 100644
--- a/opengl/libs/hooks.h
+++ b/opengl/libs/hooks.h
@@ -30,7 +30,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#if !defined(__arm__)
+#if !defined(__arm__) && !defined(__mips__)
#define USE_SLOW_BINDING 1
#else
#define USE_SLOW_BINDING 0
diff --git a/opengl/libs/trace.in b/opengl/libs/trace.in
index a5c5c84..e89e456 100644
--- a/opengl/libs/trace.in
+++ b/opengl/libs/trace.in
@@ -160,7 +160,7 @@ TRACE_GL_VOID(glGenerateMipmapOES, (GLenum target), (target), 1, "GLenum", targe
TRACE_GL_VOID(glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name)
TRACE_GL_VOID(glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name)
TRACE_GL_VOID(glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders), 4, "GLuint", program, "GLsizei", maxcount, "GLsizei*", count, "GLuint*", shaders)
-TRACE_GL(int, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
+TRACE_GL(GLint, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
TRACE_GL_VOID(glGetBooleanv, (GLenum pname, GLboolean *params), (pname, params), 2, "GLenum", pname, "GLboolean *", params)
TRACE_GL_VOID(glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params)
TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLvoid **", params)
@@ -218,7 +218,7 @@ TRACE_GL_VOID(glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params
TRACE_GL_VOID(glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params)
TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params)
-TRACE_GL(int, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
+TRACE_GL(GLint, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name)
TRACE_GL_VOID(glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLfloat*", params)
TRACE_GL_VOID(glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLint*", params)
TRACE_GL_VOID(glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer), 3, "GLuint", index, "GLenum", pname, "GLvoid**", pointer)