Title: [150440] trunk/Source/WebCore
Revision
150440
Author
[email protected]
Date
2013-05-21 06:37:17 -0700 (Tue, 21 May 2013)

Log Message

[GTK] Always use EGL to create the GL context when running on Wayland
https://bugs.webkit.org/show_bug.cgi?id=115721

Patch by Iago Toral Quiroga <[email protected]> on 2013-05-21
Reviewed by Martin Robinson.

* platform/graphics/cairo/GLContext.cpp:
(WebCore::GLContext::createContextForWindow):
(WebCore::GLContext::createOffscreenContext): Always use EGL to create the GL context
instead of GLX when running on Wayland and make createOffScreenContext reuse the code
in createContextWindow.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150439 => 150440)


--- trunk/Source/WebCore/ChangeLog	2013-05-21 13:16:24 UTC (rev 150439)
+++ trunk/Source/WebCore/ChangeLog	2013-05-21 13:37:17 UTC (rev 150440)
@@ -1,3 +1,16 @@
+2013-05-21  Iago Toral Quiroga  <[email protected]>
+
+        [GTK] Always use EGL to create the GL context when running on Wayland
+        https://bugs.webkit.org/show_bug.cgi?id=115721
+
+        Reviewed by Martin Robinson.
+
+        * platform/graphics/cairo/GLContext.cpp:
+        (WebCore::GLContext::createContextForWindow):
+        (WebCore::GLContext::createOffscreenContext): Always use EGL to create the GL context
+        instead of GLX when running on Wayland and make createOffScreenContext reuse the code
+        in createContextWindow.
+
 2013-05-21  Alberto Garcia  <[email protected]>
 
         Add FloatRect::normalized() for BlackBerry

Modified: trunk/Source/WebCore/platform/graphics/cairo/GLContext.cpp (150439 => 150440)


--- trunk/Source/WebCore/platform/graphics/cairo/GLContext.cpp	2013-05-21 13:16:24 UTC (rev 150439)
+++ trunk/Source/WebCore/platform/graphics/cairo/GLContext.cpp	2013-05-21 13:37:17 UTC (rev 150440)
@@ -29,6 +29,15 @@
 #include <X11/Xlib.h>
 #endif
 
+#if PLATFORM(GTK)
+#include <gdk/gdk.h>
+#ifndef GTK_API_VERSION_2
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+#endif
+#endif
+
 namespace WebCore {
 
 GLContext* GLContext::sharingContext()
@@ -113,6 +122,16 @@
 
 PassOwnPtr<GLContext> GLContext::createContextForWindow(uint64_t windowHandle, GLContext* sharingContext)
 {
+#if PLATFORM(GTK) && defined(GDK_WINDOWING_WAYLAND) && USE(EGL)
+    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
+
+    if (GDK_IS_WAYLAND_DISPLAY(display)) {
+        if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(windowHandle, sharingContext))
+            return eglContext.release();
+        return nullptr;
+    }
+#endif
+
 #if USE(GLX)
     if (OwnPtr<GLContext> glxContext = GLContextGLX::createContext(windowHandle, sharingContext))
         return glxContext.release();
@@ -131,15 +150,7 @@
 
 PassOwnPtr<GLContext> GLContext::createOffscreenContext(GLContext* sharingContext)
 {
-#if USE(GLX)
-    if (OwnPtr<GLContext> glxContext = GLContextGLX::createContext(0, sharingContext))
-        return glxContext.release();
-#endif
-#if USE(EGL)
-    if (OwnPtr<GLContext> eglContext = GLContextEGL::createContext(0, sharingContext))
-        return eglContext.release();
-#endif
-    return nullptr;
+    return createContextForWindow(0, sharingContext);
 }
 
 // FIXME: This should be a thread local eventually if we
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to