summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2010-04-19 19:10:13 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-04-19 19:10:13 -0700
commit0679876997a5523a7539b8fe2c74a39434b17820 (patch)
treea9bbe1de12fab75db8ad7537e36c282c40ee38fa /opengl
parente31724050041b4be41b7c868d531a6c00fd94587 (diff)
parent7305f4166306dac08fc63056f2c85e91015df879 (diff)
downloadframeworks_base-0679876997a5523a7539b8fe2c74a39434b17820.zip
frameworks_base-0679876997a5523a7539b8fe2c74a39434b17820.tar.gz
frameworks_base-0679876997a5523a7539b8fe2c74a39434b17820.tar.bz2
am 7305f416: Merge "Quietly handle EGL_BAD_NATIVE_WINDOW errors" into froyo
Merge commit '7305f4166306dac08fc63056f2c85e91015df879' into froyo-plus-aosp * commit '7305f4166306dac08fc63056f2c85e91015df879': Quietly handle EGL_BAD_NATIVE_WINDOW errors
Diffstat (limited to 'opengl')
-rw-r--r--opengl/java/android/opengl/GLSurfaceView.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java
index 5ad0361..f904cdf 100644
--- a/opengl/java/android/opengl/GLSurfaceView.java
+++ b/opengl/java/android/opengl/GLSurfaceView.java
@@ -973,9 +973,12 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
mEglDisplay, mEglConfig, holder);
if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) {
- Log.w("EglHelper", "createWindowSurface failed. mEglDisplay: " + mEglDisplay +
- " mEglConfig: " + mEglConfig + " holder: " + holder);
- throwEglException("createWindowSurface");
+ int error = mEgl.eglGetError();
+ if (error == EGL10.EGL_BAD_NATIVE_WINDOW) {
+ Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW.");
+ return null;
+ }
+ throwEglException("createWindowSurface", error);
}
/*
@@ -1019,9 +1022,16 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
* get a new surface.
*/
int error = mEgl.eglGetError();
- if (error == EGL11.EGL_CONTEXT_LOST) {
+ switch(error) {
+ case EGL11.EGL_CONTEXT_LOST:
return false;
- } else {
+ case EGL10.EGL_BAD_NATIVE_WINDOW:
+ // The native window is bad, probably because the
+ // window manager has closed it. Ignore this error,
+ // on the expectation that the application will be closed soon.
+ Log.e("EglHelper", "eglSwapBuffers returned EGL_BAD_NATIVE_WINDOW. tid=" + Thread.currentThread().getId());
+ break;
+ default:
throwEglException("eglSwapBuffers", error);
}
}
@@ -1292,6 +1302,10 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
Log.w("GLThread", "egl createSurface");
}
gl = (GL10) mEglHelper.createSurface(getHolder());
+ if (gl == null) {
+ // Couldn't create a surface. Quit quietly.
+ break;
+ }
sGLThreadManager.checkGLDriver(gl);
createEglSurface = false;
}