diff options
Diffstat (limited to 'Source/WebCore/platform/graphics/android')
8 files changed, 39 insertions, 79 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp index 283fa58..085a356 100644 --- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp @@ -78,6 +78,7 @@ IFrameLayerAndroid* BaseLayerAndroid::updatePosition(SkRect viewport, void BaseLayerAndroid::updatePositionsRecursive(const SkRect& visibleContentRect) { + TRACE_METHOD(); updateLayerPositions(visibleContentRect); TransformationMatrix ident; FloatRect clip(0, 0, getWidth(), getHeight()); diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp index 182e811..b60b791 100644 --- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp @@ -330,6 +330,8 @@ void LayerAndroid::removeAnimationsForKeyframes(const String& name) // FIXME: use a real mask? void LayerAndroid::setMaskLayer(LayerAndroid* layer) { + SkSafeRef(layer); + SkSafeUnref(m_maskLayer); m_maskLayer = layer; if (layer) m_haveClip = true; diff --git a/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp b/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp index 8452503..316b7fd 100644 --- a/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/ImagesManager.cpp @@ -52,6 +52,7 @@ ImageTexture* ImagesManager::setImage(SkBitmapRef* imgRef) if (!imgRef) return 0; + TRACE_METHOD(); SkBitmap* bitmap = &imgRef->bitmap(); ImageTexture* image = 0; SkBitmap* img = 0; diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp index f577d46..83b81a1 100644 --- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp @@ -84,6 +84,7 @@ SurfaceCollection::~SurfaceCollection() void SurfaceCollection::prepareGL(const SkRect& visibleContentRect, bool tryToFastBlit) { + TRACE_METHOD(); updateLayerPositions(visibleContentRect); bool layerTilesDisabled = m_compositedRoot->state()->layersRenderingMode() > GLWebViewState::kClippedTextures; @@ -106,6 +107,7 @@ static inline bool compareSurfaceZ(const Surface* a, const Surface* b) bool SurfaceCollection::drawGL(const SkRect& visibleContentRect) { + TRACE_METHOD(); #ifdef DEBUG_COUNT ClassTracker::instance()->show(); #endif @@ -135,6 +137,7 @@ Color SurfaceCollection::getBackgroundColor() void SurfaceCollection::swapTiles() { + TRACE_METHOD(); for (unsigned int i = 0; i < m_surfaces.size(); i++) m_surfaces[i]->swapTiles(); } 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; diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp index 58e7d7b..f37afa4 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.cpp @@ -154,7 +154,6 @@ bool TransferQueue::checkObsolete(const TileTransferData* data) } void TransferQueue::blitTileFromQueue(GLuint fboID, TileTexture* destTex, - TileTexture* frontTex, GLuint srcTexId, GLenum srcTexTarget, int index) { @@ -173,7 +172,14 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, TileTexture* destTex, glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, textureWidth, textureHeight); - + if (GLUtils::checkGlError("At the end of blitTileFromQueue()")) { +#ifndef DEBUG + if (GLUtils::allowGLLog()) +#endif + ALOGE("blitTileFromQueue ERROR: fboId %d, destTexId %d, srcTexId %d," + " textureWidth %d, textureHeight %d", fboID, destTex->m_ownTextureId, + srcTexId, textureWidth, textureHeight); + } #else // Then set up the FBO and copy the SurfTex content in. glBindFramebuffer(GL_FRAMEBUFFER, fboID); @@ -195,23 +201,6 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, TileTexture* destTex, TextureQuadData data(srcTexId, GL_NEAREST, srcTexTarget, Blit, 0, 0, 1.0, false); TilesManager::instance()->shader()->drawQuad(&data); - - // To workaround a sync issue on some platforms, we should insert the sync - // here while in the current FBO. - // This will essentially kick off the GPU command buffer, and the Tex Gen - // thread will then have to wait for this buffer to finish before writing - // into the same memory. - EGLDisplay dpy = eglGetCurrentDisplay(); - if (m_currentDisplay != dpy) - m_currentDisplay = dpy; - if (m_currentDisplay != EGL_NO_DISPLAY) { - if (m_transferQueue[index].m_syncKHR != EGL_NO_SYNC_KHR) - eglDestroySyncKHR(m_currentDisplay, m_transferQueue[index].m_syncKHR); - m_transferQueue[index].m_syncKHR = eglCreateSyncKHR(m_currentDisplay, - EGL_SYNC_FENCE_KHR, - 0); - } - GLUtils::checkEglError("CreateSyncKHR"); #endif } @@ -230,22 +219,6 @@ bool TransferQueue::readyForUpdate() if (!getHasGLContext()) return false; - // Disable this wait until we figure out why this didn't work on some - // drivers b/5332112. -#if 0 - if (m_currentUploadType == GpuUpload - && m_currentDisplay != EGL_NO_DISPLAY) { - // Check the GPU fence - EGLSyncKHR syncKHR = m_transferQueue[getNextTransferQueueIndex()].m_syncKHR; - if (syncKHR != EGL_NO_SYNC_KHR) - eglClientWaitSyncKHR(m_currentDisplay, - syncKHR, - EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, - EGL_FOREVER_KHR); - } - GLUtils::checkEglError("WaitSyncKHR"); -#endif - return true; } @@ -359,13 +332,8 @@ void TransferQueue::updateDirtyTiles() // Save the needed info, update the Surf Tex, clean up the item in // the queue. Then either move on to next item or copy the content. TileTexture* destTexture = 0; - TileTexture* frontTexture = 0; - if (!obsoleteTile) { + if (!obsoleteTile) destTexture = m_transferQueue[index].savedTilePtr->backTexture(); - // while destTexture is guaranteed to not be null, frontTexture - // might be (first transfer) - frontTexture = m_transferQueue[index].savedTilePtr->frontTexture(); - } if (m_transferQueue[index].uploadType == GpuUpload) { status_t result = m_sharedSurfaceTexture->updateTexImage(); @@ -382,7 +350,7 @@ void TransferQueue::updateDirtyTiles() // guarantee that we have a texture to blit into destTexture->requireGLTexture(); - + GLUtils::checkGlError("before blitTileFromQueue"); if (m_transferQueue[index].uploadType == CpuUpload) { // Here we just need to upload the bitmap content to the GL Texture GLUtils::updateTextureWithBitmap(destTexture->m_ownTextureId, @@ -392,8 +360,7 @@ void TransferQueue::updateDirtyTiles() saveGLState(); usedFboForUpload = true; } - blitTileFromQueue(m_fboID, destTexture, frontTexture, - m_sharedSurfaceTextureId, + blitTileFromQueue(m_fboID, destTexture, m_sharedSurfaceTextureId, m_sharedSurfaceTexture->getCurrentTextureTarget(), index); } diff --git a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h index 9d33ff5..c0835d7 100644 --- a/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h +++ b/Source/WebCore/platform/graphics/android/rendering/TransferQueue.h @@ -80,7 +80,6 @@ public: , savedTileTexturePtr(0) , uploadType(DEFAULT_UPLOAD_TYPE) , bitmap(0) - , m_syncKHR(EGL_NO_SYNC_KHR) { } @@ -101,15 +100,6 @@ public: // Specific data to the pure color tiles' queue. Color pureColor; - - // Sync object for GPU fence, this is the only the info passed from UI - // thread to Tex Gen thread. The reason of having this is due to the - // missing sync mechanism on Surface Texture on some vendor. b/5122031. - // Bascially the idea is that when UI thread utilize one buffer from - // the surface texture, we'll need to kick off the GPU commands, and only - // when those particular commands finish, we could write into this buffer - // again in Tex Gen thread. - EGLSyncKHR m_syncKHR; }; class TransferQueue { @@ -177,7 +167,6 @@ private: void cleanupGLResources(); void blitTileFromQueue(GLuint fboID, TileTexture* destTex, - TileTexture* frontTex, GLuint srcTexId, GLenum srcTexTarget, int index); |