diff options
author | John Reck <jreck@google.com> | 2014-09-17 16:06:36 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2014-09-17 16:09:57 -0700 |
commit | 2cdbc7d2283aae3d77b12c8fdbba8ca4bd3db5ea (patch) | |
tree | a129c07e75038b92257f5c6d16eb5dc13c79f8d6 /libs/hwui/renderthread/EglManager.cpp | |
parent | 9077cbc30e6c71c8d103ae44b0c30b765e42f66b (diff) |
Special case EGL_BAD_SURFACE
Bug: 17516789
Change-Id: I3dcb10360c2aef6326f7dbbff6815866d4c143b6
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index e030cdb29ff6..a87834ee0c63 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -254,11 +254,23 @@ void EglManager::beginFrame(EGLSurface surface, EGLint* width, EGLint* height) { eglBeginFrame(mEglDisplay, surface); } -void EglManager::swapBuffers(EGLSurface surface) { +bool EglManager::swapBuffers(EGLSurface surface) { eglSwapBuffers(mEglDisplay, surface); EGLint err = eglGetError(); - LOG_ALWAYS_FATAL_IF(err != EGL_SUCCESS, - "Encountered EGL error %d %s during rendering", err, egl_error_str(err)); + if (CC_LIKELY(err == EGL_SUCCESS)) { + return true; + } + if (err == EGL_BAD_SURFACE) { + // For some reason our surface was destroyed out from under us + // This really shouldn't happen, but if it does we can recover easily + // by just not trying to use the surface anymore + ALOGW("swapBuffers encountered EGL_BAD_SURFACE on %p, halting rendering...", surface); + return false; + } + LOG_ALWAYS_FATAL("Encountered EGL error %d %s during rendering", + err, egl_error_str(err)); + // Impossible to hit this, but the compiler doesn't know that + return false; } bool EglManager::enableDirtyRegions(EGLSurface surface) { |