[WebGL][EFL] Refactor GraphicsContext3DPrivate to add support for SharedContext.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2013 16:15:55 +0000 (16:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2013 16:15:55 +0000 (16:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109988

Patch by Kondapally Kalyan <kalyan.kondapally@intel.com> on 2013-02-18
Reviewed by Kenneth Rohde Christiansen.

Covered by existing WebGL tests.

This patch refactors PlatformContext and GraphicsContext3DPrivate to
add support for Shared Context. This would help share GL resources
between transport surface and offscreen surface without having to worry
about the context state. So far, we used the same drawable as transport
surface and offscreen surface. After this patch we use pixmap surface as
offscreen surface and use shared context to render texture content to
transport surface. This would also align as to how shared surface is implemented
on EFL and Qt ports.

* platform/graphics/efl/GraphicsContext3DEfl.cpp:
(WebCore::GraphicsContext3D::GraphicsContext3D):
* platform/graphics/efl/GraphicsContext3DPrivate.cpp:
(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore):
(WebCore::GraphicsContext3DPrivate::initialize):
(WebCore::GraphicsContext3DPrivate::makeSharedContextCurrent):
(WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface):
* platform/graphics/efl/GraphicsContext3DPrivate.h:
(GraphicsContext3DPrivate):
* platform/graphics/opengl/GLPlatformContext.cpp:
(WebCore::GLPlatformContext::initialize):
* platform/graphics/opengl/GLPlatformContext.h:
Needed changes to take shared context into use.

* platform/graphics/opengl/GLPlatformSurface.cpp:
(WebCore::GLPlatformSurface::createOffScreenSurface):
(WebCore::GLPlatformSurface::updateContents):
* platform/graphics/opengl/GLPlatformSurface.h:
(GLPlatformSurface):
* platform/graphics/surfaces/glx/GLXConfigSelector.h:
(WebCore::GLXConfigSelector::GLXConfigSelector):
(WebCore::GLXConfigSelector::visualInfo):
(WebCore::GLXConfigSelector::pixmapContextConfig):
(GLXConfigSelector):
(WebCore::GLXConfigSelector::reset):
* platform/graphics/surfaces/glx/GLXContext.cpp:
Added support to query configiration supporting
pixmap surface.

(WebCore::GLXOffScreenContext::initialize):
* platform/graphics/surfaces/glx/GLXContext.h:
(GLXOffScreenContext):
* platform/graphics/surfaces/glx/GLXSurface.cpp:
(WebCore::GLXTransportSurface::GLXTransportSurface):
(WebCore::GLXTransportSurface::swapBuffers):
(WebCore::GLXOffScreenSurface::GLXOffScreenSurface):
(WebCore::GLXOffScreenSurface::~GLXOffScreenSurface):
(WebCore::GLXOffScreenSurface::initialize):
(WebCore::GLXOffScreenSurface::configuration):
(WebCore::GLXOffScreenSurface::destroy):
(WebCore::GLXOffScreenSurface::freeResources):
(WebCore::GLXOffScreenSurface::setGeometry):
Renamed GLXPBuffer surface as GLXOffScreenSurface.

* platform/graphics/surfaces/glx/GLXSurface.h:
(GLXTransportSurface):
(GLXOffScreenSurface):
* platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp:
(WebCore::GraphicsSurfacePrivate::createSurface):
* platform/graphics/surfaces/glx/X11Helper.cpp:
(WebCore::X11Helper::createPixmap):
(WebCore):
(WebCore::X11Helper::destroyPixmap):
(WebCore::X11Helper::createOffScreenWindow):
* platform/graphics/surfaces/glx/X11Helper.h:
(X11Helper):
Added functions to create and destroy pixmap.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143220 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp
Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.cpp
Source/WebCore/platform/graphics/efl/GraphicsContext3DPrivate.h
Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp
Source/WebCore/platform/graphics/opengl/GLPlatformContext.h
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h
Source/WebCore/platform/graphics/surfaces/egl/EGLContext.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLContext.h
Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h
Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp
Source/WebCore/platform/graphics/surfaces/glx/GLXContext.h
Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp
Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h
Source/WebCore/platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp
Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h

index 58ebf9600ac7b7ba0d0d717189a4df5a94e1ddca..306a65c7fafd24383803a3acb64df37dd58acca5 100644 (file)
@@ -1,3 +1,80 @@
+2013-02-18  Kondapally Kalyan  <kalyan.kondapally@intel.com>
+
+        [WebGL][EFL] Refactor GraphicsContext3DPrivate to add support for SharedContext.
+        https://bugs.webkit.org/show_bug.cgi?id=109988
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Covered by existing WebGL tests.
+
+        This patch refactors PlatformContext and GraphicsContext3DPrivate to
+        add support for Shared Context. This would help share GL resources
+        between transport surface and offscreen surface without having to worry
+        about the context state. So far, we used the same drawable as transport
+        surface and offscreen surface. After this patch we use pixmap surface as
+        offscreen surface and use shared context to render texture content to
+        transport surface. This would also align as to how shared surface is implemented
+        on EFL and Qt ports.
+
+        * platform/graphics/efl/GraphicsContext3DEfl.cpp:
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        * platform/graphics/efl/GraphicsContext3DPrivate.cpp:
+        (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
+        (WebCore):
+        (WebCore::GraphicsContext3DPrivate::initialize):
+        (WebCore::GraphicsContext3DPrivate::makeSharedContextCurrent):
+        (WebCore::GraphicsContext3DPrivate::copyToGraphicsSurface):
+        * platform/graphics/efl/GraphicsContext3DPrivate.h:
+        (GraphicsContext3DPrivate):
+        * platform/graphics/opengl/GLPlatformContext.cpp:
+        (WebCore::GLPlatformContext::initialize):
+        * platform/graphics/opengl/GLPlatformContext.h:
+        Needed changes to take shared context into use.
+
+        * platform/graphics/opengl/GLPlatformSurface.cpp:
+        (WebCore::GLPlatformSurface::createOffScreenSurface):
+        (WebCore::GLPlatformSurface::updateContents):
+        * platform/graphics/opengl/GLPlatformSurface.h:
+        (GLPlatformSurface):
+        * platform/graphics/surfaces/glx/GLXConfigSelector.h:
+        (WebCore::GLXConfigSelector::GLXConfigSelector):
+        (WebCore::GLXConfigSelector::visualInfo):
+        (WebCore::GLXConfigSelector::pixmapContextConfig):
+        (GLXConfigSelector):
+        (WebCore::GLXConfigSelector::reset):
+        * platform/graphics/surfaces/glx/GLXContext.cpp:
+        Added support to query configiration supporting
+        pixmap surface.
+
+        (WebCore::GLXOffScreenContext::initialize):
+        * platform/graphics/surfaces/glx/GLXContext.h:
+        (GLXOffScreenContext):
+        * platform/graphics/surfaces/glx/GLXSurface.cpp:
+        (WebCore::GLXTransportSurface::GLXTransportSurface):
+        (WebCore::GLXTransportSurface::swapBuffers):
+        (WebCore::GLXOffScreenSurface::GLXOffScreenSurface):
+        (WebCore::GLXOffScreenSurface::~GLXOffScreenSurface):
+        (WebCore::GLXOffScreenSurface::initialize):
+        (WebCore::GLXOffScreenSurface::configuration):
+        (WebCore::GLXOffScreenSurface::destroy):
+        (WebCore::GLXOffScreenSurface::freeResources):
+        (WebCore::GLXOffScreenSurface::setGeometry):
+        Renamed GLXPBuffer surface as GLXOffScreenSurface.
+
+        * platform/graphics/surfaces/glx/GLXSurface.h:
+        (GLXTransportSurface):
+        (GLXOffScreenSurface):
+        * platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp:
+        (WebCore::GraphicsSurfacePrivate::createSurface):
+        * platform/graphics/surfaces/glx/X11Helper.cpp:
+        (WebCore::X11Helper::createPixmap):
+        (WebCore):
+        (WebCore::X11Helper::destroyPixmap):
+        (WebCore::X11Helper::createOffScreenWindow):
+        * platform/graphics/surfaces/glx/X11Helper.h:
+        (X11Helper):
+        Added functions to create and destroy pixmap.
+
 2013-02-18  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Web Inspector: Native Memory Instrumentation: Generate meta information for HeapSnapshot parser.
index 2ffbb78d82dcdbf676853866fb1b0091013d2af6..ba473ae5837ca27528bb99b0910091a714d443bf 100644 (file)
@@ -34,9 +34,6 @@ namespace WebCore {
 
 PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, RenderStyle renderStyle)
 {
-    if (renderStyle == RenderDirectlyToHostWindow)
-        return 0;
-
     RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderStyle));
     return context->m_private ? context.release() : 0;
 }
@@ -63,18 +60,16 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi
     , m_multisampleFBO(0)
     , m_multisampleDepthStencilBuffer(0)
     , m_multisampleColorBuffer(0)
-    , m_private(adoptPtr(new GraphicsContext3DPrivate(this, hostWindow, renderStyle)))
+    , m_private(GraphicsContext3DPrivate::create(this, hostWindow))
 {
-    if (!m_private || !m_private->m_platformContext) {
-        m_private = nullptr;
+    if (!m_private)
         return;
-    }
 
     validateAttributes();
 
     if (renderStyle == RenderOffscreen) {
         // Create buffers for the canvas FBO.
-        glGenFramebuffers(/* count */ 1, &m_fbo);
+        glGenFramebuffers(1, &m_fbo);
 
         // Create a texture to render into.
         glGenTextures(1, &m_texture);
@@ -134,30 +129,38 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi
 
 GraphicsContext3D::~GraphicsContext3D()
 {
-    if (!m_private || !makeContextCurrent())
+    if (!m_private || (m_renderStyle == RenderToCurrentGLContext) || !makeContextCurrent())
         return;
 
-    glDeleteTextures(1, &m_texture);
+    glBindFramebuffer(GL_FRAMEBUFFER, 0);
+    glBindTexture(GL_TEXTURE_2D, 0);
+
+    if (m_texture)
+        glDeleteTextures(1, &m_texture);
+
+    if (m_fbo)
+        glDeleteFramebuffers(1, &m_fbo);
 
     if (m_attrs.antialias) {
-        glDeleteRenderbuffers(1, &m_multisampleColorBuffer);
+        if (m_multisampleColorBuffer)
+            glDeleteRenderbuffers(1, &m_multisampleColorBuffer);
 
-        if (m_attrs.stencil || m_attrs.depth)
+        if (m_multisampleDepthStencilBuffer)
             glDeleteRenderbuffers(1, &m_multisampleDepthStencilBuffer);
 
-        glDeleteFramebuffers(1, &m_multisampleFBO);
+        if (m_multisampleFBO)
+            glDeleteFramebuffers(1, &m_multisampleFBO);
     } else if (m_attrs.stencil || m_attrs.depth) {
 #if USE(OPENGL_ES_2)
-        if (m_attrs.depth)
+        if (m_depthBuffer)
             glDeleteRenderbuffers(1, &m_depthBuffer);
 
-        if (m_attrs.stencil)
+        if (m_stencilBuffer)
             glDeleteRenderbuffers(1, &m_stencilBuffer);
 #endif
-        glDeleteRenderbuffers(1, &m_depthStencilBuffer);
+        if (m_depthStencilBuffer)
+            glDeleteRenderbuffers(1, &m_depthStencilBuffer);
     }
-
-    m_private->releaseResources();
 }
 
 PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D()
index d109567a881856ff9b755c30c2eed146d8c2b3bb..3d601fe2f87686c0258b2a0ce676511be699e85e 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 2012 Samsung Electronics
-    Copyright (C) 2012 Intel Corporation.
+    Copyright (C) 2012 Intel Corporation. All rights reserved.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
 
 namespace WebCore {
 
-GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle)
+PassOwnPtr<GraphicsContext3DPrivate> GraphicsContext3DPrivate::create(GraphicsContext3D* context, HostWindow* hostWindow)
+{
+    OwnPtr<GraphicsContext3DPrivate> platformLayer = adoptPtr(new GraphicsContext3DPrivate(context, hostWindow));
+
+    if (platformLayer && platformLayer->initialize())
+        return platformLayer.release();
+
+    return nullptr;
+}
+
+GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, HostWindow* hostWindow)
     : m_context(context)
     , m_hostWindow(hostWindow)
-    , m_pendingSurfaceResize(false)
 {
+}
+
+bool GraphicsContext3DPrivate::initialize()
+{
+    if (m_context->m_renderStyle == GraphicsContext3D::RenderDirectlyToHostWindow)
+        return false;
+
     if (m_hostWindow && m_hostWindow->platformPageClient()) {
         // FIXME: Implement this code path for WebKit1.
         // Get Evas object from platformPageClient and set EvasGL related members.
-        return;
+        return false;
     }
 
-    m_platformContext = GLPlatformContext::createContext(renderStyle);
-    if (!m_platformContext)
-        return;
+    m_offScreenContext = GLPlatformContext::createContext(m_context->m_renderStyle);
+    if (!m_offScreenContext)
+        return false;
 
-    if (renderStyle == GraphicsContext3D::RenderOffscreen) {
+    if (m_context->m_renderStyle == GraphicsContext3D::RenderOffscreen) {
 #if USE(GRAPHICS_SURFACE)
-        m_platformSurface = GLPlatformSurface::createTransportSurface();
-#else
-        m_platformSurface = GLPlatformSurface::createOffscreenSurface();
+        m_sharedSurface = GLPlatformSurface::createTransportSurface();
+        if (!m_sharedSurface)
+            return false;
+
+        m_sharedContext = GLPlatformContext::createContext(m_context->m_renderStyle);
+        if (!m_sharedContext)
+            return false;
 #endif
-        if (!m_platformSurface) {
-            m_platformContext = nullptr;
-            return;
-        }
 
-        if (!m_platformContext->initialize(m_platformSurface.get()) || !m_platformContext->makeCurrent(m_platformSurface.get())) {
-            releaseResources();
-            m_platformContext = nullptr;
-            m_platformSurface = nullptr;
+        m_offScreenSurface = GLPlatformSurface::createOffScreenSurface();
+
+        if (!m_offScreenSurface)
+            return false;
+
+        if (!m_offScreenContext->initialize(m_offScreenSurface.get()))
+            return false;
+
 #if USE(GRAPHICS_SURFACE)
-        } else
-            m_surfaceHandle = GraphicsSurfaceToken(m_platformSurface->handle());
-#else
-        }
+        if (!m_sharedContext->initialize(m_sharedSurface.get(), m_offScreenContext->handle()))
+            return false;
+
+        if (!makeSharedContextCurrent())
+            return false;
+
+        m_surfaceHandle = GraphicsSurfaceToken(m_sharedSurface->handle());
 #endif
     }
+
+    if (!makeContextCurrent())
+        return false;
+
+    return true;
 }
 
 GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
 {
+    releaseResources();
 }
 
 void GraphicsContext3DPrivate::releaseResources()
 {
+    if (m_context->m_renderStyle == GraphicsContext3D::RenderToCurrentGLContext)
+        return;
+
     // Release the current context and drawable only after destroying any associated gl resources.
-    if (m_platformSurface)
-        m_platformSurface->destroy();
+#if USE(GRAPHICS_SURFACE)
+    if (m_sharedContext && m_sharedContext->handle() && m_sharedSurface)
+        makeSharedContextCurrent();
 
-    if (m_platformContext) {
-        m_platformContext->destroy();
-        m_platformContext->releaseCurrent();
+    if (m_sharedSurface)
+        m_sharedSurface->destroy();
+
+    if (m_sharedContext) {
+        m_sharedContext->destroy();
+        m_sharedContext->releaseCurrent();
+    }
+#endif
+    if (m_offScreenSurface)
+        m_offScreenSurface->destroy();
+
+    if (m_offScreenContext) {
+        m_offScreenContext->destroy();
+        m_offScreenContext->releaseCurrent();
     }
 }
 
@@ -96,50 +140,31 @@ void GraphicsContext3DPrivate::setContextLostCallback(PassOwnPtr<GraphicsContext
 
 PlatformGraphicsContext3D GraphicsContext3DPrivate::platformGraphicsContext3D() const
 {
-    return m_platformContext->handle();
+    return m_offScreenContext->handle();
 }
 
-bool GraphicsContext3DPrivate::makeContextCurrent()
+bool GraphicsContext3DPrivate::makeContextCurrent() const
 {
-    bool success = m_platformContext->makeCurrent(m_platformSurface.get());
+    bool success = m_offScreenContext->makeCurrent(m_offScreenSurface.get());
 
-    if (!m_platformContext->isValid()) {
+    if (!m_offScreenContext->isValid()) {
         // FIXME: Restore context
         if (m_contextLostCallback)
             m_contextLostCallback->onContextLost();
 
-        success = false;
+        return false;
     }
 
     return success;
 }
 
-#if USE(TEXTURE_MAPPER_GL)
-void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper*, const FloatRect& /* target */, const TransformationMatrix&, float /* opacity */, BitmapTexture* /* mask */)
+bool GraphicsContext3DPrivate::prepareBuffer() const
 {
-    notImplemented();
-}
-#endif
-
-#if USE(GRAPHICS_SURFACE)
-void GraphicsContext3DPrivate::didResizeCanvas(const IntSize& size)
-{
-    m_pendingSurfaceResize = true;
-    m_size = size;
-}
-
-uint32_t GraphicsContext3DPrivate::copyToGraphicsSurface()
-{
-    if (!m_platformContext || !makeContextCurrent())
-        return 0;
+    if (!makeContextCurrent())
+        return false;
 
     m_context->markLayerComposited();
 
-    if (m_pendingSurfaceResize) {
-        m_pendingSurfaceResize = false;
-        m_platformSurface->setGeometry(IntRect(0, 0, m_context->m_currentWidth, m_context->m_currentHeight));
-    }
-
     if (m_context->m_attrs.antialias) {
         bool enableScissorTest = false;
         int width = m_context->m_currentWidth;
@@ -161,8 +186,46 @@ uint32_t GraphicsContext3DPrivate::copyToGraphicsSurface()
             m_context->enable(GraphicsContext3D::SCISSOR_TEST);
     }
 
-    m_platformSurface->updateContents(m_context->m_texture, m_context->m_boundFBO, m_context->m_boundTexture0);
+    return true;
+}
 
+#if USE(TEXTURE_MAPPER_GL)
+void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper*, const FloatRect& /* target */, const TransformationMatrix&, float /* opacity */, BitmapTexture* /* mask */)
+{
+    notImplemented();
+}
+#endif
+
+#if USE(GRAPHICS_SURFACE)
+bool GraphicsContext3DPrivate::makeSharedContextCurrent() const
+{
+    bool success = m_sharedContext->makeCurrent(m_sharedSurface.get());
+
+    if (!m_sharedContext->isValid()) {
+        // FIXME: Restore context
+        if (m_contextLostCallback)
+            m_contextLostCallback->onContextLost();
+
+        return false;
+    }
+
+    return success;
+}
+
+void GraphicsContext3DPrivate::didResizeCanvas(const IntSize& size)
+{
+    m_size = size;
+    m_sharedSurface->setGeometry(IntRect(0, 0, m_size.width(), m_size.height()));
+}
+
+uint32_t GraphicsContext3DPrivate::copyToGraphicsSurface()
+{
+    if (m_context->m_layerComposited || !prepareBuffer() || !makeSharedContextCurrent())
+        return 0;
+
+    m_sharedSurface->updateContents(m_context->m_texture);
+    makeContextCurrent();
+    glBindFramebuffer(GL_FRAMEBUFFER,  m_context->m_boundFBO);
     return 0;
 }
 
@@ -175,7 +238,6 @@ IntSize GraphicsContext3DPrivate::platformLayerSize() const
 {
     return m_size;
 }
-
 #endif
 
 } // namespace WebCore
index 2eb2f75871d0dcd9152a1865baf055e9546204b5..b30096a6a9a8d758a79dcc29dce16d58a859796d 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 2012 Samsung Electronics
-    Copyright (C) 2012 Intel Corporation.
+    Copyright (C) 2012 Intel Corporation. All rights reserved.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -41,37 +41,42 @@ class GraphicsContext3DPrivate
 #endif
 {
 public:
-    GraphicsContext3DPrivate(GraphicsContext3D*, HostWindow*, GraphicsContext3D::RenderStyle);
+    static PassOwnPtr<GraphicsContext3DPrivate> create(GraphicsContext3D*, HostWindow*);
     ~GraphicsContext3DPrivate();
 
     bool createSurface(PageClientEfl*, bool);
     PlatformGraphicsContext3D platformGraphicsContext3D() const;
-    void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>  callBack);
-#if USE(ACCELERATED_COMPOSITING)
-    PlatformLayer* platformLayer() const;
-#endif
+    void setContextLostCallback(PassOwnPtr<GraphicsContext3D::ContextLostCallback>);
 #if USE(TEXTURE_MAPPER_GL)
-    virtual void paintToTextureMapper(TextureMapper*, const FloatRect& target, const TransformationMatrix&, float opacity, BitmapTexture* mask);
+    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) OVERRIDE;
 #endif
 #if USE(GRAPHICS_SURFACE)
-    virtual IntSize platformLayerSize() const;
-    virtual uint32_t copyToGraphicsSurface();
-    virtual GraphicsSurfaceToken graphicsSurfaceToken() const;
+    virtual IntSize platformLayerSize() const OVERRIDE;
+    virtual uint32_t copyToGraphicsSurface() OVERRIDE;
+    virtual GraphicsSurfaceToken graphicsSurfaceToken() const OVERRIDE;
     void didResizeCanvas(const IntSize&);
 #endif
-    bool makeContextCurrent();
+    bool makeContextCurrent() const;
+
+private:
+    GraphicsContext3DPrivate(GraphicsContext3D*, HostWindow*);
+    bool initialize();
+    bool prepareBuffer() const;
     void releaseResources();
-    GraphicsContext3D::Attributes m_attributes;
+#if USE(GRAPHICS_SURFACE)
+    bool makeSharedContextCurrent() const;
+#endif
     GraphicsContext3D* m_context;
     HostWindow* m_hostWindow;
-    OwnPtr<GLPlatformContext> m_platformContext;
-    OwnPtr<GLPlatformSurface> m_platformSurface;
+    OwnPtr<GLPlatformContext> m_offScreenContext;
+    OwnPtr<GLPlatformSurface> m_offScreenSurface;
 #if USE(GRAPHICS_SURFACE)
+    OwnPtr<GLPlatformContext> m_sharedContext;
+    OwnPtr<GLPlatformSurface> m_sharedSurface;
     GraphicsSurfaceToken m_surfaceHandle;
 #endif
     OwnPtr<GraphicsContext3D::ContextLostCallback> m_contextLostCallback;
     ListHashSet<GC3Denum> m_syntheticErrors;
-    bool m_pendingSurfaceResize;
     IntSize m_size;
 };
 
