diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2012-05-22 17:38:31 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2012-05-23 13:18:43 -0700 |
commit | 6c4c0302dd154e5090966c57bb4b6b216644fb01 (patch) | |
tree | 3b9adf28c0ed26094e930c44c48dc501c40fb406 /Source/WebCore/platform/graphics | |
parent | 178513cf52b5aab6eafffcb01ba27364c074e12e (diff) | |
download | external_webkit-6c4c0302dd154e5090966c57bb4b6b216644fb01.zip external_webkit-6c4c0302dd154e5090966c57bb4b6b216644fb01.tar.gz external_webkit-6c4c0302dd154e5090966c57bb4b6b216644fb01.tar.bz2 |
Correctly handle the EGL context recreation.
bug:6516534
Change-Id: Iaf62359803d65d3a9acb88aa224a1a5c42f8aa4c
Diffstat (limited to 'Source/WebCore/platform/graphics')
-rw-r--r-- | Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp | 44 | ||||
-rw-r--r-- | Source/WebCore/platform/graphics/android/rendering/TilesManager.h | 1 |
2 files changed, 21 insertions, 24 deletions
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp index 03ef714..0b4ba7b 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.cpp @@ -456,15 +456,26 @@ void TilesManager::cleanupGLResources() void TilesManager::updateTilesIfContextVerified() { - if (updateContextIfChanged()) { - // A change in EGL context is an unexpected error, but we don't want to - // crash or ANR. Therefore, abandon the Surface Texture and GL resources; - // they'll be recreated later in setupDrawing. (We can't delete them - // since the context is gone) - transferQueue()->resetQueue(); - shader()->forceNeedsInit(); - videoLayerManager()->forceNeedsInit(); - markAllGLTexturesZero(); + EGLContext ctx = eglGetCurrentContext(); + GLUtils::checkEglError("contextChanged"); + if (ctx != m_eglContext) { + if (m_eglContext != EGL_NO_CONTEXT) { + // A change in EGL context is an unexpected error, but we don't want to + // crash or ANR. Therefore, abandon the Surface Texture and GL resources; + // they'll be recreated later in setupDrawing. (We can't delete them + // since the context is gone) + ALOGE("Unexpected : EGLContext changed! current %x , expected %x", + ctx, m_eglContext); + transferQueue()->resetQueue(); + shader()->forceNeedsInit(); + videoLayerManager()->forceNeedsInit(); + markAllGLTexturesZero(); + } else { + // This is the first time we went into this new EGL context. + // We will have the GL resources to be re-inited and we can't update + // dirty tiles yet. + ALOGD("new EGLContext from framework: %x ", ctx); + } } else { // Here before we draw, update the Tile which has updated content. // Inside this function, just do GPU blits from the transfer queue into @@ -473,21 +484,8 @@ void TilesManager::updateTilesIfContextVerified() // Clean up GL textures for video layer. videoLayerManager()->deleteUnusedTextures(); } -} - -// Return true if context has changed, which indicate an error we should look -// into. -bool TilesManager::updateContextIfChanged() -{ - bool changed = false; - EGLContext ctx = eglGetCurrentContext(); - GLUtils::checkEglError("contextChanged"); - if (ctx != m_eglContext && m_eglContext != EGL_NO_CONTEXT) { - ALOGE("Unexpected : EGLContext changed! current %x , expected %x", ctx, m_eglContext); - changed = true; - } m_eglContext = ctx; - return changed; + return; } int TilesManager::tileWidth() diff --git a/Source/WebCore/platform/graphics/android/rendering/TilesManager.h b/Source/WebCore/platform/graphics/android/rendering/TilesManager.h index ce5904f..f0d2eac 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TilesManager.h +++ b/Source/WebCore/platform/graphics/android/rendering/TilesManager.h @@ -173,7 +173,6 @@ private: bool deallocateGLTextures); void dirtyTexturesVector(WTF::Vector<TileTexture*>& textures); void markAllGLTexturesZero(); - bool updateContextIfChanged(); int getMaxTextureAllocation(); WTF::Vector<TileTexture*> m_textures; |