[EFL][Qt][WebGL] Share the common code between GraphicsSurfaceGLX and X11WindowResources.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Feb 2013 15:10:08 +0000 (15:10 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Feb 2013 15:10:08 +0000 (15:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106666

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

Covered by existing WebGL tests.

This patch removes any duplicate code in X11WindowResources and
GraphicsSurfaceGLX. No new functionality is added.

* PlatformEfl.cmake:
* Target.pri:
* platform/graphics/surfaces/egl/EGLConfigSelector.cpp:
(WebCore::EGLConfigSelector::pixmapContextConfig):
* platform/graphics/surfaces/egl/EGLConfigSelector.h:
(EGLConfigSelector):
* platform/graphics/surfaces/egl/EGLSurface.cpp:
(WebCore::EGLWindowTransportSurface::EGLWindowTransportSurface):
(WebCore::EGLWindowTransportSurface::destroy):
(WebCore::EGLWindowTransportSurface::setGeometry):
* platform/graphics/surfaces/egl/EGLSurface.h:
(WebCore):
(EGLWindowTransportSurface):
* platform/graphics/surfaces/glx/GLXConfigSelector.h:
(WebCore::GLXConfigSelector::GLXConfigSelector):
(WebCore::GLXConfigSelector::visualInfo):
(WebCore::GLXConfigSelector::pBufferContextConfig):
(WebCore::GLXConfigSelector::createSurfaceConfig):
(GLXConfigSelector):
* platform/graphics/surfaces/glx/GLXContext.cpp:
(WebCore::initializeARBExtensions):
(WebCore::GLXOffScreenContext::GLXOffScreenContext):
(WebCore::GLXOffScreenContext::initialize):
(WebCore::GLXOffScreenContext::platformReleaseCurrent):
(WebCore::GLXOffScreenContext::freeResources):
* platform/graphics/surfaces/glx/GLXContext.h:
(GLXOffScreenContext):
* platform/graphics/surfaces/glx/GLXSurface.cpp:
(WebCore::GLXTransportSurface::GLXTransportSurface):
(WebCore::GLXTransportSurface::setGeometry):
(WebCore::GLXTransportSurface::destroy):
(WebCore::GLXPBuffer::initialize):
* platform/graphics/surfaces/glx/GLXSurface.h:
(GLXTransportSurface):
(GLXPBuffer):
* platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp:
(WebCore):
(WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
(WebCore::GraphicsSurfacePrivate::initialize):
(GraphicsSurfacePrivate):
(WebCore::GraphicsSurfacePrivate::createSurface):
(WebCore::GraphicsSurfacePrivate::createPixmap):
(WebCore::GraphicsSurfacePrivate::display):
(WebCore::GraphicsSurfacePrivate::flags):
(WebCore::GraphicsSurfacePrivate::clear):
(WebCore::GraphicsSurface::platformPaintToTextureMapper):
No new functionality added. Made changes to take the common code into use.

* platform/graphics/surfaces/glx/X11WindowResources.h: Removed.
* platform/graphics/surfaces/glx/X11Helper.cpp: Renamed from Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp.
(WebCore):
(WebCore::DisplayConnection::DisplayConnection):
(DisplayConnection):
(WebCore::DisplayConnection::~DisplayConnection):
(WebCore::DisplayConnection::display):
(OffScreenRootWindow):
(WebCore::OffScreenRootWindow::OffScreenRootWindow):
(WebCore::OffScreenRootWindow::~OffScreenRootWindow):
(WebCore::OffScreenRootWindow::rootWindow):
(WebCore::X11Helper::resizeWindow):
(WebCore::X11Helper::createOffScreenWindow):
(WebCore::X11Helper::destroyWindow):
(WebCore::X11Helper::isXRenderExtensionSupported):
(WebCore::X11Helper::nativeDisplay):
(WebCore::X11Helper::offscreenRootWindow):
* platform/graphics/surfaces/glx/X11Helper.h: Added.
(WebCore):
(WebCore::handleXPixmapCreationError):
(X11Helper):
(ScopedXPixmapCreationErrorHandler):
(WebCore::ScopedXPixmapCreationErrorHandler::ScopedXPixmapCreationErrorHandler):
(WebCore::ScopedXPixmapCreationErrorHandler::~ScopedXPixmapCreationErrorHandler):
(WebCore::ScopedXPixmapCreationErrorHandler::isValidOperation):
Moved common code from GraphicsSurfaceGLX to X11Helper.

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

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PlatformEfl.cmake
Source/WebCore/Target.pri
Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.cpp
Source/WebCore/platform/graphics/surfaces/egl/EGLSurface.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 [new file with mode: 0644]
Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h [new file with mode: 0644]
Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp [deleted file]
Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.h [deleted file]
Tools/qmake/mkspecs/features/features.prf

index b8f147dbc57672d3f2923099a049208506d21a57..ff236e2f69df8f56f29fca65d9dbd19b0167a1fb 100644 (file)
@@ -1,3 +1,90 @@
+2013-02-09  Kondapally Kalyan  <kalyan.kondapally@intel.com>
+
+        [EFL][Qt][WebGL] Share the common code between GraphicsSurfaceGLX and X11WindowResources.
+        https://bugs.webkit.org/show_bug.cgi?id=106666
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Covered by existing WebGL tests.
+
+        This patch removes any duplicate code in X11WindowResources and
+        GraphicsSurfaceGLX. No new functionality is added.
+
+        * PlatformEfl.cmake:
+        * Target.pri:
+        * platform/graphics/surfaces/egl/EGLConfigSelector.cpp:
+        (WebCore::EGLConfigSelector::pixmapContextConfig):
+        * platform/graphics/surfaces/egl/EGLConfigSelector.h:
+        (EGLConfigSelector):
+        * platform/graphics/surfaces/egl/EGLSurface.cpp:
+        (WebCore::EGLWindowTransportSurface::EGLWindowTransportSurface):
+        (WebCore::EGLWindowTransportSurface::destroy):
+        (WebCore::EGLWindowTransportSurface::setGeometry):
+        * platform/graphics/surfaces/egl/EGLSurface.h:
+        (WebCore):
+        (EGLWindowTransportSurface):
+        * platform/graphics/surfaces/glx/GLXConfigSelector.h:
+        (WebCore::GLXConfigSelector::GLXConfigSelector):
+        (WebCore::GLXConfigSelector::visualInfo):
+        (WebCore::GLXConfigSelector::pBufferContextConfig):
+        (WebCore::GLXConfigSelector::createSurfaceConfig):
+        (GLXConfigSelector):
+        * platform/graphics/surfaces/glx/GLXContext.cpp:
+        (WebCore::initializeARBExtensions):
+        (WebCore::GLXOffScreenContext::GLXOffScreenContext):
+        (WebCore::GLXOffScreenContext::initialize):
+        (WebCore::GLXOffScreenContext::platformReleaseCurrent):
+        (WebCore::GLXOffScreenContext::freeResources):
+        * platform/graphics/surfaces/glx/GLXContext.h:
+        (GLXOffScreenContext):
+        * platform/graphics/surfaces/glx/GLXSurface.cpp:
+        (WebCore::GLXTransportSurface::GLXTransportSurface):
+        (WebCore::GLXTransportSurface::setGeometry):
+        (WebCore::GLXTransportSurface::destroy):
+        (WebCore::GLXPBuffer::initialize):
+        * platform/graphics/surfaces/glx/GLXSurface.h:
+        (GLXTransportSurface):
+        (GLXPBuffer):
+        * platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp:
+        (WebCore):
+        (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate):
+        (WebCore::GraphicsSurfacePrivate::initialize):
+        (GraphicsSurfacePrivate):
+        (WebCore::GraphicsSurfacePrivate::createSurface):
+        (WebCore::GraphicsSurfacePrivate::createPixmap):
+        (WebCore::GraphicsSurfacePrivate::display):
+        (WebCore::GraphicsSurfacePrivate::flags):
+        (WebCore::GraphicsSurfacePrivate::clear):
+        (WebCore::GraphicsSurface::platformPaintToTextureMapper):
+        No new functionality added. Made changes to take the common code into use.
+
+        * platform/graphics/surfaces/glx/X11WindowResources.h: Removed.
+        * platform/graphics/surfaces/glx/X11Helper.cpp: Renamed from Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp.
+        (WebCore):
+        (WebCore::DisplayConnection::DisplayConnection):
+        (DisplayConnection):
+        (WebCore::DisplayConnection::~DisplayConnection):
+        (WebCore::DisplayConnection::display):
+        (OffScreenRootWindow):
+        (WebCore::OffScreenRootWindow::OffScreenRootWindow):
+        (WebCore::OffScreenRootWindow::~OffScreenRootWindow):
+        (WebCore::OffScreenRootWindow::rootWindow):
+        (WebCore::X11Helper::resizeWindow):
+        (WebCore::X11Helper::createOffScreenWindow):
+        (WebCore::X11Helper::destroyWindow):
+        (WebCore::X11Helper::isXRenderExtensionSupported):
+        (WebCore::X11Helper::nativeDisplay):
+        (WebCore::X11Helper::offscreenRootWindow):
+        * platform/graphics/surfaces/glx/X11Helper.h: Added.
+        (WebCore):
+        (WebCore::handleXPixmapCreationError):
+        (X11Helper):
+        (ScopedXPixmapCreationErrorHandler):
+        (WebCore::ScopedXPixmapCreationErrorHandler::ScopedXPixmapCreationErrorHandler):
+        (WebCore::ScopedXPixmapCreationErrorHandler::~ScopedXPixmapCreationErrorHandler):
+        (WebCore::ScopedXPixmapCreationErrorHandler::isValidOperation):
+        Moved common code from GraphicsSurfaceGLX to X11Helper.
+
 2013-02-09  Andrey Lushnikov  <lushnikov@chromium.org>
 
         Web Inspector: show whitespace characters in DTE
index e18bdb526a739455c55be8b32b5c0495a208c5d8..51613cedba0f8942e16fb644138a529b7a8e26d1 100644 (file)
@@ -132,9 +132,6 @@ list(APPEND WebCore_SOURCES
     platform/graphics/harfbuzz/HarfBuzzFace.cpp
     platform/graphics/harfbuzz/HarfBuzzShaper.cpp
 
-    platform/graphics/surfaces/glx/GLXContext.cpp
-    platform/graphics/surfaces/glx/GLXSurface.cpp
-
     platform/graphics/WOFFFileFormat.cpp
 
     platform/image-decoders/cairo/ImageDecoderCairo.cpp
@@ -316,8 +313,7 @@ if (WTF_USE_3D_GRAPHICS)
         platform/graphics/opengl/GLPlatformSurface.cpp
         platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
         platform/graphics/surfaces/GraphicsSurface.cpp
-        platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
-        platform/graphics/surfaces/glx/X11WindowResources.cpp
+        platform/graphics/surfaces/glx/X11Helper.cpp
         platform/graphics/texmap/TextureMapperGL.cpp
         platform/graphics/texmap/TextureMapperShaderProgram.cpp
     )
@@ -328,6 +324,12 @@ if (WTF_USE_3D_GRAPHICS)
             platform/graphics/surfaces/egl/EGLContext.cpp
             platform/graphics/surfaces/egl/EGLSurface.cpp
         )
+    else ()
+        list(APPEND WebCore_SOURCES
+            platform/graphics/surfaces/glx/GLXContext.cpp
+            platform/graphics/surfaces/glx/GLXSurface.cpp
+            platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
+        )
     endif ()
 
     if (WTF_USE_OPENGL_ES_2)
index dd313aa64861fe39d23ed41df5c62ba6846bf212..860517c8073e6d3d0d5614e4abc039bbeeaf8e4b 100644 (file)
@@ -4225,7 +4225,12 @@ use?(GRAPHICS_SURFACE) {
         SOURCES += platform/graphics/surfaces/win/GraphicsSurfaceWin.cpp
     }
     have?(XCOMPOSITE) {
-        SOURCES += platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
+        HEADERS += \
+            platform/graphics/surfaces/glx/X11Helper.h \
+            platform/graphics/surfaces/glx/GLXConfigSelector.h
+        SOURCES += \
+            platform/graphics/surfaces/glx/X11Helper.cpp \
+            platform/graphics/surfaces/glx/GraphicsSurfaceGLX.cpp
     }
 }
 
index 26d56a5be75e62b5412e9bd65f0d0542b081350f..e6711f8e98a68dfb6d00340af7515e5d4d88546d 100644 (file)
@@ -33,13 +33,11 @@ namespace WebCore {
 EGLWindowTransportSurface::EGLWindowTransportSurface()
     : GLPlatformSurface()
 {
-    m_nativeResource = adoptPtr(new NativeOffScreenWindow());
-    m_configSelector = adoptPtr(new EGLConfigSelector(m_nativeResource->nativeSharedDisplay()));
+    m_configSelector = adoptPtr(new EGLConfigSelector(NativeWrapper::nativeDisplay()));
     m_sharedDisplay = m_configSelector->display();
 
     if (m_sharedDisplay == EGL_NO_DISPLAY) {
         m_configSelector = nullptr;
-        m_nativeResource = nullptr;
         return;
     }
 
@@ -57,7 +55,7 @@ EGLWindowTransportSurface::EGLWindowTransportSurface()
         return;
     }
 
-    m_nativeResource->createOffScreenWindow(&m_bufferHandle, visualId);
+    NativeWrapper::createOffScreenWindow(&m_bufferHandle, visualId);
 
     if (!m_bufferHandle) {
         destroy();
@@ -104,7 +102,7 @@ void EGLWindowTransportSurface::swapBuffers()
 void EGLWindowTransportSurface::destroy()
 {
     GLPlatformSurface::destroy();
-    m_nativeResource->destroyWindow(m_bufferHandle);
+    NativeWrapper::destroyWindow(m_bufferHandle);
     freeEGLResources();
     m_bufferHandle = 0;
 }
@@ -128,7 +126,7 @@ void EGLWindowTransportSurface::freeEGLResources()
 void EGLWindowTransportSurface::setGeometry(const IntRect& newRect)
 {
     GLPlatformSurface::setGeometry(newRect);
-    m_nativeResource->reSizeWindow(newRect, m_bufferHandle);
+    NativeWrapper::resizeWindow(newRect, m_bufferHandle);
 }
 
 }
index 5c288a9c1591bf1f84d1aaec797050b9c20d105d..2ea70420999cba1130a836f7aab393d54703c584 100644 (file)
 #include "EGLConfigSelector.h"
 #include "GLPlatformSurface.h"
 
-#include <glx/X11WindowResources.h>
+#include <glx/X11Helper.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/PassOwnPtr.h>
 
 namespace WebCore {
 
-typedef X11OffScreenWindow NativeOffScreenWindow;
+typedef X11Helper NativeWrapper;
 
 // Contents of the surface are backed by native window.
 class EGLWindowTransportSurface : public GLPlatformSurface {
@@ -52,7 +52,6 @@ public:
 
 private:
     void freeEGLResources();
-    OwnPtr<NativeOffScreenWindow> m_nativeResource;
     OwnPtr<EGLConfigSelector> m_configSelector;
 };
 
index dd1b62bb2063f890129966fb3ab6ce656d63148d..ea739213db68b6d1883664f61890a1a574149f46 100644 (file)
 #ifndef GLXConfigSelector_h
 #define GLXConfigSelector_h
 
-#include "X11WindowResources.h"
-
 #if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
+#include "X11Helper.h"
+#include <opengl/GLDefs.h>
+
 namespace WebCore {
 
+static int clientAttributes[] = {
+    // The specification is a set key value pairs stored in a simple array.
+    GLX_LEVEL,                          0,
+    static_cast<int>(GLX_VISUAL_ID),    0,
+    GLX_DRAWABLE_TYPE,                  GLX_PIXMAP_BIT,
+    GLX_BIND_TO_TEXTURE_TARGETS_EXT,    GLX_TEXTURE_2D_BIT_EXT,
+    GLX_BIND_TO_TEXTURE_RGBA_EXT,       TRUE,
+    0
+};
+
 class GLXConfigSelector {
     WTF_MAKE_NONCOPYABLE(GLXConfigSelector);
 
 public:
-    GLXConfigSelector(Display* xDisplay, bool supportsXRenderExtension)
+    GLXConfigSelector()
         : m_pbufferFBConfig(0)
         , m_surfaceContextFBConfig(0)
-        , m_sharedDisplay(xDisplay)
-        , m_supportsXRenderExtension(supportsXRenderExtension)
     {
     }
 
@@ -53,7 +62,7 @@ public:
         if (!surfaceContextConfig())
             return 0;
 
-        return glXGetVisualFromFBConfig(m_sharedDisplay, m_surfaceContextFBConfig);
+        return glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), m_surfaceContextFBConfig);
     }
 
     GLXFBConfig pBufferContextConfig()
@@ -70,10 +79,7 @@ public:
                 None
             };
 
-            int numAvailableConfigs;
-            OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(m_sharedDisplay, DefaultScreen(m_sharedDisplay), attributes, &numAvailableConfigs));
-            if (numAvailableConfigs)
-                m_pbufferFBConfig = temp[0];
+            m_pbufferFBConfig = findMatchingConfig(attributes);
         }
 
         return m_pbufferFBConfig;
