Merge "Revert "Second try at adding a compatibility symbol for the MemoryBase constructor.""
diff --git a/cmds/dumpstate/Android.mk b/cmds/dumpstate/Android.mk
index 18685f7..8640983 100644
--- a/cmds/dumpstate/Android.mk
+++ b/cmds/dumpstate/Android.mk
@@ -9,7 +9,7 @@
LOCAL_MODULE := dumpstate
-LOCAL_SHARED_LIBRARIES := libcutils
+LOCAL_SHARED_LIBRARIES := libcutils libselinux
ifdef BOARD_LIB_DUMPSTATE
LOCAL_STATIC_LIBRARIES := $(BOARD_LIB_DUMPSTATE)
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index 55a36c2..dbe9832 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -314,7 +314,13 @@
);
}
+static void sigpipe_handler(int n) {
+ (void)n;
+ exit(EXIT_FAILURE);
+}
+
int main(int argc, char *argv[]) {
+ struct sigaction sigact;
int do_add_date = 0;
int do_compress = 0;
int do_vibrate = 1;
@@ -334,7 +340,9 @@
}
ALOGI("begin\n");
- signal(SIGPIPE, SIG_IGN);
+ memset(&sigact, 0, sizeof(sigact));
+ sigact.sa_handler = sigpipe_handler;
+ sigaction(SIGPIPE, &sigact, NULL);
/* set as high priority, and protect from OOM killer */
setpriority(PRIO_PROCESS, 0, -20);
diff --git a/cmds/dumpstate/utils.c b/cmds/dumpstate/utils.c
index eaef3d4..5b8ed49 100644
--- a/cmds/dumpstate/utils.c
+++ b/cmds/dumpstate/utils.c
@@ -38,6 +38,8 @@
#include <cutils/sockets.h>
#include <private/android_filesystem_config.h>
+#include <selinux/android.h>
+
#include "dumpstate.h"
/* list of native processes to include in the native dumps */
@@ -402,6 +404,9 @@
if (!mkdir(anr_traces_dir, 0775)) {
chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM);
chmod(anr_traces_dir, 0775);
+ if (selinux_android_restorecon(anr_traces_dir) == -1) {
+ fprintf(stderr, "restorecon failed for %s: %s\n", anr_traces_dir, strerror(errno));
+ }
} else if (errno != EEXIST) {
fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno));
return NULL;
diff --git a/include/android/input.h b/include/android/input.h
index f2befa9e..26c4eb8 100644
--- a/include/android/input.h
+++ b/include/android/input.h
@@ -690,7 +690,7 @@
/* Get the time that a historical movement occurred between this event and
* the previous event, in the java.lang.System.nanoTime() time base. */
-int64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event,
+int64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event,
size_t history_index);
/* Get the historical raw X coordinate of this event for the given pointer index that
@@ -717,14 +717,14 @@
* occurred between this event and the previous motion event.
* Whole numbers are pixels; the value may have a fraction for input devices
* that are sub-pixel precise. */
-float AMotionEvent_getHistoricalX(AInputEvent* motion_event, size_t pointer_index,
+float AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index,
size_t history_index);
/* Get the historical Y coordinate of this event for the given pointer index that
* occurred between this event and the previous motion event.
* Whole numbers are pixels; the value may have a fraction for input devices
* that are sub-pixel precise. */
-float AMotionEvent_getHistoricalY(AInputEvent* motion_event, size_t pointer_index,
+float AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index,
size_t history_index);
/* Get the historical pressure of this event for the given pointer index that
@@ -732,7 +732,7 @@
* The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
* although values higher than 1 may be generated depending on the calibration of
* the input device. */
-float AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t pointer_index,
+float AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index,
size_t history_index);
/* Get the current scaled value of the approximate size for the given pointer index that
@@ -742,7 +742,7 @@
* touch is normalized with the device specific range of values
* and scaled to a value between 0 and 1. The value of size can be used to
* determine fat touch events. */
-float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index,
+float AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index,
size_t history_index);
/* Get the historical length of the major axis of an ellipse that describes the touch area
diff --git a/include/utils/Log.h b/include/utils/Log.h
index 98c441c..4259c86 100644
--- a/include/utils/Log.h
+++ b/include/utils/Log.h
@@ -62,7 +62,7 @@
* }
*/
#define ALOGD_IF_SLOW(timeoutMillis, message) \
- LogIfSlow _logIfSlow(LOG_TAG, ANDROID_LOG_DEBUG, timeoutMillis, message);
+ android::LogIfSlow _logIfSlow(LOG_TAG, ANDROID_LOG_DEBUG, timeoutMillis, message);
} // namespace android
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 4c15913..c7bdcbc 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -627,11 +627,27 @@
return writeAligned(val);
}
+#if defined(__mips__) && defined(__mips_hard_float)
+
+status_t Parcel::writeDouble(double val)
+{
+ union {
+ double d;
+ unsigned long long ll;
+ } u;
+ u.d = val;
+ return writeAligned(u.ll);
+}
+
+#else
+
status_t Parcel::writeDouble(double val)
{
return writeAligned(val);
}
+#endif
+
status_t Parcel::writeIntPtr(intptr_t val)
{
return writeAligned(val);
@@ -962,17 +978,44 @@
return readAligned<float>();
}
+#if defined(__mips__) && defined(__mips_hard_float)
+
+status_t Parcel::readDouble(double *pArg) const
+{
+ union {
+ double d;
+ unsigned long long ll;
+ } u;
+ status_t status;
+ status = readAligned(&u.ll);
+ *pArg = u.d;
+ return status;
+}
+
+double Parcel::readDouble() const
+{
+ union {
+ double d;
+ unsigned long long ll;
+ } u;
+ u.ll = readAligned<unsigned long long>();
+ return u.d;
+}
+
+#else
+
status_t Parcel::readDouble(double *pArg) const
{
return readAligned(pArg);
}
-
double Parcel::readDouble() const
{
return readAligned<double>();
}
+#endif
+
status_t Parcel::readIntPtr(intptr_t *pArg) const
{
return readAligned(pArg);
@@ -1429,6 +1472,8 @@
if (objectsSize) {
objects = (size_t*)malloc(objectsSize*sizeof(size_t));
if (!objects) {
+ free(data);
+
mError = NO_MEMORY;
return NO_MEMORY;
}
@@ -1509,7 +1554,7 @@
mError = NO_MEMORY;
return NO_MEMORY;
}
-
+
if(!(mDataCapacity == 0 && mObjects == NULL
&& mObjectsCapacity == 0)) {
ALOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired);
diff --git a/opengl/libagl/Android.mk b/opengl/libagl/Android.mk
index 1b3d6ed..9b8d3fe 100644
--- a/opengl/libagl/Android.mk
+++ b/opengl/libagl/Android.mk
@@ -34,6 +34,13 @@
LOCAL_CFLAGS += -fstrict-aliasing
endif
+ifeq ($(TARGET_ARCH),mips)
+ LOCAL_SRC_FILES += arch-$(TARGET_ARCH)/fixed_asm.S
+ LOCAL_CFLAGS += -fstrict-aliasing
+ # The graphics code can generate division by zero
+ LOCAL_CFLAGS += -mno-check-zero-division
+endif
+
# we need to access the private Bionic header <bionic_tls.h>
LOCAL_C_INCLUDES += bionic/libc/private
diff --git a/opengl/libagl/arch-mips/fixed_asm.S b/opengl/libagl/arch-mips/fixed_asm.S
new file mode 100644
index 0000000..e1a53bc
--- /dev/null
+++ b/opengl/libagl/arch-mips/fixed_asm.S
@@ -0,0 +1,61 @@
+/* libs/opengles/arch-mips/fixed_asm.S
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+
+ .text
+ .align
+
+/*
+ * this version rounds-to-nearest and saturates numbers
+ * outside the range (but not NaNs).
+ */
+
+ .global gglFloatToFixed
+ .ent gglFloatToFixed
+ .type gglFloatToFixed, @function
+gglFloatToFixed:
+#if !defined(__mips_soft_float)
+ mfc1 $a0,$f12
+#endif
+ srl $t0,$a0,31 /* t0 <- sign bit */
+ srl $t1,$a0,23
+ andi $t1,$t1,0xff /* get the e */
+ li $t2,0x8e
+ subu $t1,$t2,$t1 /* t1=127+15-e */
+ blez $t1,0f /* t1<=0? */
+ sll $t2,$a0,8 /* mantissa<<8 */
+ lui $t3,0x8000
+ or $t2,$t2,$t3 /* add the missing 1 */
+ subu $t1,$t1,1
+ srl $v0,$t2,$t1
+ sltiu $t3,$t1,32 /* t3=1 if t1<32, else t3=0. t1>=32 means the float value is too small. */
+ andi $t4,$v0,0x1
+ srl $v0,$v0,1 /* scale to 16.16 */
+ addu $v0,$v0,$t4 /* round-to-nearest */
+ subu $t2,$zero,$v0
+ movn $v0,$t2,$t0 /* if negative? */
+ or $t1,$a0,$zero /* a0=0? */
+ movz $v0,$zero,$t1
+ movz $v0,$zero,$t3 /* t3=0 then res=0 */
+ jr $ra
+0:
+ lui $t1,0x8000
+ and $v0,$a0,$t1 /* keep only the sign bit */
+ li $t1,0x7fffffff
+ movz $v0,$t1,$t0 /* positive, maximum value */
+ jr $ra
+ .end gglFloatToFixed
diff --git a/opengl/libagl/fp.cpp b/opengl/libagl/fp.cpp
index ae5f1fe..aea4449 100644
--- a/opengl/libagl/fp.cpp
+++ b/opengl/libagl/fp.cpp
@@ -19,7 +19,7 @@
// ----------------------------------------------------------------------------
-#if !defined(__arm__)
+#if !defined(__arm__) && !defined(__mips__)
GGLfixed gglFloatToFixed(float v) {
return GGLfixed(floorf(v * 65536.0f + 0.5f));
}
diff --git a/opengl/libagl/matrix.h b/opengl/libagl/matrix.h
index c9a38a9..5bd717a 100644
--- a/opengl/libagl/matrix.h
+++ b/opengl/libagl/matrix.h
@@ -74,6 +74,30 @@
);
return r;
+#elif defined(__mips__)
+
+ GLfixed res;
+ int32_t t1,t2,t3;
+ asm(
+ "mult %[a], %[a] \r\n"
+ "li %[res],0x8000 \r\n"
+ "madd %[b],%[b] \r\n"
+ "move %[t3],$zero \r\n"
+ "madd %[c],%[c] \r\n"
+ "mflo %[t1]\r\n"
+ "mfhi %[t2]\r\n"
+ "addu %[t1],%[res],%[t1]\r\n" /*add 0x8000*/
+ "sltu %[t3],%[t1],%[res]\r\n"
+ "addu %[t2],%[t2],%[t3]\r\n"
+ "srl %[res],%[t1],16\r\n"
+ "sll %[t2],%[t2],16\r\n"
+ "or %[res],%[res],%[t2]\r\n"
+ : [res]"=&r"(res),[t1]"=&r"(t1),[t2]"=&r"(t2),[t3]"=&r"(t3)
+ : [a] "r" (a),[b] "r" (b),[c] "r" (c)
+ : "%hi","%lo"
+ );
+ return res;
+
#else
return (( int64_t(a)*a +
@@ -136,6 +160,26 @@
);
return r;
+#elif defined(__mips__)
+
+ GLfixed res;
+ int32_t t1,t2;
+ asm(
+ "mult %[a0],%[b0] \r\n"
+ "madd %[a1],%[b1] \r\n"
+ "madd %[a2],%[b2] \r\n"
+ "mflo %[t2]\r\n"
+ "mfhi %[t1]\r\n"
+ "srl %[t2],%[t2],16\r\n"
+ "sll %[t1],%[t1],16\r\n"
+ "or %[t2],%[t2],%[t1]\r\n"
+ "addu %[res],%[t2],%[c]"
+ : [res]"=&r"(res),[t1]"=&r"(t1),[t2]"=&r"(t2)
+ : [a0] "r" (a0),[b0] "r" (b0),[a1] "r" (a1),[b1] "r" (b1),[a2] "r" (a2),[b2] "r" (b2),[c] "r" (c)
+ : "%hi","%lo"
+ );
+ return res;
+
#else
return (( int64_t(a0)*b0 +
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 065faf2..c25612d 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -439,8 +439,11 @@
egl_connection_t* cnx = NULL;
const egl_display_ptr dp = validate_display_connection(dpy, cnx);
- if (dpy) {
+ if (dp) {
if (share_list != EGL_NO_CONTEXT) {
+ if (!ContextRef(dp.get(), share_list).get()) {
+ return setError(EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
+ }
egl_context_t* const c = get_context(share_list);
share_list = c->context;
}
@@ -524,7 +527,7 @@
// validate the context (if not EGL_NO_CONTEXT)
if ((ctx != EGL_NO_CONTEXT) && !_c.get()) {
// EGL_NO_CONTEXT is valid
- return EGL_FALSE;
+ return setError(EGL_BAD_CONTEXT, EGL_FALSE);
}
// these are the underlying implementation's object
@@ -545,12 +548,12 @@
impl_ctx = c->context;
} else {
// no context given, use the implementation of the current context
+ if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
+ // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
+ return setError(EGL_BAD_MATCH, EGL_FALSE);
+ }
if (cur_c == NULL) {
// no current context
- if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) {
- // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT);
- return setError(EGL_BAD_MATCH, EGL_FALSE);
- }
// not an error, there is just no current context.
return EGL_TRUE;
}
@@ -558,12 +561,14 @@
// retrieve the underlying implementation's draw EGLSurface
if (draw != EGL_NO_SURFACE) {
+ if (!_d.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
d = get_surface(draw);
impl_draw = d->surface;
}
// retrieve the underlying implementation's read EGLSurface
if (read != EGL_NO_SURFACE) {
+ if (!_r.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE);
r = get_surface(read);
impl_read = r->surface;
}
diff --git a/opengl/libs/EGL/getProcAddress.cpp b/opengl/libs/EGL/getProcAddress.cpp
index f453176..d23da7a 100644
--- a/opengl/libs/EGL/getProcAddress.cpp
+++ b/opengl/libs/EGL/getProcAddress.cpp
@@ -37,6 +37,8 @@
#if USE_FAST_TLS_KEY
+ #if defined(__arm__)
+
#define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
#define API_ENTRY(_api) __attribute__((naked)) _api
@@ -57,6 +59,41 @@
: \
);
+ #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/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index fca42ec..fb890fc 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -41,6 +41,8 @@
#if USE_FAST_TLS_KEY
+ #if defined(__arm__)
+
#define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
#define API_ENTRY(_api) __attribute__((naked)) _api
@@ -59,6 +61,44 @@
: \
);
+ #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_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp
index 48fd278..bd08942 100644
--- a/opengl/libs/GLES_CM/gl.cpp
+++ b/opengl/libs/GLES_CM/gl.cpp
@@ -97,6 +97,8 @@
#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS
+ #if defined(__arm__)
+
#define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n"
#define API_ENTRY(_api) __attribute__((naked)) _api
@@ -115,6 +117,42 @@
: \
);
+ #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/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/tests/gl2_jni/Android.mk b/opengl/tests/gl2_jni/Android.mk
index 5d90ff6..25187c9 100644
--- a/opengl/tests/gl2_jni/Android.mk
+++ b/opengl/tests/gl2_jni/Android.mk
@@ -30,7 +30,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp
diff --git a/opengl/tests/gl2_jni/jni/gl_code.cpp b/opengl/tests/gl2_jni/jni/gl_code.cpp
index fa6bd93..ed896a4 100644
--- a/opengl/tests/gl2_jni/jni/gl_code.cpp
+++ b/opengl/tests/gl2_jni/jni/gl_code.cpp
@@ -153,7 +153,7 @@
JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj);
};
-JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj, jint width, jint height)
+JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj, jint width, jint height)
{
setupGraphics(width, height);
}
diff --git a/opengl/tests/gl_jni/Android.mk b/opengl/tests/gl_jni/Android.mk
index 3d20e72..80b4bac 100644
--- a/opengl/tests/gl_jni/Android.mk
+++ b/opengl/tests/gl_jni/Android.mk
@@ -30,7 +30,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp
diff --git a/opengl/tests/gl_perfapp/Android.mk b/opengl/tests/gl_perfapp/Android.mk
index 65e50e9..45a5516 100644
--- a/opengl/tests/gl_perfapp/Android.mk
+++ b/opengl/tests/gl_perfapp/Android.mk
@@ -33,7 +33,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp
diff --git a/opengl/tests/gldual/Android.mk b/opengl/tests/gldual/Android.mk
index b4b378e..42094c8 100644
--- a/opengl/tests/gldual/Android.mk
+++ b/opengl/tests/gldual/Android.mk
@@ -30,7 +30,7 @@
# Optional tag would mean it doesn't get installed by default
LOCAL_MODULE_TAGS := optional
-LOCAL_CFLAGS := -Werror
+LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter
LOCAL_SRC_FILES:= \
gl_code.cpp
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9afa4c1..055bfe4 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1520,7 +1520,11 @@
const bool hasGlesComposition = hwc.hasGlesComposition(id) || (cur==end);
if (hasGlesComposition) {
- DisplayDevice::makeCurrent(mEGLDisplay, hw, mEGLContext);
+ if (!DisplayDevice::makeCurrent(mEGLDisplay, hw, mEGLContext)) {
+ ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s",
+ hw->getDisplayName().string());
+ return;
+ }
// set the frame buffer
glMatrixMode(GL_MODELVIEW);