.: [EFL][WebGL][Wk2] Replace HAVE(GLX) checks with USE(GLX).
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2012 23:57:01 +0000 (23:57 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2012 23:57:01 +0000 (23:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=105431

Patch by Kondapally Kalyan <kalyan.kondapally@intel.com> on 2012-12-20
Reviewed by Kenneth Rohde Christiansen.

This patch changes the check HAVE(GLX) to USE(GLX).
This would enable us to choose our preferred GL backend during build time.

* Source/cmake/OptionsEfl.cmake:

Source/WebCore: [EFL][WebGL][Wk2] Replace HAVE(GLX) checks with USE(GLX)
https://bugs.webkit.org/show_bug.cgi?id=105431

Patch by Kondapally Kalyan <kalyan.kondapally@intel.com> on 2012-12-20
Reviewed by Kenneth Rohde Christiansen.

This patch changes the check HAVE(GLX) to USE(GLX).
This would enable us to choose our preferred GL backend during build time.
This patch also adds an additional api to query the shared buffer handle.
Buffer handle is not same as gl surface and would depend on how the content is
backed up.

* platform/graphics/opengl/GLDefs.h:
(WebCore):
* platform/graphics/opengl/GLPlatformContext.cpp:
(WebCore::GLPlatformContext::createContext):
(WebCore::GLPlatformContext::createOffScreenContext):
(WebCore::GLPlatformContext::createCurrentContextWrapper):
* platform/graphics/opengl/GLPlatformSurface.cpp:
(WebCore::GLPlatformSurface::createOffscreenSurface):
(WebCore::GLPlatformSurface::createTransportSurface):
(WebCore::GLPlatformSurface::GLPlatformSurface):
(WebCore::GLPlatformSurface::handle):
(WebCore):
(WebCore::GLPlatformSurface::drawable):
* platform/graphics/opengl/GLPlatformSurface.h:
(GLPlatformSurface):
* platform/graphics/surfaces/glx/GLXContext.cpp:
* platform/graphics/surfaces/glx/GLXContext.h:
* platform/graphics/surfaces/glx/GLXSurface.cpp:
(WebCore::GLXTransportSurface::GLXTransportSurface):
(WebCore::GLXTransportSurface::destroy):
(WebCore::GLXPBuffer::initialize):
(WebCore::GLXPBuffer::freeResources):
* platform/graphics/surfaces/glx/GLXSurface.h:
* platform/graphics/surfaces/glx/GLXWindowResources.h:
* platform/graphics/surfaces/glx/X11WindowResources.cpp:
(WebCore::X11OffScreenWindow::X11OffScreenWindow):
(WebCore::X11OffScreenWindow::setGeometry):
(WebCore::X11OffScreenWindow::createOffscreenWindow):
(WebCore::X11OffScreenWindow::destroyWindow):
* platform/graphics/surfaces/glx/X11WindowResources.h:
(WebCore):
(DummySharedResources):
(WebCore::DummySharedResources::create):
(WebCore::DummySharedResources::nativeDisplay):
(WebCore::DummySharedResources::pBufferContextConfig):
(WebCore::DummySharedResources::surfaceContextConfig):
(WebCore::DummySharedResources::DummySharedResources):
(WebCore::DummySharedResources::~DummySharedResources):

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

13 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/opengl/GLDefs.h
Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp
Source/WebCore/platform/graphics/opengl/GLPlatformSurface.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/GLXWindowResources.h
Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp
Source/cmake/OptionsEfl.cmake

index 30076d19716dac2a8d9e7a78830918fc748b377b..9a4bacb39f979e4b5f39d90d636137cdebe84a5c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-12-20  Kondapally Kalyan  <kalyan.kondapally@intel.com>
+
+        [EFL][WebGL][Wk2] Replace HAVE(GLX) checks with USE(GLX).
+        https://bugs.webkit.org/show_bug.cgi?id=105431
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        This patch changes the check HAVE(GLX) to USE(GLX).
+        This would enable us to choose our preferred GL backend during build time.
+
+        * Source/cmake/OptionsEfl.cmake:
+
 2012-12-20  Zan Dobersek  <zandobersek@gmail.com>
 
         [GTK] Remove the --enable-unstable-features configuration option
index be71b1dcf047b13d000f28af3e90466e4844b3c3..f6b1f4159458c82b1db381a5ea7f5861634f1544 100644 (file)
@@ -1,3 +1,55 @@
+2012-12-20  Kondapally Kalyan  <kalyan.kondapally@intel.com>
+
+        [EFL][WebGL][Wk2] Replace HAVE(GLX) checks with USE(GLX)
+        https://bugs.webkit.org/show_bug.cgi?id=105431
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        This patch changes the check HAVE(GLX) to USE(GLX).
+        This would enable us to choose our preferred GL backend during build time.
+        This patch also adds an additional api to query the shared buffer handle.
+        Buffer handle is not same as gl surface and would depend on how the content is
+        backed up.
+
+        * platform/graphics/opengl/GLDefs.h:
+        (WebCore):
+        * platform/graphics/opengl/GLPlatformContext.cpp:
+        (WebCore::GLPlatformContext::createContext):
+        (WebCore::GLPlatformContext::createOffScreenContext):
+        (WebCore::GLPlatformContext::createCurrentContextWrapper):
+        * platform/graphics/opengl/GLPlatformSurface.cpp:
+        (WebCore::GLPlatformSurface::createOffscreenSurface):
+        (WebCore::GLPlatformSurface::createTransportSurface):
+        (WebCore::GLPlatformSurface::GLPlatformSurface):
+        (WebCore::GLPlatformSurface::handle):
+        (WebCore):
+        (WebCore::GLPlatformSurface::drawable):
+        * platform/graphics/opengl/GLPlatformSurface.h:
+        (GLPlatformSurface):
+        * platform/graphics/surfaces/glx/GLXContext.cpp:
+        * platform/graphics/surfaces/glx/GLXContext.h:
+        * platform/graphics/surfaces/glx/GLXSurface.cpp:
+        (WebCore::GLXTransportSurface::GLXTransportSurface):
+        (WebCore::GLXTransportSurface::destroy):
+        (WebCore::GLXPBuffer::initialize):
+        (WebCore::GLXPBuffer::freeResources):
+        * platform/graphics/surfaces/glx/GLXSurface.h:
+        * platform/graphics/surfaces/glx/GLXWindowResources.h:
+        * platform/graphics/surfaces/glx/X11WindowResources.cpp:
+        (WebCore::X11OffScreenWindow::X11OffScreenWindow):
+        (WebCore::X11OffScreenWindow::setGeometry):
+        (WebCore::X11OffScreenWindow::createOffscreenWindow):
+        (WebCore::X11OffScreenWindow::destroyWindow):
+        * platform/graphics/surfaces/glx/X11WindowResources.h:
+        (WebCore):
+        (DummySharedResources):
+        (WebCore::DummySharedResources::create):
+        (WebCore::DummySharedResources::nativeDisplay):
+        (WebCore::DummySharedResources::pBufferContextConfig):
+        (WebCore::DummySharedResources::surfaceContextConfig):
+        (WebCore::DummySharedResources::DummySharedResources):
+        (WebCore::DummySharedResources::~DummySharedResources):
+
 2012-12-20  Emil A Eklund  <eae@chromium.org>
 
         [flexbox] Fix handling of very large flex grow/shrink values
index df5bcdde1056bc1587962360cf61b7b33a82a1b2..2dfb4c906a6316f1bf237968deba7dfe80959c36 100644 (file)
 #include <GL/glext.h>
 #endif
 
-#if HAVE(GLX)
+#if USE(GLX)
 #include <GL/glx.h>
 #endif
 
 namespace WebCore {
 
-#if HAVE(GLX)
+typedef uint32_t PlatformBufferHandle;
+
+#if USE(GLX)
 typedef GLXContext PlatformContext;
 typedef Display* PlatformDisplay;
 typedef GLXFBConfig PlatformSurfaceConfig;
-typedef GLXDrawable PlatformSurface;
+typedef GLXDrawable PlatformDrawable;
 #else
 typedef void* PlatformContext;
 typedef void* PlatformDisplay;
 typedef void* PlatformSurfaceConfig;
-typedef void* PlatformSurface;
+typedef void* PlatformDrawable;
 #endif
 
 }
index 24c84447cd347f810177d0913f8d3857358a71d0..7621e2e99135162b87e558f4c0d6d7d6c47062ea 100644 (file)
@@ -28,7 +28,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
-#if HAVE(GLX)
+#if USE(GLX)
 #include "GLXContext.h"
 #endif
 
@@ -45,7 +45,7 @@ PassOwnPtr<GLPlatformContext> GLPlatformContext::createContext(GraphicsContext3D
         return nullptr;
 
     if (!glGetGraphicsResetStatusARB) {
-#if HAVE(GLX)
+#if USE(GLX)
         glGetGraphicsResetStatusARB = reinterpret_cast<PFNGLGETGRAPHICSRESETSTATUSARBPROC>(glXGetProcAddressARB(reinterpret_cast<const GLubyte*>("glGetGraphicsResetStatusARB")));
 #endif
     }
@@ -69,7 +69,7 @@ PassOwnPtr<GLPlatformContext> GLPlatformContext::createContext(GraphicsContext3D
 
 PassOwnPtr<GLPlatformContext> GLPlatformContext::createOffScreenContext()
 {
-#if HAVE(GLX)
+#if USE(GLX)
     OwnPtr<GLPlatformContext> glxContext = adoptPtr(new GLXOffScreenContext());
     return glxContext.release();
 #endif
@@ -79,7 +79,7 @@ PassOwnPtr<GLPlatformContext> GLPlatformContext::createOffScreenContext()
 
 PassOwnPtr<GLPlatformContext> GLPlatformContext::createCurrentContextWrapper()
 {
-#if HAVE(GLX)
+#if USE(GLX)
     OwnPtr<GLPlatformContext> glxContext = adoptPtr(new GLXCurrentContextWrapper());
     return glxContext.release();
 #endif
index 160ca3f0a9972e862199601cbe13f285ba2306fd..8391e47adf54bf649d9151eb8f65deaa1ad0cbeb 100644 (file)
@@ -38,10 +38,10 @@ namespace WebCore {
 
 PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffscreenSurface()
 {
-#if HAVE(GLX)
+#if USE(GLX)
     OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXPBuffer());
 
-    if (surface->handle())
+    if (surface->handle() && surface->drawable())
         return surface.release();
 #endif
 
@@ -50,7 +50,7 @@ PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createOffscreenSurface()
 
 PassOwnPtr<GLPlatformSurface> GLPlatformSurface::createTransportSurface()
 {
-#if HAVE(GLX) && USE(GRAPHICS_SURFACE)
+#if USE(GLX) && USE(GRAPHICS_SURFACE)
     OwnPtr<GLPlatformSurface> surface = adoptPtr(new GLXTransportSurface());
 
     if (surface->handle())
@@ -65,6 +65,7 @@ GLPlatformSurface::GLPlatformSurface()
     , m_fboId(0)
     , m_sharedDisplay(0)
     , m_drawable(0)
+    , m_bufferHandle(0)
 {
 }
 
@@ -72,7 +73,12 @@ GLPlatformSurface::~GLPlatformSurface()
 {
 }
 
-PlatformSurface GLPlatformSurface::handle() const
+PlatformBufferHandle GLPlatformSurface::handle() const
+{
+    return m_bufferHandle;
+}
+
+PlatformDrawable GLPlatformSurface::drawable() const
 {
     return m_drawable;
 }
index 463a6b2605a06218bb0ee04e0e553b8f34d3d3d3..e8db4254ce31cb743c8cee78f50980c523837617 100644 (file)
@@ -52,8 +52,10 @@ public:
 
     const IntRect& geometry() const;
 
-    // Get the underlying platform specific surface handle.
-    PlatformSurface handle() const;
+    // Get the underlying platform specific buffer handle.
+    PlatformBufferHandle handle() const;
+
+    PlatformDrawable drawable() const;
 
     PlatformDisplay sharedDisplay() const;
 
@@ -78,7 +80,8 @@ protected:
     IntRect m_rect;
     GLuint m_fboId;
     PlatformDisplay m_sharedDisplay;
-    PlatformSurface m_drawable;
+    PlatformDrawable m_drawable;
+    PlatformBufferHandle m_bufferHandle;
 };
 
 }
index 295f06cf6477628c680ed1408c8fa2b7a63f1923..9956cb11821e0b8fc7691e623d7175667726ca6b 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "GLXContext.h"
 
-#if USE(ACCELERATED_COMPOSITING) && HAVE(GLX)
+#if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
 namespace WebCore {
 
index 7cff8d51fb73326e2844df107e2acc0fe1928088..43a52dca62160f8a23cc68f180af4f84b7e02ddb 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef GLXContext_h
 #define GLXContext_h
 
-#if USE(ACCELERATED_COMPOSITING) && HAVE(GLX)
+#if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
 #include "GLPlatformContext.h"
 
index 3bc3206708f22720f86a186eaf96c475e7618dea..96a0ab9248b26cda0b87bf5d8c3df89a7e98a44f 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "GLXSurface.h"
 
-#if USE(ACCELERATED_COMPOSITING) && HAVE(GLX)
+#if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
 namespace WebCore {
 
@@ -37,6 +37,7 @@ GLXTransportSurface::GLXTransportSurface()
     : X11OffScreenWindow()
 {
     createOffscreenWindow();
+    m_drawable = m_bufferHandle;
 }
 
 GLXTransportSurface::~GLXTransportSurface()
@@ -66,6 +67,7 @@ void GLXTransportSurface::swapBuffers()
 void GLXTransportSurface::destroy()
 {
     destroyWindow();
+    m_bufferHandle = 0;
 }
 
 #endif
@@ -88,6 +90,7 @@ void GLXPBuffer::initialize()
         return;
 
     m_drawable = glXCreatePbuffer(display, config, pbufferAttributes);
+    m_bufferHandle = m_drawable;
 }
 
 PlatformSurfaceConfig GLXPBuffer::configuration()
@@ -112,6 +115,7 @@ void GLXPBuffer::freeResources()
 
     glXDestroyPbuffer(display, m_drawable);
     m_drawable = 0;
+    m_bufferHandle = 0;
 }
 
 void GLXPBuffer::setGeometry(const IntRect& newRect)
index cf01a45bdbf920e745c8e039a8a837538cefd81b..4e87685909c2cf16410b1b46f12ec0a6ee026cb1 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef GLXSurface_h
 #define GLXSurface_h
 
-#if USE(ACCELERATED_COMPOSITING) && HAVE(GLX)
+#if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
 #include "GLXWindowResources.h"
 
index b8054f2bc5c8cddc6b0ed1cf4b3efa7a2d4f6938..c173557f2b31c98292c3de673c021455825fe000 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "X11WindowResources.h"
 
-#if USE(ACCELERATED_COMPOSITING) && HAVE(GLX)
+#if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
 namespace WebCore {
 
index 755a488969675e586fc518dd19eb9bfffd883497..60293e7a2e009824e4ea7b32fbf53f4a4366b168 100644 (file)
@@ -36,8 +36,13 @@ PlatformSharedResources* SharedX11Resources::m_staticSharedResource = 0;
 
 X11OffScreenWindow::X11OffScreenWindow()
     : GLPlatformSurface()
+    , m_sharedResources(0)
 {
     m_sharedResources = PlatformSharedResources::create();
+
+    if (!m_sharedResources)
+        return;
+
     m_sharedDisplay = m_sharedResources->nativeDisplay();
 }
 
@@ -48,16 +53,19 @@ X11OffScreenWindow::~X11OffScreenWindow()
 void X11OffScreenWindow::setGeometry(const IntRect& newRect)
 {
     GLPlatformSurface::setGeometry(newRect);
-    XResizeWindow(m_sharedResources->x11Display(), m_drawable, newRect.width(), newRect.height());
+    XResizeWindow(m_sharedResources->x11Display(), m_bufferHandle, newRect.width(), newRect.height());
 }
 
 void X11OffScreenWindow::createOffscreenWindow()
 {
+    if (!m_sharedResources)
+        return;
+
     Display* display = m_sharedResources->x11Display();
     if (!display)
         return;
 
-    GLXFBConfig config = m_sharedResources->surfaceContextConfig();
+    PlatformSurfaceConfig config = m_sharedResources->surfaceContextConfig();
 
     if (!config) {
         LOG_ERROR("Failed to retrieve a valid configiration.");
@@ -80,33 +88,33 @@ void X11OffScreenWindow::createOffscreenWindow()
     attribute.background_pixel = WhitePixel(display, 0);
     attribute.border_pixel = BlackPixel(display, 0);
     attribute.colormap = cmap;
-    m_drawable = XCreateWindow(display, xWindow, 0, 0, 1, 1, 0, visInfo->depth, InputOutput, visInfo->visual, CWBackPixel | CWBorderPixel | CWColormap, &attribute);
+    m_bufferHandle = XCreateWindow(display, xWindow, 0, 0, 1, 1, 0, visInfo->depth, InputOutput, visInfo->visual, CWBackPixel | CWBorderPixel | CWColormap, &attribute);
 
-    if (!m_drawable) {
+    if (!m_bufferHandle) {
         LOG_ERROR("Failed to create offscreen window");
         return;
     }
 
-    XSetWindowBackgroundPixmap(display, m_drawable, 0);
-    XCompositeRedirectWindow(display, m_drawable, CompositeRedirectManual);
+    XSetWindowBackgroundPixmap(display, m_bufferHandle, 0);
+    XCompositeRedirectWindow(display, m_bufferHandle, CompositeRedirectManual);
 
     if (m_sharedResources->isXRenderExtensionSupported())
-        XMapWindow(display, m_drawable);
+        XMapWindow(display, m_bufferHandle);
 
 }
 
 void X11OffScreenWindow::destroyWindow()
 {
-    if (!m_drawable)
+    if (!m_bufferHandle)
         return;
 
     GLPlatformSurface::destroy();
-    Display* display = sharedDisplay();
+    Display* display = m_sharedResources->x11Display();
     if (!display)
         return;
 
-    XDestroyWindow(display, m_drawable);
-    m_drawable = 0;
+    XDestroyWindow(display, m_bufferHandle);
+    m_bufferHandle = 0;
 }
 
 }
index 6e5610a0a88338ab051a90ac1bf0d77a08ba923d..a5133e92d39f77a5babdfb89d7ed90065ef73d8b 100644 (file)
@@ -169,6 +169,8 @@ if (ENABLE_WEBGL OR WTF_USE_TILED_BACKING_STORE)
 
     if (OPENGLX_FOUND)
         add_definitions(-DHAVE_GLX)
+        add_definitions(-DWTF_USE_GLX=1)
+
         if (X11_Xcomposite_FOUND AND X11_Xrender_FOUND)
            set(USE_GRAPHICS_SURFACE 1)
         endif ()