@@ -80,3 +85,4 @@ public:
 #endif
 
 #endif
+
index 4d440f889ccc0be9fd010e17c92be66cb27efd4b..ced7bb8574577d8cf7b85e71a86bb96347dc9621 100644 (file)
@@ -207,7 +207,7 @@ bool GLPlatformContext::makeCurrent(GLPlatformSurface* surface)
 
     m_currentContext = 0;
 
-    if (!surface || (surface && !surface->handle()))
+    if (!surface || (surface && !surface->drawable()))
         platformReleaseCurrent();
     else if (platformMakeCurrent(surface))
         m_currentContext = this;
@@ -262,7 +262,7 @@ bool GLPlatformContext::isCurrentContext() const
     return true;
 }
 
-bool GLPlatformContext::initialize(GLPlatformSurface*)
+bool GLPlatformContext::initialize(GLPlatformSurface*, PlatformContext)
 {
     return true;
 }
index 3e1362497bac1d0784345f679e60fb9f753046f3..2e41db3da2c490d5696c4336d86bcc47f50c1b47 100644 (file)
@@ -63,7 +63,7 @@ public:
 
     virtual ~GLPlatformContext();
 
-    virtual bool initialize(GLPlatformSurface*);
+    virtual bool initialize(GLPlatformSurface*, PlatformContext = 0);
 
     // Makes this and surface as current context and drawable.
     // Calling this function with no surface is same as calling releaseCurrent.
