Title: [138313] trunk
Revision
138313
Author
[email protected]
Date
2012-12-20 15:57:01 -0800 (Thu, 20 Dec 2012)

Log Message

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

Patch by Kondapally Kalyan <[email protected]> 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 <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/ChangeLog (138312 => 138313)


--- trunk/ChangeLog	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/ChangeLog	2012-12-20 23:57:01 UTC (rev 138313)
@@ -1,3 +1,15 @@
+2012-12-20  Kondapally Kalyan  <[email protected]>
+
+        [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  <[email protected]>
 
         [GTK] Remove the --enable-unstable-features configuration option

Modified: trunk/Source/WebCore/ChangeLog (138312 => 138313)


--- trunk/Source/WebCore/ChangeLog	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/ChangeLog	2012-12-20 23:57:01 UTC (rev 138313)
@@ -1,3 +1,55 @@
+2012-12-20  Kondapally Kalyan  <[email protected]>
+
+        [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  <[email protected]>
 
         [flexbox] Fix handling of very large flex grow/shrink values

Modified: trunk/Source/WebCore/platform/graphics/opengl/GLDefs.h (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/opengl/GLDefs.h	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLDefs.h	2012-12-20 23:57:01 UTC (rev 138313)
@@ -38,22 +38,24 @@
 #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
 
 }

Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformContext.cpp	2012-12-20 23:57:01 UTC (rev 138313)
@@ -28,7 +28,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)
 
-#if HAVE(GLX)
+#if USE(GLX)
 #include "GLXContext.h"
 #endif
 
@@ -45,7 +45,7 @@
         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::createOffScreenContext()
 {
-#if HAVE(GLX)
+#if USE(GLX)
     OwnPtr<GLPlatformContext> glxContext = adoptPtr(new GLXOffScreenContext());
     return glxContext.release();
 #endif
@@ -79,7 +79,7 @@
 
 PassOwnPtr<GLPlatformContext> GLPlatformContext::createCurrentContextWrapper()
 {
-#if HAVE(GLX)
+#if USE(GLX)
     OwnPtr<GLPlatformContext> glxContext = adoptPtr(new GLXCurrentContextWrapper());
     return glxContext.release();
 #endif

Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.cpp	2012-12-20 23:57:01 UTC (rev 138313)
@@ -38,10 +38,10 @@
 
 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::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 @@
     , m_fboId(0)
     , m_sharedDisplay(0)
     , m_drawable(0)
+    , m_bufferHandle(0)
 {
 }
 
@@ -72,8 +73,13 @@
 {
 }
 
-PlatformSurface GLPlatformSurface::handle() const
+PlatformBufferHandle GLPlatformSurface::handle() const
 {
+    return m_bufferHandle;
+}
+
+PlatformDrawable GLPlatformSurface::drawable() const
+{
     return m_drawable;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/opengl/GLPlatformSurface.h	2012-12-20 23:57:01 UTC (rev 138313)
@@ -52,9 +52,11 @@
 
     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;
 
     virtual void swapBuffers();
@@ -78,7 +80,8 @@
     IntRect m_rect;
     GLuint m_fboId;
     PlatformDisplay m_sharedDisplay;
-    PlatformSurface m_drawable;
+    PlatformDrawable m_drawable;
+    PlatformBufferHandle m_bufferHandle;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.cpp	2012-12-20 23:57:01 UTC (rev 138313)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "GLXContext.h"
 
-#if USE(ACCELERATED_COMPOSITING) && HAVE(GLX)
+#if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.h (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.h	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXContext.h	2012-12-20 23:57:01 UTC (rev 138313)
@@ -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"
 

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.cpp	2012-12-20 23:57:01 UTC (rev 138313)
@@ -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 @@
     : X11OffScreenWindow()
 {
     createOffscreenWindow();
+    m_drawable = m_bufferHandle;
 }
 
 GLXTransportSurface::~GLXTransportSurface()
@@ -66,6 +67,7 @@
 void GLXTransportSurface::destroy()
 {
     destroyWindow();
+    m_bufferHandle = 0;
 }
 
 #endif
@@ -88,6 +90,7 @@
         return;
 
     m_drawable = glXCreatePbuffer(display, config, pbufferAttributes);
+    m_bufferHandle = m_drawable;
 }
 
 PlatformSurfaceConfig GLXPBuffer::configuration()
@@ -112,6 +115,7 @@
 
     glXDestroyPbuffer(display, m_drawable);
     m_drawable = 0;
+    m_bufferHandle = 0;
 }
 
 void GLXPBuffer::setGeometry(const IntRect& newRect)

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXSurface.h	2012-12-20 23:57:01 UTC (rev 138313)
@@ -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"
 

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXWindowResources.h (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXWindowResources.h	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/GLXWindowResources.h	2012-12-20 23:57:01 UTC (rev 138313)
@@ -28,7 +28,7 @@
 
 #include "X11WindowResources.h"
 
-#if USE(ACCELERATED_COMPOSITING) && HAVE(GLX)
+#if USE(ACCELERATED_COMPOSITING) && USE(GLX)
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp (138312 => 138313)


--- trunk/Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/WebCore/platform/graphics/surfaces/glx/X11WindowResources.cpp	2012-12-20 23:57:01 UTC (rev 138313)
@@ -36,8 +36,13 @@
 
 X11OffScreenWindow::X11OffScreenWindow()
     : GLPlatformSurface()
+    , m_sharedResources(0)
 {
     m_sharedResources = PlatformSharedResources::create();
+
+    if (!m_sharedResources)
+        return;
+
     m_sharedDisplay = m_sharedResources->nativeDisplay();
 }
 
@@ -48,16 +53,19 @@
 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 @@
     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;
 }
 
 }

Modified: trunk/Source/cmake/OptionsEfl.cmake (138312 => 138313)


--- trunk/Source/cmake/OptionsEfl.cmake	2012-12-20 23:54:53 UTC (rev 138312)
+++ trunk/Source/cmake/OptionsEfl.cmake	2012-12-20 23:57:01 UTC (rev 138313)
@@ -169,6 +169,8 @@
 
     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 ()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to