Skip to content
  • commit-queue@webkit.org's avatar
    [BlackBerry] Get rid of glCopyTexImage2D in Canvas and WebGL code paths · fa0bb6d9
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=93614
    
    Patch by Arvid Nilsson <anilsson@rim.com> on 2012-08-14
    Reviewed by Antonio Gomes.
    
    We used to set up resource sharing between the compositing thread
    context and the Canvas and WebGL contexts, and use glCopyTexImage2D to
    get a copy of the framebuffer to use as front buffer for compositing
    purposes.
    
    Now we instead create an EGLImage and blit the Canvas/WebGL output to
    it. The compositing thread creates a texture from the EGLImage in order
    to composite the output.
    
    Source/WebCore:
    
    Created a new EGLImageLayerWebKitThread base class that handles the
    EGLImage and does the blitting. CanvasLayerWebKitThread and
    WebGLLayerWebKitThread now inherit from this new base class.
    
    However, we need to be careful to restore state after the blit because
    it's done using the Canvas/WebGL context.
    
    The BlackBerry implementation of GraphicsContext3D::prepareTexture()
    was changed to no longer call glCopyTexImage, and
    GraphicsContext3D::platformLayer() now returns the target texture
    directly.
    
    Reviewed internally by Filip Spacek.
    
    PR 188472
    
    No change in behavior, new tests.
    
    * PlatformBlackBerry.cmake:
    * platform/graphics/blackberry/CanvasLayerWebKitThread.cpp:
    (WebCore::CanvasLayerWebKitThread::CanvasLayerWebKitThread):
    (WebCore::CanvasLayerWebKitThread::~CanvasLayerWebKitThread):
    (WebCore::CanvasLayerWebKitThread::setDevice):
    (WebCore::CanvasLayerWebKitThread::makeContextCurrent):
    (WebCore::CanvasLayerWebKitThread::textureSize):
    (WebCore):
    (WebCore::CanvasLayerWebKitThread::textureID):
    * platform/graphics/blackberry/CanvasLayerWebKitThread.h:
    (CanvasLayerWebKitThread):
    * platform/graphics/blackberry/EGLImageLayerCompositingThreadClient.cpp: Added.
    (WebCore):
    (WebCore::EGLImageLayerCompositingThreadClient::~EGLImageLayerCompositingThreadClient):
    (WebCore::EGLImageLayerCompositingThreadClient::uploadTexturesIfNeeded):
    (WebCore::EGLImageLayerCompositingThreadClient::drawTextures):
    (WebCore::EGLImageLayerCompositingThreadClient::deleteTextures):
    (WebCore::EGLImageLayerCompositingThreadClient::bindContentsTexture):
    (WebCore::EGLImageLayerCompositingThreadClient::setImage):
    * platform/graphics/blackberry/EGLImageLayerCompositingThreadClient.h: Added.
    (WebCore):
    (EGLImageLayerCompositingThreadClient):
    (WebCore::EGLImageLayerCompositingThreadClient::create):
    (WebCore::EGLImageLayerCompositingThreadClient::layerCompositingThreadDestroyed):
    (WebCore::EGLImageLayerCompositingThreadClient::layerVisibilityChanged):
    (WebCore::EGLImageLayerCompositingThreadClient::EGLImageLayerCompositingThreadClient):
    * platform/graphics/blackberry/EGLImageLayerWebKitThread.cpp: Added.
    (WebCore):
    (WebCore::EGLImageLayerWebKitThread::EGLImageLayerWebKitThread):
    (WebCore::EGLImageLayerWebKitThread::~EGLImageLayerWebKitThread):
    (WebCore::EGLImageLayerWebKitThread::setNeedsDisplay):
    (WebCore::EGLImageLayerWebKitThread::makeContextCurrent):
    (WebCore::EGLImageLayerWebKitThread::updateTextureContentsIfNeeded):
    (WebCore::EGLImageLayerWebKitThread::commitPendingTextureUploads):
    (WebCore::EGLImageLayerWebKitThread::createImageIfNeeded):
    (WebCore::EGLImageLayerWebKitThread::createShaderIfNeeded):
    (WebCore::EGLImageLayerWebKitThread::drawTexture):
    * platform/graphics/blackberry/EGLImageLayerWebKitThread.h: Copied from Source/WebCore/platform/graphics/blackberry/CanvasLayerWebKitThread.h.
    (WebCore):
    (EGLImageLayerWebKitThread):
    * platform/graphics/blackberry/GraphicsContext3DBlackBerry.cpp:
    (WebCore::GraphicsContext3D::prepareTexture):
    (WebCore):
    (WebCore::GraphicsContext3D::platformTexture):
    * platform/graphics/blackberry/LayerCompositingThread.cpp:
    (WebCore::LayerCompositingThread::drawTextures):
    (WebCore::LayerCompositingThread::releaseTextureResources):
    * platform/graphics/blackberry/LayerCompositingThread.h:
    (WebCore::LayerCompositingThread::setClient):
    (LayerCompositingThread):
    * platform/graphics/blackberry/LayerData.h:
    (WebCore::LayerData::LayerData):
    (LayerData):
    * platform/graphics/blackberry/LayerWebKitThread.cpp:
    (WebCore::LayerWebKitThread::~LayerWebKitThread):
    (WebCore::LayerWebKitThread::updateTextureContentsIfNeeded):
    (WebCore::LayerWebKitThread::commitPendingTextureUploads):
    (WebCore::LayerWebKitThread::commitOnCompositingThread):
    * platform/graphics/blackberry/LayerWebKitThread.h:
    (LayerWebKitThread):
    * platform/graphics/blackberry/WebGLLayerWebKitThread.cpp:
    (WebCore::WebGLLayerWebKitThread::WebGLLayerWebKitThread):
    (WebCore::WebGLLayerWebKitThread::updateTextureContentsIfNeeded):
    (WebCore::WebGLLayerWebKitThread::makeContextCurrent):
    (WebCore):
    (WebCore::WebGLLayerWebKitThread::textureSize):
    (WebCore::WebGLLayerWebKitThread::textureID):
    * platform/graphics/blackberry/WebGLLayerWebKitThread.h:
    (WebGLLayerWebKitThread):
    * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
    (WebCore):
    (WebCore::GraphicsContext3D::prepareTexture):
    
    Source/WebKit/blackberry:
    
    This allows us to turn off resource sharing, so the WebPageCompositor
    no longer needs to pass the compositing thread context to the webkit
    thread.
    
    Reviewed internally by Filip Spacek.
    
    PR 188472
    
    * Api/WebPage.cpp:
    (BlackBerry::WebKit::WebPagePrivate::setCompositor):
    (BlackBerry::WebKit::WebPagePrivate::setCompositorHelper):
    * Api/WebPageCompositor.cpp:
    (BlackBerry::WebKit::WebPageCompositor::WebPageCompositor):
    (BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor):
    * Api/WebPage_p.h:
    (WebPagePrivate):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125563 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    fa0bb6d9