index 7f7a564b0bb3f93c8f76c825c8ce51f7f4d13c00..071a83b77cea0d750fe2cb2085e4b114f8c8c953 100644 (file)
 
 namespace WebCore {
 
-PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffscreenSurface()
+PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffScreenSurface()
 {
 #if USE(GLX)
-    OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXPBuffer());
+    OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXOffScreenSurface());
 
-    if (surface->handle() && surface->drawable())
+    if (surface->drawable())
         return surface.release();
 #endif
 
@@ -54,7 +54,6 @@ PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffscreenSurface()
 
 PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createTransportSurface()
 {
-#if USE(GRAPHICS_SURFACE)
 #if USE(GLX)
     OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXTransportSurface());
 #elif USE(EGL)
@@ -63,14 +62,12 @@ PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createTransportSurface()
 
     if (surface && surface->handle() && surface->drawable())
         return surface.release();
-#endif
 
     return nullptr;
 }
 
 GLPlatformSurface::GLPlatformSurface()
-    : m_restoreNeeded(true)
-    , m_fboId(0)
+    : m_fboId(0)
     , m_sharedDisplay(0)
     , m_drawable(0)
     , m_bufferHandle(0)
@@ -111,13 +108,11 @@ void GLPlatformSurface::swapBuffers()
     notImplemented();
 }
 
