Title: [207978] releases/WebKitGTK/webkit-2.14/Source/WebCore
Revision
207978
Author
[email protected]
Date
2016-10-27 03:16:53 -0700 (Thu, 27 Oct 2016)

Log Message

Merge r207616 - Prefer eglGetPlatformDisplay to eglGetDisplay
https://bugs.webkit.org/show_bug.cgi?id=163333

Patch by Adam Jackson <[email protected]> on 2016-10-20
Reviewed by Carlos Garcia Campos.

eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations
do different things, in particular glvnd and Mesa behave differently. Fortunately there exists API to tell EGL
what kind of display it is, so let's use it.

* platform/graphics/wayland/PlatformDisplayWayland.cpp:
(WebCore::PlatformDisplayWayland::initialize):
* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::initializeEGLDisplay):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (207977 => 207978)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-10-27 10:15:59 UTC (rev 207977)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-10-27 10:16:53 UTC (rev 207978)
@@ -1,3 +1,19 @@
+2016-10-20  Adam Jackson  <[email protected]>
+
+        Prefer eglGetPlatformDisplay to eglGetDisplay
+        https://bugs.webkit.org/show_bug.cgi?id=163333
+
+        Reviewed by Carlos Garcia Campos.
+
+        eglGetDisplay forces the implementation to guess what kind of void* it's been handed. Different implementations
+        do different things, in particular glvnd and Mesa behave differently. Fortunately there exists API to tell EGL
+        what kind of display it is, so let's use it.
+
+        * platform/graphics/wayland/PlatformDisplayWayland.cpp:
+        (WebCore::PlatformDisplayWayland::initialize):
+        * platform/graphics/x11/PlatformDisplayX11.cpp:
+        (WebCore::PlatformDisplayX11::initializeEGLDisplay):
+
 2016-10-20  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Avoid including egl.h headers in internal headers

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp (207977 => 207978)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp	2016-10-27 10:15:59 UTC (rev 207977)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/wayland/PlatformDisplayWayland.cpp	2016-10-27 10:16:53 UTC (rev 207978)
@@ -34,6 +34,7 @@
 // and egl.h checks that to decide whether it's Wayland platform.
 #include <wayland-egl.h>
 #include <EGL/egl.h>
+#include <EGL/eglext.h>
 #include <wtf/Assertions.h>
 
 namespace WebCore {
@@ -65,7 +66,16 @@
     wl_registry_add_listener(m_registry.get(), &s_registryListener, this);
     wl_display_roundtrip(m_display);
 
-    m_eglDisplay = eglGetDisplay(m_display);
+    const char* extensions = eglQueryString(nullptr, EGL_EXTENSIONS);
+    if (GLContext::isExtensionSupported(extensions, "EGL_KHR_platform_base")) {
+        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplay")))
+            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, m_display, nullptr);
+    } else if (GLContext::isExtensionSupported(extensions, "EGL_EXT_platform_base")) {
+        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT")))
+            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, m_display, nullptr);
+    } else
+        m_eglDisplay = eglGetDisplay(m_display);
+
     PlatformDisplay::initializeEGLDisplay();
 }
 

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp (207977 => 207978)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2016-10-27 10:15:59 UTC (rev 207977)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2016-10-27 10:16:53 UTC (rev 207978)
@@ -37,6 +37,7 @@
 
 #if USE(EGL)
 #include <EGL/egl.h>
+#include <EGL/eglext.h>
 #endif
 
 namespace WebCore {
@@ -64,7 +65,16 @@
 #if USE(EGL)
 void PlatformDisplayX11::initializeEGLDisplay()
 {
-    m_eglDisplay = eglGetDisplay(m_display);
+    const char* extensions = eglQueryString(nullptr, EGL_EXTENSIONS);
+    if (GLContext::isExtensionSupported(extensions, "EGL_KHR_platform_base")) {
+        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplay")))
+            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_X11_KHR, m_display, nullptr);
+    } else if (GLContext::isExtensionSupported(extensions, "EGL_EXT_platform_base")) {
+        if (auto* getPlatformDisplay = reinterpret_cast<PFNEGLGETPLATFORMDISPLAYEXTPROC>(eglGetProcAddress("eglGetPlatformDisplayEXT")))
+            m_eglDisplay = getPlatformDisplay(EGL_PLATFORM_X11_KHR, m_display, nullptr);
+    } else
+        m_eglDisplay = eglGetDisplay(m_display);
+
     PlatformDisplay::initializeEGLDisplay();
 }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to