When destroying a surface, only unmake current if necessary
Bug #9404946 The Calendar app destroys one of its popup windows during a draw traversal. Without this patch, we end up with no current context nor surface after we're done gathering display lists. This means that all of our EGL/GL calls will either fail or have undefined behaviors. This could explain the PBO crash we are seeing with the monkeys. Without a proper GL context, the driver returns NULL when we map the PBO in CPU memory. Change-Id: I210cf724be73da909a7621f807298a9f4a58e61d
This commit is contained in:
@@ -1301,7 +1301,10 @@ public abstract class HardwareRenderer {
|
||||
|
||||
void destroySurface() {
|
||||
if (mEglSurface != null && mEglSurface != EGL_NO_SURFACE) {
|
||||
sEgl.eglMakeCurrent(sEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (mEglSurface.equals(sEgl.eglGetCurrentSurface(EGL_DRAW))) {
|
||||
sEgl.eglMakeCurrent(sEglDisplay,
|
||||
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
}
|
||||
sEgl.eglDestroySurface(sEglDisplay, mEglSurface);
|
||||
mEglSurface = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user