-void GLPlatformSurface::updateContents(const uint32_t texture, const GLuint bindFboId, const uint32_t bindTexture)
+void GLPlatformSurface::updateContents(const uint32_t texture)
 {
     if (!m_fboId)
         glGenFramebuffers(1, &m_fboId);
 
-    m_restoreNeeded = false;
-
     int x = 0;
     int y = 0;
     int width = m_rect.width();
@@ -130,9 +125,6 @@ void GLPlatformSurface::updateContents(const uint32_t texture, const GLuint bind
     // Use NEAREST as no scale is performed during the blit.
     glBlitFramebuffer(x, y, width, height, x, y, width, height, GL_COLOR_BUFFER_BIT, GL_NEAREST);
     swapBuffers();
-    glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0);
-    glBindTexture(GL_TEXTURE_2D, bindTexture);
-    glBindFramebuffer(GL_FRAMEBUFFER, bindFboId);
 }
 
 void GLPlatformSurface::setGeometry(const IntRect& newRect)
@@ -144,10 +136,12 @@ void GLPlatformSurface::destroy()
 {
     m_rect = IntRect();
 
-    if (m_fboId)
+    if (m_fboId) {
+        glBindFramebuffer(GL_FRAMEBUFFER, 0);
+        glBindTexture(GL_TEXTURE_2D, 0);
         glDeleteFramebuffers(1, &m_fboId);
-
-    m_fboId = 0;
+        m_fboId = 0;
+    }
 }
 
 }
