summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chock <mchock@nvidia.com>2013-08-06 15:21:10 -0700
committerAndy McFadden <fadden@android.com>2014-03-04 09:59:30 -0800
commitb5066245365e932775ca6087cd74e53efa364642 (patch)
treeab03359c2399f5891220ecafcdd39622d1e5d815
parent210451262a2ed86c9540bd2ea2a8474374a8efb9 (diff)
downloadframeworks_base-b5066245365e932775ca6087cd74e53efa364642.zip
frameworks_base-b5066245365e932775ca6087cd74e53efa364642.tar.gz
frameworks_base-b5066245365e932775ca6087cd74e53efa364642.tar.bz2
Avoid restrictive locking around EGL calls
Do not use critical section variants of JNI array mapping operations when making EGL calls. They impose unnecessary restrictions on the EGL implementation that can lead to intermittent crashes. Using the non-critical variants makes no detectable performance difference. Change-Id: I4ef643f1a7fcdc5995538ff9d543f43f33c8e412
-rw-r--r--core/jni/com_google_android_gles_jni_EGLImpl.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
index 3035d15..3d421d5 100644
--- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
@@ -107,7 +107,7 @@ static bool validAttribList(JNIEnv *_env, jintArray attrib_list) {
static jint* beginNativeAttribList(JNIEnv *_env, jintArray attrib_list) {
if (attrib_list != NULL) {
- return (jint *)_env->GetPrimitiveArrayCritical(attrib_list, (jboolean *)0);
+ return _env->GetIntArrayElements(attrib_list, (jboolean *)0);
} else {
return(jint*) gNull_attrib_base;
}
@@ -115,7 +115,7 @@ static jint* beginNativeAttribList(JNIEnv *_env, jintArray attrib_list) {
static void endNativeAttributeList(JNIEnv *_env, jintArray attrib_list, jint* attrib_base) {
if (attrib_list != NULL) {
- _env->ReleasePrimitiveArrayCritical(attrib_list, attrib_base, JNI_ABORT);
+ _env->ReleaseIntArrayElements(attrib_list, attrib_base, JNI_ABORT);
}
}
@@ -154,9 +154,9 @@ static jboolean jni_eglQueryContext(JNIEnv *_env, jobject _this, jobject display
EGLBoolean success = EGL_FALSE;
int len = _env->GetArrayLength(value);
if (len) {
- jint* base = (jint *)_env->GetPrimitiveArrayCritical(value, (jboolean *)0);
+ jint* base = _env->GetIntArrayElements(value, (jboolean *)0);
success = eglQueryContext(dpy, ctx, attribute, base);
- _env->ReleasePrimitiveArrayCritical(value, base, JNI_ABORT);
+ _env->ReleaseIntArrayElements(value, base, JNI_ABORT);
}
return EglBoolToJBool(success);
}
@@ -174,9 +174,9 @@ static jboolean jni_eglQuerySurface(JNIEnv *_env, jobject _this, jobject display
EGLBoolean success = EGL_FALSE;
int len = _env->GetArrayLength(value);
if (len) {
- jint* base = (jint *)_env->GetPrimitiveArrayCritical(value, (jboolean *)0);
+ jint* base = _env->GetIntArrayElements(value, (jboolean *)0);
success = eglQuerySurface(dpy, sur, attribute, base);
- _env->ReleasePrimitiveArrayCritical(value, base, JNI_ABORT);
+ _env->ReleaseIntArrayElements(value, base, JNI_ABORT);
}
return EglBoolToJBool(success);
}