@@ -87,6 +93,14 @@ public:
         return m_surfaceContextFBConfig;
     }
 
+    GLXFBConfig surfaceClientConfig(int depth, VisualID id)
+    {
+        clientAttributes[3] = static_cast<int>(id);
+        clientAttributes[8] = depth == 32 ? GLX_BIND_TO_TEXTURE_RGBA_EXT : GLX_BIND_TO_TEXTURE_RGB_EXT;
+
+        return findMatchingConfig(clientAttributes, depth, id);
+    }
+
     void reset()
     {
         m_pbufferFBConfig = 0;
@@ -110,43 +124,43 @@ private:
             None
         };
 
+        m_surfaceContextFBConfig = findMatchingConfig(attributes);
+    }
+
+    GLXFBConfig findMatchingConfig(const int attributes[], int depth = 32, VisualID id = 0)
+    {
         int numAvailableConfigs;
-        OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(m_sharedDisplay, DefaultScreen(m_sharedDisplay), attributes, &numAvailableConfigs));
+        OwnPtrX11<GLXFBConfig> temp(glXChooseFBConfig(X11Helper::nativeDisplay(), DefaultScreen(X11Helper::nativeDisplay()), attributes, &numAvailableConfigs));
 
-        if (!numAvailableConfigs) {
-            m_surfaceContextFBConfig = 0;
-            return;
-        }
+        if (!numAvailableConfigs || !temp.get())
+            return 0;
 
         OwnPtrX11<XVisualInfo> scopedVisualInfo;
         for (int i = 0; i < numAvailableConfigs; ++i) {
-            scopedVisualInfo = glXGetVisualFromFBConfig(m_sharedDisplay, temp[i]);
+            scopedVisualInfo = glXGetVisualFromFBConfig(X11Helper::nativeDisplay(), temp[i]);
             if (!scopedVisualInfo.get())
                 continue;
+
+            if (id && scopedVisualInfo->depth == depth && scopedVisualInfo->visualid == id)
+                return temp[i];
+
 #if USE(GRAPHICS_SURFACE)
-            if (m_supportsXRenderExtension) {
-                XRenderPictFormat* format = XRenderFindVisualFormat(m_sharedDisplay, scopedVisualInfo->visual);
-                if (format && format->direct.alphaMask > 0) {
-                    m_surfaceContextFBConfig = temp[i];
-                    break;
-                }
+            if (X11Helper::isXRenderExtensionSupported()) {
+                XRenderPictFormat* format = XRenderFindVisualFormat(X11Helper::nativeDisplay(), scopedVisualInfo->visual);
+                if (format && depth == 32 && format->direct.alphaMask > 0)
+                    return temp[i];
             }
 #endif
-            if (!m_surfaceContextFBConfig && scopedVisualInfo->depth == 32) {
-                m_surfaceContextFBConfig = temp[i];
-                break;
-            }
+            if (scopedVisualInfo->depth == depth)
+                return temp[i];
         }
 
         // Did not find any visual supporting alpha, select the first available config.
-        if (!m_surfaceContextFBConfig)
-            m_surfaceContextFBConfig = temp[0];
+        return temp[0];
     }
 
     GLXFBConfig m_pbufferFBConfig;
     GLXFBConfig m_surfaceContextFBConfig;