index e8db4254ce31cb743c8cee78f50980c523837617..00dd7c91ef931aa3ed7f0437cd5d5f1dafe3d3ae 100644 (file)
@@ -42,7 +42,7 @@ class GLPlatformSurface {
 
 public:
     // Creates a GL surface used for offscreen rendering.
-    static PassOwnPtr<GLPlatformSurface> createOffscreenSurface();
+    static PassOwnPtr<GLPlatformSurface> createOffScreenSurface();
 
     // Creates a GL surface used for offscreen rendering. The results can be transported
     // to the UI process for display.
@@ -53,6 +53,8 @@ public:
     const IntRect& geometry() const;
 
     // Get the underlying platform specific buffer handle.
+    // The handle will be null if surface doesn't support
+    // buffer sharing.
     PlatformBufferHandle handle() const;
 
     PlatformDrawable drawable() const;
@@ -61,12 +63,12 @@ public:
 
     virtual void swapBuffers();
 
-    // Convenience Function to update surface backbuffer with texture contents, restore current FBO and Texture.
+    // Convenience Function to update surface backbuffer with texture contents.
+    // Note that the function doesn't track or restore any GL states.
     // Function does the following(in order):
     // a) Blits texture contents to back buffer.
     // b) Calls Swap Buffers.
-    // c) Sets current FBO as bindFboId.
-    virtual void updateContents(const uint32_t texture, const GLuint bindFboId, const uint32_t bindTexture);
+    virtual void updateContents(const uint32_t texture);
 
     virtual void setGeometry(const IntRect& newRect);
 
@@ -76,7 +78,6 @@ public:
 
 protected:
     GLPlatformSurface();
-    bool m_restoreNeeded;
     IntRect m_rect;
     GLuint m_fboId;
     PlatformDisplay m_sharedDisplay;
index 789b69beed9028ae6d84447cbc291ca51872b178..c208dcc3750814b87fcebb2907885e8e038ccfc4 100644 (file)
@@ -67,7 +67,7 @@ EGLOffScreenContext::EGLOffScreenContext()
 {
 }
 
-bool EGLOffScreenContext::initialize(GLPlatformSurface* surface)
+bool EGLOffScreenContext::initialize(GLPlatformSurface* surface, PlatformContext sharedContext)
 {
     if (!surface)
         return false;
@@ -86,7 +86,7 @@ bool EGLOffScreenContext::initialize(GLPlatformSurface* surface)
         return false;
 
     if (isRobustnessExtSupported(m_display))
-        m_contextHandle = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextRobustnessAttributes);
+        m_contextHandle = eglCreateContext(m_display, config, sharedContext, contextRobustnessAttributes);
 
     if (m_contextHandle != EGL_NO_CONTEXT) {
         // The EGL_EXT_create_context_robustness spec requires that a context created with
@@ -100,7 +100,7 @@ bool EGLOffScreenContext::initialize(GLPlatformSurface* surface)
     }
 
     if (m_contextHandle == EGL_NO_CONTEXT)
-        m_contextHandle = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttributes);
+        m_contextHandle = eglCreateContext(m_display, config, sharedContext, contextAttributes);
 
     if (m_contextHandle != EGL_NO_CONTEXT)
         return true;
