From 8da5f07dec1d3812a318f192284fad39f7215194 Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Thu, 15 Sep 2011 13:58:26 -0700 Subject: Share the display from the UI thread Currently disable the wait b/c b/5332112. For now it should be the same functionality as the original workaround by using glDraw. bug:5270526 Change-Id: Ia6d6739909994d6ed756c6b195e6cf7ee9518c54 --- .../platform/graphics/android/TransferQueue.cpp | 38 ++++++++++++++-------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/TransferQueue.cpp') diff --git a/Source/WebCore/platform/graphics/android/TransferQueue.cpp b/Source/WebCore/platform/graphics/android/TransferQueue.cpp index df9aede..918d484 100644 --- a/Source/WebCore/platform/graphics/android/TransferQueue.cpp +++ b/Source/WebCore/platform/graphics/android/TransferQueue.cpp @@ -60,6 +60,7 @@ TransferQueue::TransferQueue() , m_fboID(0) , m_sharedSurfaceTextureId(0) , m_hasGLContext(true) + , m_currentDisplay(EGL_NO_DISPLAY) { memset(&m_GLStateBeforeBlit, 0, sizeof(m_GLStateBeforeBlit)); @@ -164,14 +165,16 @@ void TransferQueue::blitTileFromQueue(GLuint fboID, BaseTileTexture* destTex, // thread will then have to wait for this buffer to finish before writing // into the same memory. EGLDisplay dpy = eglGetCurrentDisplay(); - if (m_transferQueue[index].m_syncKHR != EGL_NO_SYNC_KHR) - eglDestroySyncKHR(dpy, m_transferQueue[index].m_syncKHR); - m_transferQueue[index].m_syncKHR = eglCreateSyncKHR(eglGetCurrentDisplay(), - EGL_SYNC_FENCE_KHR, - 0); - if (m_transferQueue[index].m_syncKHR == EGL_NO_SYNC_KHR) - XLOGC("ERROR: eglClientWaitSyncKHR return error"); - + 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"); // Clean up FBO setup. glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO @@ -207,11 +210,20 @@ bool TransferQueue::readyForUpdate() if (!getHasGLContext()) return false; - // Check the GPU fence - eglClientWaitSyncKHR(eglGetCurrentDisplay(), - m_transferQueue[getNextTransferQueueIndex()].m_syncKHR, - EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, - EGL_FOREVER_KHR); + // Disable this wait until we figure out why this didn't work on some + // drivers b/5332112. +#if 0 + if (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; } -- cgit v1.1