[EFL][WebGL] Add proper checks to enable GraphicsSurface usage on EGL without XCompos...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2013 07:57:44 +0000 (07:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 Mar 2013 07:57:44 +0000 (07:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108034

Patch by Kondapally Kalyan <kalyan.kondapally@intel.com> on 2013-03-03
Reviewed by Laszlo Gombos.

Covered by existing WebGL tests.

Currently, we set GRAPHICS_SURFACE to true if support for XCompositeWindow
is identified during compile time. This is ok, when using GLX. We might not
have support for XCompositeWindow when using EGL and GLES2.0. This patch
makes changes so that GRAPHICS_SURFACE is always enabled with EGL and adds
GLX guard to the parts of code dependent on XCompositeWindow support.

* platform/graphics/opengl/GLPlatformSurface.cpp:
* platform/graphics/surfaces/glx/GLXConfigSelector.h:
(WebCore::GLXConfigSelector::findMatchingConfig):
* platform/graphics/surfaces/glx/X11Helper.cpp:
(WebCore::X11Helper::createOffScreenWindow):
(WebCore::X11Helper::isXRenderExtensionSupported):
* platform/graphics/surfaces/glx/X11Helper.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp
Source/WebCore/platform/graphics/surfaces/glx/GLXConfigSelector.h
Source/WebCore/platform/graphics/surfaces/glx/X11Helper.cpp
Source/WebCore/platform/graphics/surfaces/glx/X11Helper.h
Source/cmake/OptionsEfl.cmake

index 3f0bf6f..2586ee9 100644 (file)
@@ -1,3 +1,26 @@
+2013-03-03  Kondapally Kalyan  <kalyan.kondapally@intel.com>
+
+        [EFL][WebGL] Add proper checks to enable GraphicsSurface usage on EGL without XCompositeWindow.
+        https://bugs.webkit.org/show_bug.cgi?id=108034
+
+        Reviewed by Laszlo Gombos.
+
+        Covered by existing WebGL tests.
+
+        Currently, we set GRAPHICS_SURFACE to true if support for XCompositeWindow
+        is identified during compile time. This is ok, when using GLX. We might not
+        have support for XCompositeWindow when using EGL and GLES2.0. This patch
+        makes changes so that GRAPHICS_SURFACE is always enabled with EGL and adds
+        GLX guard to the parts of code dependent on XCompositeWindow support.
+
+        * platform/graphics/opengl/GLPlatformSurface.cpp:
+        * platform/graphics/surfaces/glx/GLXConfigSelector.h:
+        (WebCore::GLXConfigSelector::findMatchingConfig):
+        * platform/graphics/surfaces/glx/X11Helper.cpp:
+        (WebCore::X11Helper::createOffScreenWindow):
+        (WebCore::X11Helper::isXRenderExtensionSupported):
+        * platform/graphics/surfaces/glx/X11Helper.h:
+
 2013-03-03  Alexander Pavlov  <apavlov@chromium.org>
 
         Web Inspector: [PageAgent] can't find frame by security origin.
index f32c2af..2fea7b0 100644 (file)
@@ -151,7 +151,7 @@ private:
             if (!scopedVisualInfo.get())
                 continue;
 
-#if USE(GRAPHICS_SURFACE)
+#if USE(GRAPHICS_SURFACE) && USE(GLX)
             if (X11Helper::isXRenderExtensionSupported()) {
                 XRenderPictFormat* format = XRenderFindVisualFormat(X11Helper::nativeDisplay(), scopedVisualInfo->visual);
 
@@ -208,3 +208,4 @@ private:
 #endif
 
 #endif
+
index cedd453..c366bdf 100644 (file)
@@ -183,7 +183,7 @@ void X11Helper::destroyPixmap(const uint32_t pixmapId)
 
 void X11Helper::createOffScreenWindow(uint32_t* handleId, const XVisualInfo& visInfo, const IntSize& size)
 {
-#if USE(GRAPHICS_SURFACE)
+#if USE(GRAPHICS_SURFACE) && USE(GLX)
     Display* display = nativeDisplay();
     if (!display)
         return;
@@ -241,22 +241,6 @@ void X11Helper::createOffScreenWindow(uint32_t* handleId, const EGLint id, bool
     if (matchingVisuals) {
         for (int i = 0; i< matchingCount; i++) {
             XVisualInfo* temp = &matchingVisuals[i];
-
-            if (isXRenderExtensionSupported()) {
-                XRenderPictFormat* format = XRenderFindVisualFormat(nativeDisplay(), temp->visual);
-
-                if (format) {
-                    if (supportsAlpha) {
-                        if (temp->depth == 32 && format->direct.alphaMask > 0)
-                            foundVisual = temp;
-                    } else if (!format->direct.alphaMask)
-                        foundVisual = temp;
-                }
-
-                if (foundVisual)
-                    break;
-            }
-
             int matchingdepth = supportsAlpha ? 32 : 24;
 
             if (temp->depth == matchingdepth) {
@@ -295,7 +279,7 @@ bool X11Helper::isXRenderExtensionSupported()
 
     if (!queryDone) {
         queryDone = true;
-#if USE(GRAPHICS_SURFACE)
+#if USE(GRAPHICS_SURFACE) && USE(GLX)
         Display* display = nativeDisplay();
 
         if (display) {
@@ -322,3 +306,4 @@ Window X11Helper::offscreenRootWindow()
 }
 
 }
+
index 7d3ebae..1c14d22 100644 (file)
 #include "IntRect.h"
 #include "OwnPtrX11.h"
 
-#if USE(GRAPHICS_SURFACE)
-
 #if USE(EGL)
 #include <opengl/GLDefs.h>
 #endif
 
+#if USE(GRAPHICS_SURFACE) && USE(GLX)
 #include <X11/extensions/Xcomposite.h>
 #include <X11/extensions/Xrender.h>
-#endif
-
+#else
 #include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#endif
 
 namespace WebCore {
 
@@ -73,3 +73,4 @@ private:
 }
 
 #endif
+
index 90215e2..f865bbf 100644 (file)
@@ -186,6 +186,7 @@ if (ENABLE_WEBGL OR WTF_USE_TILED_BACKING_STORE)
 
     if (EGL_FOUND)
         set(WTF_USE_EGL 1)
+        set(USE_GRAPHICS_SURFACE 1)
         add_definitions(-DWTF_USE_EGL=1)
         option(ENABLE_GLES2 ON)
 
@@ -199,11 +200,14 @@ if (ENABLE_WEBGL OR WTF_USE_TILED_BACKING_STORE)
         endif ()
      elseif (OPENGLX_FOUND)
          add_definitions(-DWTF_USE_GLX=1)
-    endif ()
 
-     if ((OPENGLX_FOUND OR EGL_FOUND) AND X11_Xcomposite_FOUND AND X11_Xrender_FOUND)
-         set(USE_GRAPHICS_SURFACE 1)
-     endif ()
+         if (X11_Xcomposite_FOUND AND X11_Xrender_FOUND)
+             set(USE_GRAPHICS_SURFACE 1)
+         elseif (ENABLE_WEBGL)
+             # FIXME: Add support for NOT X11_Xcomposite for GLX
+             message(FATAL_ERROR "To use WebGL with GLX support requires X11_Xcomposite.")
+         endif ()
+    endif ()
 endif ()
 
 if (ENABLE_INSPECTOR)