index ee132ccc231d258964dbb995bde0fdc9b1c122e0..ec31913c8901fc1621ad099267895ad8f6ce93d4 100644 (file)
@@ -37,7 +37,7 @@ class EGLOffScreenContext : public GLPlatformContext {
 public:
     EGLOffScreenContext();
     virtual ~EGLOffScreenContext();
-    virtual bool initialize(GLPlatformSurface*) OVERRIDE;
+    virtual bool initialize(GLPlatformSurface*, PlatformContext) OVERRIDE;
     virtual bool platformMakeCurrent(GLPlatformSurface*) OVERRIDE;
     virtual void platformReleaseCurrent() OVERRIDE;
     virtual void destroy() OVERRIDE;
index ea739213db68b6d1883664f61890a1a574149f46..c13c26c15dc3be12022f9b9b69654b03aaec53d6 100644 (file)
@@ -48,8 +48,8 @@ class GLXConfigSelector {
 
 public:
     GLXConfigSelector()
-        : m_pbufferFBConfig(0)
-        , m_surfaceContextFBConfig(0)
+        : m_surfaceContextFBConfig(0)
+        , m_pixmapContextFBConfig(0)
     {
     }
 
@@ -57,34 +57,33 @@ public:
     {
     }
 
-    XVisualInfo* visualInfo()
+    XVisualInfo* visualInfo(const GLXFBConfig& config)
     {
-        if (!surfaceContextConfig())
-            return 0;
-
-        return glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), m_surfaceContextFBConfig);
+        return glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), config);
     }
 
-    GLXFBConfig pBufferContextConfig()
+    GLXFBConfig pixmapContextConfig()
     {
-        if (!m_pbufferFBConfig) {
+        if (!m_pixmapContextFBConfig) {
             static const int attributes[] = {
                 GLX_LEVEL, 0,
-                GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
+                GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT,
                 GLX_RENDER_TYPE,   GLX_RGBA_BIT,
                 GLX_RED_SIZE,      1,
                 GLX_GREEN_SIZE,    1,
                 GLX_BLUE_SIZE,     1,
+                GLX_ALPHA_SIZE,    1,
                 GLX_DOUBLEBUFFER,  GL_FALSE,
                 None
             };
 
-            m_pbufferFBConfig = findMatchingConfig(attributes);
+            m_pixmapContextFBConfig = findMatchingConfig(attributes);
         }
 
-        return m_pbufferFBConfig;
+        return m_pixmapContextFBConfig;
     }
 
+
     GLXFBConfig surfaceContextConfig()
     {
         if (!m_surfaceContextFBConfig)
@@ -103,8 +102,8 @@ public:
 
     void reset()
     {
-        m_pbufferFBConfig = 0;
         m_surfaceContextFBConfig = 0;
+        m_pixmapContextFBConfig = 0;
     }
 
 private:
@@ -159,8 +158,8 @@ private:
         return temp[0];
     }
 
-    GLXFBConfig m_pbufferFBConfig;
     GLXFBConfig m_surfaceContextFBConfig;
+    GLXFBConfig m_pixmapContextFBConfig;
 };
 
 }
index 8f4046381c14826c3c8979bea2d1c9cdec060f7b..19d4b7b675dae05ad5299a952aa35be2a9c0286c 100644 (file)
@@ -56,7 +56,7 @@ GLXOffScreenContext::GLXOffScreenContext()
 {
 }
 
