Merge "Quietly handle EGL_BAD_NATIVE_WINDOW errors" into froyo

This commit is contained in:
Jack Palevich
2010-04-19 19:06:35 -07:00
committed by Android (Google) Code Review

View File

@@ -973,9 +973,12 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
mEglDisplay, mEglConfig, holder); mEglDisplay, mEglConfig, holder);
if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) { if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) {
Log.w("EglHelper", "createWindowSurface failed. mEglDisplay: " + mEglDisplay + int error = mEgl.eglGetError();
" mEglConfig: " + mEglConfig + " holder: " + holder); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) {
throwEglException("createWindowSurface"); 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. * get a new surface.
*/ */
int error = mEgl.eglGetError(); int error = mEgl.eglGetError();
if (error == EGL11.EGL_CONTEXT_LOST) { switch(error) {
case EGL11.EGL_CONTEXT_LOST:
return false; 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); throwEglException("eglSwapBuffers", error);
} }
} }
@@ -1292,6 +1302,10 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
Log.w("GLThread", "egl createSurface"); Log.w("GLThread", "egl createSurface");
} }
gl = (GL10) mEglHelper.createSurface(getHolder()); gl = (GL10) mEglHelper.createSurface(getHolder());
if (gl == null) {
// Couldn't create a surface. Quit quietly.
break;
}
sGLThreadManager.checkGLDriver(gl); sGLThreadManager.checkGLDriver(gl);
createEglSurface = false; createEglSurface = false;
} }