diff options
author | John Reck <jreck@google.com> | 2015-07-16 09:17:59 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2015-07-16 09:17:59 -0700 |
commit | f2dcc2aecb94e726096256c47b913ed0a57ae7e2 (patch) | |
tree | 927778287d0b2d9610ad1efe74fe37e83d6d4032 /libs/hwui/renderthread/EglManager.cpp | |
parent | 30c8245afc8d9558b76e5c86f917c22e02f6e820 (diff) | |
download | frameworks_base-f2dcc2aecb94e726096256c47b913ed0a57ae7e2.zip frameworks_base-f2dcc2aecb94e726096256c47b913ed0a57ae7e2.tar.gz frameworks_base-f2dcc2aecb94e726096256c47b913ed0a57ae7e2.tar.bz2 |
Don't crash on makeCurrent fail
Bug: 22444755
WindowManager may decide to yank the surface at any point, so
attempt to kinda handle this
Change-Id: Id2f665d2f0f93bccd4ec977fbf52dca4dc1ec891
Diffstat (limited to 'libs/hwui/renderthread/EglManager.cpp')
-rw-r--r-- | libs/hwui/renderthread/EglManager.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/EglManager.cpp b/libs/hwui/renderthread/EglManager.cpp index cb34e00..eb332d5 100644 --- a/libs/hwui/renderthread/EglManager.cpp +++ b/libs/hwui/renderthread/EglManager.cpp @@ -217,7 +217,7 @@ void EglManager::destroy() { mCurrentSurface = EGL_NO_SURFACE; } -bool EglManager::makeCurrent(EGLSurface surface) { +bool EglManager::makeCurrent(EGLSurface surface, EGLint* errOut) { if (isCurrent(surface)) return false; if (surface == EGL_NO_SURFACE) { @@ -225,8 +225,14 @@ bool EglManager::makeCurrent(EGLSurface surface) { surface = mPBufferSurface; } if (!eglMakeCurrent(mEglDisplay, surface, surface, mEglContext)) { - LOG_ALWAYS_FATAL("Failed to make current on surface %p, error=%s", - (void*)surface, egl_error_str()); + if (errOut) { + *errOut = eglGetError(); + ALOGW("Failed to make current on surface %p, error=%s", + (void*)surface, egl_error_str(*errOut)); + } else { + LOG_ALWAYS_FATAL("Failed to make current on surface %p, error=%s", + (void*)surface, egl_error_str()); + } } mCurrentSurface = surface; return true; |