-bool GLXOffScreenContext::initialize(GLPlatformSurface* surface)
+bool GLXOffScreenContext::initialize(GLPlatformSurface* surface, PlatformContext sharedContext)
 {
     if (!surface)
         return false;
@@ -71,7 +71,7 @@ bool GLXOffScreenContext::initialize(GLPlatformSurface* surface)
         initializeARBExtensions();
 
         if (glXCreateContextAttribsARB)
-            m_contextHandle = glXCreateContextAttribsARB(x11Display, config, 0, true, Attribs);
+            m_contextHandle = glXCreateContextAttribsARB(x11Display, config, sharedContext, true, Attribs);
 
         if (m_contextHandle) {
             // The GLX_ARB_create_context_robustness spec requires that a context created with
@@ -85,7 +85,7 @@ bool GLXOffScreenContext::initialize(GLPlatformSurface* surface)
         }
 
         if (!m_contextHandle)
-            m_contextHandle = glXCreateNewContext(x11Display, config, GLX_RGBA_TYPE, 0, true);
+            m_contextHandle = glXCreateNewContext(x11Display, config, GLX_RGBA_TYPE, sharedContext, true);
 
         if (m_contextHandle)
             return true;
@@ -105,7 +105,7 @@ bool GLXOffScreenContext::isCurrentContext() const
 
 bool GLXOffScreenContext::platformMakeCurrent(GLPlatformSurface* surface)
 {
-    return glXMakeCurrent(surface->sharedDisplay(), surface->handle(), m_contextHandle);
+    return glXMakeCurrent(surface->sharedDisplay(), surface->drawable(), m_contextHandle);
 }
 
 void GLXOffScreenContext::platformReleaseCurrent()
index 444e7f27ca9304cd2e52522cff8f031d5654ffae..3cc43bcba70e0f037fb5da5ef46d5ddac8c62b57 100644 (file)
@@ -37,7 +37,7 @@ class GLXOffScreenContext : public GLPlatformContext {
 public:
     GLXOffScreenContext();
     virtual ~GLXOffScreenContext();
-    virtual bool initialize(GLPlatformSurface*) OVERRIDE;
+    virtual bool initialize(GLPlatformSurface*, PlatformContext) OVERRIDE;
     virtual bool platformMakeCurrent(GLPlatformSurface*) OVERRIDE;
     virtual void platformReleaseCurrent() OVERRIDE;
     virtual void destroy() OVERRIDE;
index c03c3d04a28bdd95c60fe8dc5edea668c46f5490..ebd30f3e0f1012bb99513d1ecdeac4a3507b95ad 100644 (file)
@@ -32,13 +32,12 @@ namespace WebCore {
 
 static const int pbufferAttributes[] = { GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, 0 };
 
-#if USE(GRAPHICS_SURFACE)
 GLXTransportSurface::GLXTransportSurface()
     : GLPlatformSurface()
 {
     m_sharedDisplay = X11Helper::nativeDisplay();
     m_configSelector = adoptPtr(new GLXConfigSelector());
-    OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo());
+    OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo(m_configSelector->surfaceContextConfig()));
 
     if (!visInfo.get()) {
         destroy();
@@ -77,14 +76,7 @@ void GLXTransportSurface::swapBuffers()
     if (!m_drawable)
         return;
 
-    if (m_restoreNeeded) {
-        GLint oldFBO;
-        glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO);
-        glBindFramebuffer(GL_FRAMEBUFFER, 0);
-        glXSwapBuffers(sharedDisplay(), m_drawable);
-        glBindFramebuffer(GL_FRAMEBUFFER, oldFBO);
-    } else
-        glXSwapBuffers(sharedDisplay(), m_drawable);
+    glXSwapBuffers(sharedDisplay(), m_drawable);
 }
 
 void GLXTransportSurface::destroy()
@@ -100,67 +92,73 @@ void GLXTransportSurface::destroy()
     m_configSelector = nullptr;
 }
 
-#endif
-
-GLXPBuffer::GLXPBuffer()
+GLXOffScreenSurface::GLXOffScreenSurface()
     : GLPlatformSurface()
+    , m_pixmap(0)
+    , m_glxPixmap(0)
 {
     initialize();
 }
 
-GLXPBuffer::~GLXPBuffer()
+GLXOffScreenSurface::~GLXOffScreenSurface()
 {
 }
 