-    Display* m_sharedDisplay;
-    bool m_supportsXRenderExtension;
 };
 
 }
index a9f322d0ad9ac7219411276eab061b521b1e5722..8f4046381c14826c3c8979bea2d1c9cdec060f7b 100644 (file)
@@ -28,6 +28,8 @@
 
 #if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
+#include "X11Helper.h"
+
 namespace WebCore {
 
 typedef GLXContext (*GLXCREATECONTEXTATTRIBSARBPROC)(Display*, GLXFBConfig, GLXContext, Bool, const int*);
@@ -38,20 +40,19 @@ static int Attribs[] = {
     GLX_LOSE_CONTEXT_ON_RESET_ARB,
     0 };
 
-static void initializeARBExtensions(Display* display)
+static void initializeARBExtensions()
 {
     static bool initialized = false;
     if (initialized)
         return;
 
     initialized = true;
-    if (GLPlatformContext::supportsGLXExtension(display, "GLX_ARB_create_context_robustness"))
+    if (GLPlatformContext::supportsGLXExtension(X11Helper::nativeDisplay(), "GLX_ARB_create_context_robustness"))
         glXCreateContextAttribsARB = reinterpret_cast<GLXCREATECONTEXTATTRIBSARBPROC>(glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXCreateContextAttribsARB")));
 }
 
 GLXOffScreenContext::GLXOffScreenContext()
     : GLPlatformContext()
-    , m_display(0)
 {
 }
 
@@ -60,17 +61,17 @@ bool GLXOffScreenContext::initialize(GLPlatformSurface* surface)
     if (!surface)
         return false;
 
-    m_display = surface->sharedDisplay();
-    if (!m_display)
+    Display* x11Display = surface->sharedDisplay();
+    if (!x11Display)
         return false;
 
     GLXFBConfig config = surface->configuration();
 
     if (config) {
-        initializeARBExtensions(m_display);
+        initializeARBExtensions();
 
         if (glXCreateContextAttribsARB)
-            m_contextHandle = glXCreateContextAttribsARB(m_display, config, 0, true, Attribs);
+            m_contextHandle = glXCreateContextAttribsARB(x11Display, config, 0, true, Attribs);
 
         if (m_contextHandle) {
             // The GLX_ARB_create_context_robustness spec requires that a context created with
@@ -80,11 +81,11 @@ bool GLXOffScreenContext::initialize(GLPlatformSurface* surface)
             if (platformMakeCurrent(surface) && GLPlatformContext::supportsGLExtension("GL_ARB_robustness"))
                 m_resetLostContext = true;
             else
-                glXDestroyContext(m_display, m_contextHandle);
+                glXDestroyContext(x11Display, m_contextHandle);
         }
 
         if (!m_contextHandle)
-            m_contextHandle = glXCreateNewContext(m_display, config, GLX_RGBA_TYPE, 0, true);
+            m_contextHandle = glXCreateNewContext(x11Display, config, GLX_RGBA_TYPE, 0, true);
 
         if (m_contextHandle)
             return true;
@@ -109,14 +110,21 @@ bool GLXOffScreenContext::platformMakeCurrent(GLPlatformSurface* surface)
 
 void GLXOffScreenContext::platformReleaseCurrent()
 {
-    glXMakeCurrent(m_display, 0, 0);
-    m_display = 0;
+    Display* x11Display = X11Helper::nativeDisplay();
+    if (!x11Display)
+        return;
+
+    glXMakeCurrent(x11Display, 0, 0);
 }
 
 void GLXOffScreenContext::freeResources()
 {
+    Display* x11Display = X11Helper::nativeDisplay();
+    if (!x11Display)
+        return;
+
     if (m_contextHandle)
-        glXDestroyContext(m_display, m_contextHandle);
+        glXDestroyContext(x11Display, m_contextHandle);
 
     m_contextHandle = 0;
 }
index cbde0ef0a01a00739c5352fcfc996cbdc7a2bd19..444e7f27ca9304cd2e52522cff8f031d5654ffae 100644 (file)
@@ -45,7 +45,6 @@ public:
 
 private:
     void freeResources();
-    Display* m_display;
 };
 
 }
index 80fc262c114ae05314cc390112c499b66850d751..c03c3d04a28bdd95c60fe8dc5edea668c46f5490 100644 (file)
@@ -36,15 +36,8 @@ static const int pbufferAttributes[] = { GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGH
 GLXTransportSurface::GLXTransportSurface()
     : GLPlatformSurface()
 {
-    m_nativeResource = adoptPtr(new X11OffScreenWindow());
-    m_sharedDisplay = m_nativeResource->nativeSharedDisplay();
-
-    if (!m_sharedDisplay) {
-        m_nativeResource = nullptr;
-        return;
-    }
-
-    m_configSelector = adoptPtr(new GLXConfigSelector(m_sharedDisplay, m_nativeResource->isXRenderExtensionSupported()));
+    m_sharedDisplay = X11Helper::nativeDisplay();
+    m_configSelector = adoptPtr(new GLXConfigSelector());
     OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo());
 
     if (!visInfo.get()) {
@@ -52,7 +45,7 @@ GLXTransportSurface::GLXTransportSurface()
         return;
     }
 
-    m_nativeResource->createOffScreenWindow(&m_bufferHandle, *visInfo.get());
+    X11Helper::createOffScreenWindow(&m_bufferHandle, *visInfo.get());
 
     if (!m_bufferHandle) {
         destroy();
@@ -74,7 +67,7 @@ PlatformSurfaceConfig GLXTransportSurface::configuration()
 void GLXTransportSurface::setGeometry(const IntRect& newRect)
 {
     GLPlatformSurface::setGeometry(newRect);
-    m_nativeResource->reSizeWindow(newRect, m_drawable);
+    X11Helper::resizeWindow(newRect, m_drawable);
     // Force resize of GL surface after window resize.
     glXSwapBuffers(sharedDisplay(), m_drawable);
 }
@@ -99,7 +92,7 @@ void GLXTransportSurface::destroy()
     GLPlatformSurface::destroy();
 
     if (m_bufferHandle) {
-        m_nativeResource->destroyWindow(m_bufferHandle);
+        X11Helper::destroyWindow(m_bufferHandle);
         m_bufferHandle = 0;
         m_drawable = 0;
     }
@@ -121,15 +114,9 @@ GLXPBuffer::~GLXPBuffer()
 
 void GLXPBuffer::initialize()
 {
-    m_nativeResource = adoptPtr(new X11OffScreenWindow());
-    m_sharedDisplay = m_nativeResource->nativeSharedDisplay();
-
-    if (!m_sharedDisplay) {
-        m_nativeResource = nullptr;
-        return;
-    }
+    m_sharedDisplay = X11Helper::nativeDisplay();
 
-    m_configSelector = adoptPtr(new GLXConfigSelector(m_sharedDisplay, m_nativeResource->isXRenderExtensionSupported()));
+    m_configSelector = adoptPtr(new GLXConfigSelector());
     GLXFBConfig config = m_configSelector->pBufferContextConfig();
 
     if (!config) {
index 84715c1c9023c4dc5c76d96f7fecbfc27a5a736a..9e7732aa2649a9782abb28861cdcdc1e64f2ec44 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "GLPlatformSurface.h"
 #include "GLXConfigSelector.h"
-#include "X11WindowResources.h"
+#include "X11Helper.h"
 
 namespace WebCore {
 
@@ -47,7 +47,6 @@ public:
 
 private:
     void initialize();
-    OwnPtr<X11OffScreenWindow> m_nativeResource;
     OwnPtr<GLXConfigSelector> m_configSelector;
 };
 #endif
@@ -64,7 +63,6 @@ public:
 private:
     void initialize();
     void freeResources();
-    OwnPtr<X11OffScreenWindow> m_nativeResource;
     OwnPtr<GLXConfigSelector> m_configSelector;
 };
 
index 7757e6809f2d02b35fc3c3d7ac48f215a5df85c8..e6b144a52cfbf88f7023afd259e78a7af68512f0 100644 (file)
@@ -1,5 +1,6 @@
 /*
  Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2013 Intel Corporation.
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
 #include <QGuiApplication>
 #include <QOpenGLContext>
 #include <qpa/qplatformnativeinterface.h>
-#elif PLATFORM(EFL)
-#include <GL/gl.h>
-#endif
-
 #include <GL/glext.h>
 #include <GL/glx.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/Xcomposite.h>
-#include <X11/extensions/Xrender.h>
+#else
+#include <opengl/GLDefs.h>
+#endif
 
-namespace WebCore {
+#include "GLXConfigSelector.h"
 
-static long X11OverrideRedirect = 1L << 9;
+namespace WebCore {
 
 static PFNGLXBINDTEXIMAGEEXTPROC pGlXBindTexImageEXT = 0;
 static PFNGLXRELEASETEXIMAGEEXTPROC pGlXReleaseTexImageEXT = 0;
@@ -52,159 +49,7 @@ static PFNGLGENFRAMEBUFFERSPROC pGlGenFramebuffers = 0;
 static PFNGLDELETEFRAMEBUFFERSPROC pGlDeleteFramebuffers = 0;
 static PFNGLFRAMEBUFFERTEXTURE2DPROC pGlFramebufferTexture2D = 0;
 
-// Used for handling XError.
-static bool validOperation = true;
-static int handleXPixmapCreationError(Display*, XErrorEvent* event)
-{
-    if (event->error_code == BadMatch || event->error_code == BadWindow || event->error_code == BadAlloc) {
-        validOperation = false;
-
-        switch (event->error_code) {
-        case BadMatch:
-            LOG_ERROR("BadMatch.");
-            break;
-        case BadWindow:
-            LOG_ERROR("BadWindow.");
-            break;
-        case BadAlloc:
-            LOG_ERROR("BadAlloc.");
-            break;
-        default:
-            break;
-        }
-    }
-
-    return 0;
-}
-
-static int attributes[] = {
-    GLX_LEVEL, 0,
-    GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
-    GLX_RENDER_TYPE,   GLX_RGBA_BIT,
-    GLX_RED_SIZE,      1,
-    GLX_GREEN_SIZE,    1,
-    GLX_BLUE_SIZE,     1,
-    GLX_ALPHA_SIZE,    1,
-    GLX_DEPTH_SIZE,    1,
-    GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
-    GLX_DOUBLEBUFFER,  True,
-    None
-};
-
-class ScopedXPixmapCreationErrorHandler {
-
-public:
-    ScopedXPixmapCreationErrorHandler(Display* display)
-        : m_display(display)
-    {
-        // XSync must be called to ensure that current errors are handled by the original handler.
-        XSync(m_display, false);
-        m_previousErrorHandler = XSetErrorHandler(handleXPixmapCreationError);
-    }
-
-    ~ScopedXPixmapCreationErrorHandler()
-    {
-        // Restore the original handler.
-        XSetErrorHandler(m_previousErrorHandler);
-    }
-
-    bool isValidOperation() const
-    {
-        validOperation = true;
-        // XSync is needed to catch possible errors as they are generated asynchronously.
-        XSync(m_display, false);
-        return validOperation;
-    }
-
-private:
-    XErrorHandler m_previousErrorHandler;
-    Display* m_display;
-};
-
-// FIXME: Take X11WindowResources and GLXConfigSelector into use.
-class OffScreenRootWindow {
-public:
-    OffScreenRootWindow()
-    {
-        ++m_refCount;
-    }
-
-    Window getXWindow()
-    {
-        if (!m_window) {
-            Display* dpy = display();
-            m_window = XCreateSimpleWindow(dpy, XDefaultRootWindow(dpy), -1, -1, 1, 1, 0, BlackPixel(dpy, 0), WhitePixel(dpy, 0));
-            XSetWindowAttributes attributes;
-            attributes.override_redirect = true;
-            XChangeWindowAttributes(dpy, m_window, X11OverrideRedirect, &attributes);
-            // Map window to the screen
-            XMapWindow(dpy, m_window);
-        }
-
-        return m_window;
-    }
-
-private:
-    struct DisplayConnection {
-        DisplayConnection()
-        {
-            m_display = XOpenDisplay(0);
-        }
-
-        ~DisplayConnection()
-        {
-            XCloseDisplay(m_display);
-        }
-
-        Display* display() { return m_display; }
-    private:
-        Display* m_display;
-    };
-
-public:
-    static Display* display()
-    {
-        // Display connection will only be broken at program shutdown.
-        static DisplayConnection displayConnection;
-        return displayConnection.display();
-    }
-
-    ~OffScreenRootWindow()
-    {
-        if (--m_refCount)
-            return;
-
-        if (m_window) {
-            XUnmapWindow(display(), m_window);
-            XDestroyWindow(display(), m_window);
-            m_window = 0;
-        }
-    }
-
-    static bool isMesaGLX()
-    {
-        static bool isMesa = !!strstr(glXGetClientString(display(), GLX_VENDOR), "Mesa");
-        return isMesa;
-    }
-
-private:
-    static int m_refCount;
-    static Window m_window;
-};
-
-int OffScreenRootWindow::m_refCount = 0;
-Window OffScreenRootWindow::m_window = 0;
-
-static const int glxSpec[] = {
-    // The specification is a set key value pairs stored in a simple array.
-    GLX_LEVEL,                          0,
-    GLX_DRAWABLE_TYPE,                  GLX_PIXMAP_BIT | GLX_WINDOW_BIT,
-    GLX_BIND_TO_TEXTURE_TARGETS_EXT,    GLX_TEXTURE_2D_BIT_EXT,
-    GLX_BIND_TO_TEXTURE_RGBA_EXT,       TRUE,
-    0
-};
-
-static const int glxAttributes[] = {
+static int glxAttributes[] = {
     GLX_TEXTURE_FORMAT_EXT,
     GLX_TEXTURE_FORMAT_RGBA_EXT,
     GLX_TEXTURE_TARGET_EXT,
@@ -212,19 +57,21 @@ static const int glxAttributes[] = {
     0
 };
 
+static bool isMesaGLX()
+{
+    static bool isMesa = !!strstr(glXGetClientString(X11Helper::nativeDisplay(), GLX_VENDOR), "Mesa");
+    return isMesa;
+}
+
 struct GraphicsSurfacePrivate {
     GraphicsSurfacePrivate(const PlatformGraphicsContext3D shareContext = 0)
-        : m_offScreenWindow(adoptPtr(new OffScreenRootWindow()))
-        , m_xPixmap(0)
+        : m_xPixmap(0)
         , m_glxPixmap(0)
         , m_surface(0)
         , m_glxSurface(0)
         , m_glContext(0)
         , m_detachedContext(0)
         , m_detachedSurface(0)
-        , m_fbConfig(0)
-        , m_textureIsYInverted(false)
-        , m_hasAlpha(false)
         , m_isReceiver(false)
     {
         GLXContext shareContextObject = 0;
@@ -240,16 +87,15 @@ struct GraphicsSurfacePrivate {
         UNUSED_PARAM(shareContext);
 #endif
 
-        int numReturned;
-        GLXFBConfig* fbConfigs = glXChooseFBConfig(display(), DefaultScreen(display()), attributes, &numReturned);
+        m_configSelector = adoptPtr(new GLXConfigSelector());
 
-        // Make sure that we choose a configuration that supports an alpha mask.
-        m_fbConfig = findFBConfigWithAlpha(fbConfigs, numReturned);
-
-        XFree(fbConfigs);
+        if (!m_configSelector->surfaceContextConfig()) {
+            clear();
+            return;
+        }
 
         // Create a GLX context for OpenGL rendering
-        m_glContext = glXCreateNewContext(display(), m_fbConfig, GLX_RGBA_TYPE, shareContextObject, true);
+        m_glContext = glXCreateNewContext(display(), m_configSelector->surfaceContextConfig(), GLX_RGBA_TYPE, shareContextObject, true);
     }
 
     GraphicsSurfacePrivate(uint32_t winId)
@@ -260,11 +106,10 @@ struct GraphicsSurfacePrivate {
         , m_glContext(0)
         , m_detachedContext(0)
         , m_detachedSurface(0)
-        , m_fbConfig(0)
-        , m_textureIsYInverted(false)
-        , m_hasAlpha(false)
         , m_isReceiver(true)
-    { }
+    {
+        m_configSelector = adoptPtr(new GLXConfigSelector());
+    }
 
     ~GraphicsSurfacePrivate()
     {
@@ -273,35 +118,32 @@ struct GraphicsSurfacePrivate {
 
     uint32_t createSurface(const IntSize& size)
     {
-        XVisualInfo* visualInfo = glXGetVisualFromFBConfig(display(), m_fbConfig);
-        if (!visualInfo)
+        if (!display() || !m_configSelector)
             return 0;
 
-        Colormap cmap = XCreateColormap(display(), m_offScreenWindow->getXWindow(), visualInfo->visual, AllocNone);
-
-        XSetWindowAttributes a;
-        a.background_pixel = WhitePixel(display(), 0);
-        a.border_pixel = BlackPixel(display(), 0);
-        a.colormap = cmap;
-        m_surface = XCreateWindow(display(), m_offScreenWindow->getXWindow(), 0, 0, size.width(), size.height(),
-            0, visualInfo->depth, InputOutput, visualInfo->visual,
-            CWBackPixel | CWBorderPixel | CWColormap, &a);
-        XSetWindowBackgroundPixmap(display(), m_surface, 0);
-        XCompositeRedirectWindow(display(), m_surface, CompositeRedirectManual);
-        m_glxSurface = glXCreateWindow(display(), m_fbConfig, m_surface, 0);
-        XFree(visualInfo);
-
-        // Make sure the XRender Extension is available.
-        int eventBasep, errorBasep;
-        if (!XRenderQueryExtension(display(), &eventBasep, &errorBasep))
+        OwnPtrX11<XVisualInfo> visInfo(m_configSelector->visualInfo());
+
+        if (!visInfo.get()) {
+            clear();
             return 0;
+        }
 
-        XMapWindow(display(), m_surface);
+        X11Helper::createOffScreenWindow(&m_surface, *visInfo.get(), size);
+
+        if (!m_surface) {
+            clear();
+            return 0;
+        }
+
+        m_glxSurface = glXCreateWindow(display(), m_configSelector->surfaceContextConfig(), m_surface, 0);
         return m_surface;
     }
 
     void createPixmap(uint32_t winId)
     {
+        if (!m_configSelector)
+            return;
+
         XWindowAttributes attr;
         if (!XGetWindowAttributes(display(), winId, &attr))
             return;
@@ -310,35 +152,25 @@ struct GraphicsSurfacePrivate {
         if (attr.map_state == IsUnmapped || attr.map_state == IsUnviewable)
             return;
 
-        ScopedXPixmapCreationErrorHandler handler(display());
+        ScopedXPixmapCreationErrorHandler handler;
         m_size = IntSize(attr.width, attr.height);
 
         XRenderPictFormat* format = XRenderFindVisualFormat(display(), attr.visual);
-        m_hasAlpha = (format->type == PictTypeDirect && format->direct.alphaMask);
-
-        int numberOfConfigs;
-        GLXFBConfig* configs = glXChooseFBConfig(display(), XDefaultScreen(display()), glxSpec, &numberOfConfigs);
-
-        // If origin window has alpha then find config with alpha.
-        GLXFBConfig& config = m_hasAlpha ? findFBConfigWithAlpha(configs, numberOfConfigs) : configs[0];
-
+        bool hasAlpha = (format->type == PictTypeDirect && format->direct.alphaMask);
         m_xPixmap = XCompositeNameWindowPixmap(display(), winId);
-        m_glxPixmap = glXCreatePixmap(display(), config, m_xPixmap, glxAttributes);
+        glxAttributes[1] = (format->depth == 32 || hasAlpha) ? GLX_TEXTURE_FORMAT_RGBA_EXT : GLX_TEXTURE_FORMAT_RGB_EXT;
+        m_glxPixmap = glXCreatePixmap(display(), m_configSelector->surfaceClientConfig(format->depth, XVisualIDFromVisual(attr.visual)), m_xPixmap, glxAttributes);
 
         if (!handler.isValidOperation())
             clear();
         else {
             uint inverted = 0;
             glXQueryDrawable(display(), m_glxPixmap, GLX_Y_INVERTED_EXT, &inverted);
-            m_textureIsYInverted = !!inverted;
-        }
-
-        XFree(configs);
-    }
+            m_flags = !!inverted ? TextureMapperGL::ShouldFlipTexture : 0;
 
-    bool textureIsYInverted()
-    {
-        return m_textureIsYInverted;
+            if (hasAlpha)
+                m_flags |= TextureMapperGL::ShouldBlend;
+        }
     }
 
     void makeCurrent()
@@ -406,7 +238,7 @@ struct GraphicsSurfacePrivate {
         doneCurrent();
     }
 
-    Display* display() const { return OffScreenRootWindow::display(); }
+    Display* display() const { return X11Helper::nativeDisplay(); }
 
     GLXPixmap glxPixmap() const
     {
@@ -426,25 +258,10 @@ struct GraphicsSurfacePrivate {
     }
 
     bool isReceiver() const { return m_isReceiver; }
-private:
-    GLXFBConfig& findFBConfigWithAlpha(GLXFBConfig* fbConfigs, int numberOfConfigs)
-    {
-        for (int i = 0; i < numberOfConfigs; ++i) {
-            XVisualInfo* visualInfo = glXGetVisualFromFBConfig(display(), fbConfigs[i]);
-            if (!visualInfo)
-                continue;
-
-            XRenderPictFormat* format = XRenderFindVisualFormat(display(), visualInfo->visual);
-            XFree(visualInfo);
 
-            if (format && format->direct.alphaMask > 0)
-                return fbConfigs[i];
-        }
-
-        // Return 1st config as a fallback with no alpha support.
-        return fbConfigs[0];
-    }
+    TextureMapperGL::Flags flags() const { return m_flags; }
 
+private:
     void clear()
     {
         if (m_glxPixmap) {
@@ -467,21 +284,22 @@ private:
             glXDestroyContext(display(), m_glContext);
             m_glContext = 0;
         }
+
+        if (m_configSelector)
+            m_configSelector = nullptr;
     }
 
-    OwnPtr<OffScreenRootWindow> m_offScreenWindow;
     IntSize m_size;
     Pixmap m_xPixmap;
     GLXPixmap m_glxPixmap;
-    Window m_surface;
+    uint32_t m_surface;
     Window m_glxSurface;
     GLXContext m_glContext;
     GLXContext m_detachedContext;
     GLXDrawable m_detachedSurface;
-    GLXFBConfig m_fbConfig;
-    bool m_textureIsYInverted;
-    bool m_hasAlpha;
+    OwnPtr<GLXConfigSelector> m_configSelector;
     bool m_isReceiver;
+    TextureMapperGL::Flags m_flags;
 };
 
 static bool resolveGLMethods()
@@ -545,13 +363,10 @@ void GraphicsSurface::platformPaintToTextureMapper(TextureMapper* textureMapper,
     if (!texture)
         return;
 
-    TextureMapperGL::Flags flags = m_private->textureIsYInverted() ? TextureMapperGL::ShouldFlipTexture : 0;
-    flags |= TextureMapperGL::ShouldBlend;
-
     FloatRect rectOnContents(FloatPoint::zero(), size);
     TransformationMatrix adjustedTransform = transform;
     adjustedTransform.multiply(TransformationMatrix::rectToRect(rectOnContents, targetRect));
-    static_cast<TextureMapperGL*>(textureMapper)->drawTexture(texture, flags, size, rectOnContents, adjustedTransform, opacity, mask);
+    static_cast<TextureMapperGL*>(textureMapper)->drawTexture(texture, m_private->flags(), size, rectOnContents, adjustedTransform, opacity, mask);
 }
 
 uint32_t GraphicsSurface::platformFrontBuffer() const
@@ -562,7 +377,7 @@ uint32_t GraphicsSurface::platformFrontBuffer() const
 uint32_t GraphicsSurface::platformSwapBuffers()
 {
     if (m_private->isReceiver()) {
-        if (OffScreenRootWindow::isMesaGLX() && platformGetTextureID()) {
+        if (isMesaGLX() && platformGetTextureID()) {
             glBindTexture(GL_TEXTURE_2D, platformGetTextureID());
             // Mesa doesn't re-bind texture to the front buffer on glXSwapBufer
             // Manually release previous lock and rebind texture to surface to get frame update.
diff --git a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp b/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp
new file mode 100644 (file)
index 0000000..100bb2e
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "X11Helper.h"
+
+namespace WebCore {
+
+// Used for handling XError.
+static bool validOperation = true;
+static int handleXPixmapCreationError(Display*, XErrorEvent* event)
+{
+    if (event->error_code == BadMatch || event->error_code == BadWindow || event->error_code == BadAlloc) {
+        validOperation = false;
+
+        switch (event->error_code) {
+        case BadMatch:
+            LOG_ERROR("BadMatch.");
+            break;
+        case BadWindow:
+            LOG_ERROR("BadWindow.");
+            break;
+        case BadAlloc:
+            LOG_ERROR("BadAlloc.");
+            break;
+        default:
+            break;
+        }
+    }
+
+    return 0;
+}
+
+struct DisplayConnection {
+    DisplayConnection()
+    {
+        m_display = XOpenDisplay(0);
+
+        if (!m_display)
+            LOG_ERROR("Failed to make connection with X");
+    }
+
+    ~DisplayConnection()
+    {
+        XCloseDisplay(m_display);
+    }
+
+    Display* display() { return m_display; }
+private:
+    Display* m_display;
+};
+
+struct OffScreenRootWindow {
+
+    OffScreenRootWindow()
+    {
+        m_window = 0;
+        Display* dpy = X11Helper::nativeDisplay();
+        if (!dpy)
+            return;
+
+        XSetWindowAttributes attributes;
+        attributes.override_redirect = true;
+        m_window = XCreateSimpleWindow(dpy, XDefaultRootWindow(dpy), -1, -1, 1, 1, 0, BlackPixel(dpy, 0), WhitePixel(dpy, 0));
+        // From http://tronche.com/gui/x/xlib/window/attributes/
+        XChangeWindowAttributes(dpy, m_window, CWOverrideRedirect, &attributes);
+        XMapWindow(dpy, m_window);
+
+        if (!m_window)
+            LOG_ERROR("Failed to create offscreen root window.");
+    }
+
+    ~OffScreenRootWindow()
+    {
+        if (!X11Helper::nativeDisplay())
+            return;
+
+        if (m_window) {
+            XUnmapWindow(X11Helper::nativeDisplay(), m_window);
+            XDestroyWindow(X11Helper::nativeDisplay(), m_window);
+            m_window = 0;
+        }
+    }
+
+    Window rootWindow()
+    {
+        return m_window;
+    }
+
+private:
+    Window m_window;
+};
+
+ScopedXPixmapCreationErrorHandler::ScopedXPixmapCreationErrorHandler()
+{
+    // XSync must be called to ensure that current errors are handled by the original handler.
+    XSync(X11Helper::nativeDisplay(), false);
+    m_previousErrorHandler = XSetErrorHandler(handleXPixmapCreationError);
+}
+
+ScopedXPixmapCreationErrorHandler::~ScopedXPixmapCreationErrorHandler()
+{
+    // Restore the original handler.
+    XSetErrorHandler(m_previousErrorHandler);
+}
+
+bool ScopedXPixmapCreationErrorHandler::isValidOperation() const
+{
+    validOperation = true;
+    // XSync is needed to catch possible errors as they are generated asynchronously.
+    XSync(X11Helper::nativeDisplay(), false);
+    return validOperation;
+}
+
+void X11Helper::resizeWindow(const IntRect& newRect, const uint32_t windowId)
+{
+    XResizeWindow(nativeDisplay(), windowId, newRect.width(), newRect.height());
+    XFlush(nativeDisplay());
+}
+
+void X11Helper::createOffScreenWindow(uint32_t* handleId, const XVisualInfo& visInfo, const IntSize& size)
+{
+#if USE(GRAPHICS_SURFACE)
+    Display* display = nativeDisplay();
+    if (!display)
+        return;
+
+    if (!visInfo.visual) {
+        LOG_ERROR("Failed to find valid XVisual.");
+        return;
+    }
+
+    Window xWindow = offscreenRootWindow();
+    if (!xWindow)
+        return;
+
+    Colormap cmap = XCreateColormap(display, xWindow, visInfo.visual, AllocNone);
+    XSetWindowAttributes attribute;
+    attribute.background_pixel = WhitePixel(display, 0);
+    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);
+
+    if (!tempHandleId) {
+        LOG_ERROR("Failed to create offscreen window.");
+        return;
+    }
+
+    XSetWindowBackgroundPixmap(display, tempHandleId, 0);
+    XCompositeRedirectWindow(display, tempHandleId, CompositeRedirectManual);
+    XMapWindow(display, tempHandleId);
+    *handleId = tempHandleId;
+#else
+    UNUSED_PARAM(handleId);
+    UNUSED_PARAM(visInfo);
+    UNUSED_PARAM(size);
+#endif
+}
+
+#if USE(EGL)
+void X11Helper::createOffScreenWindow(uint32_t* handleId, const EGLint id, const IntSize& size)
+{
+    VisualID visualId = static_cast<VisualID>(id);
+
+    if (!visualId)
+        return;
+
+    // EGL has suggested a visual id, so get the rest of the visual info for that id.
+    XVisualInfo visualInfoTemplate;
+    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
+    visualInfoTemplate.visualid = visualId;
+    int matchingCount = 0;
+    OwnPtrX11<XVisualInfo> matchingVisuals(XGetVisualInfo(nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount));
+    XVisualInfo* foundVisual = 0;
+
+    if (matchingVisuals) {
+        for (int i = 0; i< matchingCount; i++) {
+            XVisualInfo* temp = &matchingVisuals[i];
+
+            if (isXRenderExtensionSupported()) {
+                XRenderPictFormat* format = XRenderFindVisualFormat(nativeDisplay(), temp->visual);
+                if (format && format->direct.alphaMask > 0) {
+                    foundVisual = temp;
+                    break;
+                }
+            }
+
+            if (temp->depth == 32) {
+                foundVisual = temp;
+                break;
+            }
+        }
+
+        if (foundVisual)
+            createOffScreenWindow(handleId, *foundVisual, size);
+    }
+}
+#endif
+
+void X11Helper::destroyWindow(const uint32_t windowId)
+{
+    if (!windowId)
+        return;
+
+    Display* display = nativeDisplay();
+    if (!display)
+        return;
+
+    XDestroyWindow(display, windowId);
+}
+
+bool X11Helper::isXRenderExtensionSupported()
+{
+    static bool queryDone = false;
+    static bool supportsXRenderExtension = false;
+
+    if (!queryDone) {
+        queryDone = true;
+#if USE(GRAPHICS_SURFACE)
+        Display* display = nativeDisplay();
+
+        if (display) {
+            int eventBasep, errorBasep;
+            supportsXRenderExtension = XRenderQueryExtension(display, &eventBasep, &errorBasep);
+        }
+#endif
+    }
+
+    return supportsXRenderExtension;
+}
+
+Display* X11Helper::nativeDisplay()
+{
+    // Display connection will only be broken at program shutdown.
+    static DisplayConnection displayConnection;
+    return displayConnection.display();
+}
+
+Window X11Helper::offscreenRootWindow()
+{
+    static OffScreenRootWindow offscreenWindow;
+    return offscreenWindow.rootWindow();
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h b/Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h
new file mode 100644 (file)
index 0000000..6e7a682
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef X11Helper_h
+#define X11Helper_h
+
+#include "IntRect.h"
+#include "OwnPtrX11.h"
+
+#if USE(GRAPHICS_SURFACE)
+
+#if USE(EGL)
+#include <opengl/GLDefs.h>
+#endif
+
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/Xrender.h>
+#endif
+
+#include <X11/Xlib.h>
+
+namespace WebCore {
+
+class X11Helper {
+
+public:
+    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 resizeWindow(const IntRect&, const uint32_t);
+    static bool isXRenderExtensionSupported();
+    static Display* nativeDisplay();
+    static Window offscreenRootWindow();
+};
+
+class ScopedXPixmapCreationErrorHandler {
+
+public:
+    ScopedXPixmapCreationErrorHandler();
+    ~ScopedXPixmapCreationErrorHandler();
+    bool isValidOperation() const;
+
+private:
+    XErrorHandler m_previousErrorHandler;
+};
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp b/Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp
deleted file mode 100644 (file)
index 3e263ea..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "X11WindowResources.h"
-
-#if USE(ACCELERATED_COMPOSITING)
-
-namespace WebCore {
-
-SharedX11Resources* SharedX11Resources::m_staticSharedResource = 0;
-
-X11OffScreenWindow::X11OffScreenWindow()
-    : m_sharedResources(0)
-{
-    m_sharedResources = SharedX11Resources::create();
-}
-
-X11OffScreenWindow::~X11OffScreenWindow()
-{
-}
-
-void X11OffScreenWindow::reSizeWindow(const IntRect& newRect, const uint32_t windowId)
-{
-    XResizeWindow(m_sharedResources->x11Display(), windowId, newRect.width(), newRect.height());
-    XFlush(m_sharedResources->x11Display());
-}
-
-#if USE(GRAPHICS_SURFACE)
-void X11OffScreenWindow::createOffScreenWindow(uint32_t* handleId, const XVisualInfo& visInfo, const IntSize& size)
-{
-    if (!m_sharedResources)
-        return;
-
-    Display* display = m_sharedResources->x11Display();
-    if (!display)
-        return;
-
-    if (!visInfo.visual) {
-        LOG_ERROR("Failed to find valid XVisual.");
-        return;
-    }
-
-    Window xWindow = m_sharedResources->getXWindow();
-    if (!xWindow)
-        return;
-
-    Colormap cmap = XCreateColormap(display, xWindow, visInfo.visual, AllocNone);
-    XSetWindowAttributes attribute;
-    attribute.background_pixel = WhitePixel(display, 0);
-    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);
-
-    if (!tempHandleId) {
-        LOG_ERROR("Failed to create offscreen window.");
-        return;
-    }
-
-    XSetWindowBackgroundPixmap(display, tempHandleId, 0);
-    XCompositeRedirectWindow(display, tempHandleId, CompositeRedirectManual);
-    XMapWindow(display, tempHandleId);
-    *handleId = tempHandleId;
-}
-
-#if USE(EGL)
-void X11OffScreenWindow::createOffScreenWindow(uint32_t* handleId, const EGLint id, const IntSize& size)
-{
-    VisualID visualId = static_cast<VisualID>(id);
-
-    if (!visualId)
-        return;
-
-    // EGL has suggested a visual id, so get the rest of the visual info for that id.
-    XVisualInfo visualInfoTemplate;
-    memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
-    visualInfoTemplate.visualid = visualId;
-    int matchingCount = 0;
-    OwnPtrX11<XVisualInfo> matchingVisuals = adoptPtr(XGetVisualInfo(m_sharedResources->x11Display(), VisualIDMask, &visualInfoTemplate, &matchingCount));
-    XVisualInfo* foundVisual = 0;
-
-    if (matchingVisuals) {
-        for (int i = 0; i< matchingCount; i++) {
-            XVisualInfo* temp = &matchingVisuals[i];
-
-            if (m_sharedResources->isXRenderExtensionSupported()) {
-                XRenderPictFormat* format = XRenderFindVisualFormat(m_sharedResources->x11Display(), temp->visual);
-                if (format && format->direct.alphaMask > 0) {
-                    foundVisual = temp;
-                    break;
-                }
-            }
-
-            if (temp->depth == 32) {
-                foundVisual = temp;
-                break;
-            }
-        }
-
-        if (foundVisual)
-            createOffScreenWindow(handleId, *foundVisual, size);
-    }
-}
-#endif
-
-#endif
-
-void X11OffScreenWindow::destroyWindow(const uint32_t windowId)
-{
-    if (!windowId)
-        return;
-
-    Display* display = m_sharedResources->x11Display();
-    if (!display)
-        return;
-
-    XDestroyWindow(display, windowId);
-}
-
-Display* X11OffScreenWindow::nativeSharedDisplay() const
-{
-    return m_sharedResources->x11Display();
-}
-
-bool X11OffScreenWindow::isXRenderExtensionSupported() const
-{
-    return m_sharedResources->isXRenderExtensionSupported();
-}
-
-}
-
-#endif
diff --git a/Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.h b/Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.h
deleted file mode 100644 (file)
index cc2d33f..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef X11WindowResources_h
-#define X11WindowResources_h
-
-#if USE(ACCELERATED_COMPOSITING)
-
-#include "IntRect.h"
-#include "OwnPtrX11.h"
-
-#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
-#if USE(GRAPHICS_SURFACE)
-
-#if USE(EGL)
-#include <opengl/GLDefs.h>
-#endif
-
-#include <X11/extensions/Xcomposite.h>
-#include <X11/extensions/Xrender.h>
-#endif
-
-namespace WebCore {
-
-class SharedX11Resources : public WTF::RefCountedBase {
-    WTF_MAKE_NONCOPYABLE(SharedX11Resources);
-
-public:
-    static PassRefPtr<SharedX11Resources> create()
-    {
-        if (!m_staticSharedResource)
-            m_staticSharedResource = new SharedX11Resources();
-        else
-            m_staticSharedResource->ref();
-
-        return adoptRef(m_staticSharedResource);
-    }
-
-    void deref()
-    {
-        if (derefBase()) {
-            m_staticSharedResource = 0;
-            delete this;
-        }
-    }
-
-    Display* x11Display()
-    {
-        if (!m_display) {
-            m_display = XOpenDisplay(0);
-            if (!m_display) {
-                LOG_ERROR("Failed to make connection with X");
-                return 0;
-            }
-#if USE(GRAPHICS_SURFACE)
-            if (m_display) {
-                int eventBasep, errorBasep;
-                m_supportsXRenderExtension = XRenderQueryExtension(m_display, &eventBasep, &errorBasep);
-            }
-#endif
-        }
-
-        return m_display;
-    }
-
-    Window getXWindow()
-    {
-        if (!m_window) {
-            Display* dpy = x11Display();
-            XSetWindowAttributes attributes;
-            attributes.override_redirect = true;
-            m_window = XCreateSimpleWindow(dpy, XDefaultRootWindow(dpy), -1, -1, 1, 1, 0, BlackPixel(dpy, 0), WhitePixel(dpy, 0));
-            // From http://tronche.com/gui/x/xlib/window/attributes/
-            XChangeWindowAttributes(dpy, m_window, CWOverrideRedirect, &attributes);
-            XMapWindow(dpy, m_window);
-
-            if (!m_window) {
-                LOG_ERROR("Failed to create offscreen root window.");
-                return 0;
-            }
-        }
-
-        return m_window;
-    }
-
-    bool isXRenderExtensionSupported() const
-    {
-        return m_supportsXRenderExtension;
-    }
-
-protected:
-    SharedX11Resources()
-        : m_supportsXRenderExtension(false)
-        , m_window(0)
-        , m_display(0)
-    {
-    }
-
-    virtual ~SharedX11Resources()
-    {
-        if (!m_display)
-            return;
-
-        if (m_window) {
-            XUnmapWindow(m_display, m_window);
-            XDestroyWindow(m_display, m_window);
-            m_window = 0;
-        }
-
-        XCloseDisplay(m_display);
-        m_display = 0;
-    }
-
-    static SharedX11Resources* m_staticSharedResource;
-    bool m_supportsXRenderExtension;
-    Window m_window;
-    Display* m_display;
-};
-
-class X11OffScreenWindow {
-    WTF_MAKE_NONCOPYABLE(X11OffScreenWindow);
-
-public:
-    X11OffScreenWindow();
-    virtual ~X11OffScreenWindow();
-#if USE(GRAPHICS_SURFACE)
-    void createOffScreenWindow(uint32_t*, const XVisualInfo&, const IntSize& = IntSize(1, 1));
-#if USE(EGL)
-    void createOffScreenWindow(uint32_t*, const EGLint, const IntSize& = IntSize(1, 1));
-#endif
-#endif
-    void destroyWindow(const uint32_t);
-    void reSizeWindow(const IntRect&, const uint32_t);
-    Display* nativeSharedDisplay() const;
-    bool isXRenderExtensionSupported() const;
-
-private:
-    RefPtr<SharedX11Resources> m_sharedResources;
-};
-
-}
-
-#endif
-
-#endif
index cc9072dd9ba3a1207b196e3b0733b9b46187e9cf..e39c0c2a494589ef283f89ed7d49c16c2b92f814 100644 (file)
@@ -138,7 +138,7 @@ defineTest(detectFeatures) {
     use?(3d_graphics) {
         mac: WEBKIT_CONFIG += use_graphics_surface
         win32:contains(QT_CONFIG, opengles2): WEBKIT_CONFIG += use_graphics_surface
-        linux-*:contains(WEBKIT_CONFIG, have_glx):contains(WEBKIT_CONFIG, have_xcomposite):contains(WEBKIT_CONFIG, have_xrender): WEBKIT_CONFIG += use_graphics_surface
+        linux-*:contains(WEBKIT_CONFIG, have_glx):contains(WEBKIT_CONFIG, have_xcomposite):contains(WEBKIT_CONFIG, have_xrender): WEBKIT_CONFIG += use_graphics_surface use_glx
     }
 
     # Slider Touch is sensible to use when compiling WebKit2