-void GLXPBuffer::initialize()
+void GLXOffScreenSurface::initialize()
 {
     m_sharedDisplay = X11Helper::nativeDisplay();
 
     m_configSelector = adoptPtr(new GLXConfigSelector());
-    GLXFBConfig config = m_configSelector->pBufferContextConfig();
 
-    if (!config) {
+    OwnPtrX11<XVisualInfo> visualInfo(m_configSelector->visualInfo(m_configSelector->pixmapContextConfig()));
+    X11Helper::createPixmap(&m_pixmap, *visualInfo.get());
+
+    if (!m_pixmap) {
         destroy();
         return;
     }
 
-    m_drawable = glXCreatePbuffer(m_sharedDisplay, config, pbufferAttributes);
+    m_glxPixmap = glXCreateGLXPixmap(m_sharedDisplay, visualInfo.get(), m_pixmap);
 
-    if (!m_drawable) {
+    if (!m_glxPixmap) {
         destroy();
         return;
     }
 
-    m_bufferHandle = m_drawable;
+    m_drawable = m_glxPixmap;
 }
 
-PlatformSurfaceConfig GLXPBuffer::configuration()
+PlatformSurfaceConfig GLXOffScreenSurface::configuration()
 {
-    return m_configSelector->pBufferContextConfig();
+    return m_configSelector->pixmapContextConfig();
 }
 
-void GLXPBuffer::destroy()
+void GLXOffScreenSurface::destroy()
 {
     freeResources();
 }
 
-void GLXPBuffer::freeResources()
+void GLXOffScreenSurface::freeResources()
 {
     GLPlatformSurface::destroy();
     Display* display = sharedDisplay();
 
-    if (m_drawable && display) {
-        glXDestroyPbuffer(display, m_drawable);
-        m_drawable = 0;
-        m_bufferHandle = 0;
+    if (!display)
+        return;
+
+    if (m_glxPixmap) {
+        glXDestroyGLXPixmap(display, m_glxPixmap);
+        glXWaitGL();
+        m_glxPixmap = 0;
     }
 
-    m_configSelector = nullptr;
-}
+    if (m_pixmap) {
+        X11Helper::destroyPixmap(m_pixmap);
+        m_pixmap = 0;
+    }
 
-void GLXPBuffer::setGeometry(const IntRect& newRect)
-{
-    GLPlatformSurface::setGeometry(newRect);
+    m_configSelector = nullptr;
+    m_drawable = 0;
 }
 
 }
index 9e7732aa2649a9782abb28861cdcdc1e64f2ec44..430fe516616dec5dd08d30d52d77de71b11e3ac4 100644 (file)
@@ -34,7 +34,6 @@
 
 namespace WebCore {
 
-#if USE(GRAPHICS_SURFACE)
 class GLXTransportSurface : public GLPlatformSurface {
 
 public:
@@ -49,21 +48,21 @@ private:
     void initialize();
     OwnPtr<GLXConfigSelector> m_configSelector;
 };
-#endif
 
-class GLXPBuffer : public GLPlatformSurface {
+class GLXOffScreenSurface : public GLPlatformSurface {
 
 public:
-    GLXPBuffer();
-    virtual ~GLXPBuffer();
+    GLXOffScreenSurface();
+    virtual ~GLXOffScreenSurface();
     virtual PlatformSurfaceConfig configuration() OVERRIDE;
-    virtual void setGeometry(const IntRect&) OVERRIDE;
     virtual void destroy() OVERRIDE;
 
 private:
     void initialize();
     void freeResources();
     OwnPtr<GLXConfigSelector> m_configSelector;
+    Pixmap m_pixmap;
+    GLXPixmap m_glxPixmap;
 };
 
 }
index 68678ca1fff3933dde13eaa21d570fe2e2399a64..5e18a59b964748e7218141ff1baadc9699303a8f 100644 (file)
@@ -123,7 +123,8 @@ struct GraphicsSurfacePrivate {
         if (!display() || !m_configSelector)
             return 0;
 
-        OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo());
+        GLXFBConfig config = m_configSelector->surfaceContextConfig();
+        OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo(config));
 
         if (!visInfo.get()) {
             clear();
@@ -137,7 +138,7 @@ struct GraphicsSurfacePrivate {
             return 0;
         }
 
-        m_glxSurface = glXCreateWindow(display(), m_configSelector->surfaceContextConfig(), m_surface, 0);
+        m_glxSurface = glXCreateWindow(display(), config, m_surface, 0);
         return m_surface;
     }
 
index 100bb2eca93c57928550b9c9e27740b7a22a0a98..247274a46a75485f592d65f001926e62a440e8cc 100644 (file)
@@ -140,6 +140,47 @@ void X11Helper::resizeWindow(const IntRect& newRect, const uint32_t windowId)
     XFlush(nativeDisplay());
 }
 
+void X11Helper::createPixmap(Pixmap* handleId, const XVisualInfo& visualInfo, const IntSize& size)
+{
+    Display* display = nativeDisplay();
+    if (!display)
+        return;
+
+    if (!visualInfo.visual) {
+        LOG_ERROR("Failed to find valid XVisual.");
+        return;
+    }
+
+    Window xWindow = offscreenRootWindow();
+    if (!xWindow) {
+        LOG_ERROR("Failed to create offscreen root window.");
+        return;
+    }
+
+    Pixmap tempHandleId = XCreatePixmap(display, xWindow, size.width(), size.height(), visualInfo.depth);
+
+    if (!tempHandleId) {
+        LOG_ERROR("Failed to create offscreen pixmap.");
+        return;
+    }
+
+    *handleId = tempHandleId;
+    XSync(X11Helper::nativeDisplay(), false);
+}
+
+void X11Helper::destroyPixmap(const uint32_t pixmapId)
+{
+    if (!pixmapId)
+        return;
+
+    Display* display = nativeDisplay();
+    if (!display)
+        return;
+
+    XFreePixmap(display, pixmapId);
+    XSync(X11Helper::nativeDisplay(), false);
+}
+
 void X11Helper::createOffScreenWindow(uint32_t* handleId, const XVisualInfo& visInfo, const IntSize& size)
 {
 #if USE(GRAPHICS_SURFACE)
@@ -162,8 +203,7 @@ void X11Helper::createOffScreenWindow(uint32_t* handleId, const XVisualInfo& vis
     attribute.border_pixel = BlackPixel(display, 0);
     attribute.colormap = cmap;
     attribute.event_mask = ResizeRedirectMask;
-    uint32_t tempHandleId;
-    tempHandleId = XCreateWindow(display, xWindow, 0, 0, size.width(), size.height(), 0, visInfo.depth, InputOutput, visInfo.visual, CWBackPixel | CWBorderPixel | CWColormap, &attribute);
+    uint32_t tempHandleId = XCreateWindow(display, xWindow, 0, 0, size.width(), size.height(), 0, visInfo.depth, InputOutput, visInfo.visual, CWBackPixel | CWBorderPixel | CWColormap, &attribute);
 
     if (!tempHandleId) {
         LOG_ERROR("Failed to create offscreen window.");
index 6e7a68280b1cb7d9f2d1e7da48eee975766bdc91..68c75dd780024c92cd6548bd427117d0d35422e5 100644 (file)
@@ -46,11 +46,13 @@ namespace WebCore {
 class X11Helper {
 
 public:
+    static void createPixmap(Pixmap*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
     static void createOffScreenWindow(uint32_t*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
 #if USE(EGL)
     static void createOffScreenWindow(uint32_t*, const EGLint, const IntSize& = IntSize(1, 1));
 #endif
     static void destroyWindow(const uint32_t);
+    static void destroyPixmap(const uint32_t);
     static void resizeWindow(const IntRect&, const uint32_t);
     static bool isXRenderExtensionSupported();
     static Display* nativeDisplay();