Title: [275041] releases/WebKitGTK/webkit-2.32/Source
Revision
275041
Author
[email protected]
Date
2021-03-25 10:06:19 -0700 (Thu, 25 Mar 2021)

Log Message

Merge r274354 - [GTK] GTK4 crashes with XVFB: GLXBadWindow
https://bugs.webkit.org/show_bug.cgi?id=223108

Reviewed by Žan Doberšek.

Source/WebCore:

* platform/graphics/x11/PlatformDisplayX11.cpp:
(WebCore::PlatformDisplayX11::supportsGLX const): Check if GLX extension is supported and return the base error code.
* platform/graphics/x11/PlatformDisplayX11.h:

Source/WebKit:

Handle GLXBadWindow errors in AcceleratedBackingStoreX11.

* UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
(WebKit::AcceleratedBackingStoreX11::checkRequirements):
(WebKit::glxErrorCode):
(WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11):
(WebKit::AcceleratedBackingStoreX11::update):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog (275040 => 275041)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-03-25 17:06:13 UTC (rev 275040)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog	2021-03-25 17:06:19 UTC (rev 275041)
@@ -1,3 +1,14 @@
+2021-03-12  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] GTK4 crashes with XVFB: GLXBadWindow
+        https://bugs.webkit.org/show_bug.cgi?id=223108
+
+        Reviewed by Žan Doberšek.
+
+        * platform/graphics/x11/PlatformDisplayX11.cpp:
+        (WebCore::PlatformDisplayX11::supportsGLX const): Check if GLX extension is supported and return the base error code.
+        * platform/graphics/x11/PlatformDisplayX11.h:
+
 2021-03-24  Zan Dobersek  <[email protected]>
 
         [GStreamer] Use imxvideoconvert_g2d element inside the sink when available

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp (275040 => 275041)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2021-03-25 17:06:13 UTC (rev 275040)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp	2021-03-25 17:06:19 UTC (rev 275041)
@@ -41,6 +41,10 @@
 #include <EGL/eglext.h>
 #endif
 
+#if USE(GLX)
+#include <GL/glx.h>
+#endif
+
 namespace WebCore {
 
 std::unique_ptr<PlatformDisplay> PlatformDisplayX11::create()
@@ -125,6 +129,26 @@
     return m_supportsXDamage.value();
 }
 
+bool PlatformDisplayX11::supportsGLX(Optional<int>& glxErrorBase) const
+{
+#if USE(GLX)
+    if (!m_supportsGLX) {
+        m_supportsGLX = false;
+        if (m_display) {
+            int eventBase, errorBase;
+            m_supportsGLX = glXQueryExtension(m_display, &errorBase, &eventBase);
+            if (m_supportsGLX.value())
+                m_glxErrorBase = errorBase;
+        }
+    }
+
+    glxErrorBase = m_glxErrorBase;
+    return m_supportsGLX.value();
+#else
+    return false;
+#endif
+}
+
 void* PlatformDisplayX11::visual() const
 {
     if (m_visual)

Modified: releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h (275040 => 275041)


--- releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h	2021-03-25 17:06:13 UTC (rev 275040)
+++ releases/WebKitGTK/webkit-2.32/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.h	2021-03-25 17:06:19 UTC (rev 275041)
@@ -49,6 +49,7 @@
     void* visual() const;
     bool supportsXComposite() const;
     bool supportsXDamage(Optional<int>& damageEventBase, Optional<int>& damageErrorBase) const;
+    bool supportsGLX(Optional<int>& glxErrorBase) const;
 
 private:
     PlatformDisplayX11(::Display*, NativeDisplayOwned);
@@ -64,6 +65,10 @@
     mutable Optional<bool> m_supportsXDamage;
     mutable Optional<int> m_damageEventBase;
     mutable Optional<int> m_damageErrorBase;
+#if USE(GLX)
+    mutable Optional<bool> m_supportsGLX;
+    mutable Optional<int> m_glxErrorBase;
+#endif
     mutable void* m_visual { nullptr };
 };
 

Modified: releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog (275040 => 275041)


--- releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog	2021-03-25 17:06:13 UTC (rev 275040)
+++ releases/WebKitGTK/webkit-2.32/Source/WebKit/ChangeLog	2021-03-25 17:06:19 UTC (rev 275041)
@@ -1,3 +1,18 @@
+2021-03-12  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] GTK4 crashes with XVFB: GLXBadWindow
+        https://bugs.webkit.org/show_bug.cgi?id=223108
+
+        Reviewed by Žan Doberšek.
+
+        Handle GLXBadWindow errors in AcceleratedBackingStoreX11.
+
+        * UIProcess/gtk/AcceleratedBackingStoreX11.cpp:
+        (WebKit::AcceleratedBackingStoreX11::checkRequirements):
+        (WebKit::glxErrorCode):
+        (WebKit::AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11):
+        (WebKit::AcceleratedBackingStoreX11::update):
+
 2021-03-24  Pablo Saavedra  <[email protected]>
 
         [WPE] Build error in ARMv7 invalid 'static_cast' for GLNativeWindowType

Modified: releases/WebKitGTK/webkit-2.32/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp (275040 => 275041)


--- releases/WebKitGTK/webkit-2.32/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp	2021-03-25 17:06:13 UTC (rev 275040)
+++ releases/WebKitGTK/webkit-2.32/Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreX11.cpp	2021-03-25 17:06:19 UTC (rev 275041)
@@ -46,10 +46,18 @@
 #include <wtf/HashMap.h>
 #include <wtf/NeverDestroyed.h>
 
+#if USE(GLX)
+#include <X11/Xproto.h>
+#include <GL/glxproto.h>
+#endif
+
 namespace WebKit {
 
 static Optional<int> s_damageEventBase;
 static Optional<int> s_damageErrorBase;
+#if USE(GLX)
+static Optional<int> s_glxErrorBase;
+#endif
 
 class XDamageNotifier {
     WTF_MAKE_NONCOPYABLE(XDamageNotifier);
@@ -135,6 +143,10 @@
 bool AcceleratedBackingStoreX11::checkRequirements()
 {
     auto& display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay());
+#if USE(GLX)
+    // GLX is optional, he we just want the error base.
+    display.supportsGLX(s_glxErrorBase);
+#endif
     return display.supportsXComposite() && display.supportsXDamage(s_damageEventBase, s_damageErrorBase);
 }
 
@@ -155,6 +167,14 @@
     return static_cast<unsigned>(s_damageErrorBase.value()) + errorCode;
 }
 
+#if USE(GLX)
+static inline unsigned char glxErrorCode(unsigned char errorCode)
+{
+    ASSERT(s_glxErrorBase);
+    return static_cast<unsigned>(s_glxErrorBase.value()) + errorCode;
+}
+#endif
+
 AcceleratedBackingStoreX11::~AcceleratedBackingStoreX11()
 {
     if (!m_surface && !m_damage)
@@ -161,7 +181,12 @@
         return;
 
     Display* display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native();
-    WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
+    Vector<unsigned char> errorList = { BadDrawable, xDamageErrorCode(BadDamage) };
+#if USE(GLX)
+    if (s_glxErrorBase)
+        errorList.append(glxErrorCode(GLXBadWindow));
+#endif
+    WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, WTFMove(errorList));
     if (m_damage) {
         XDamageNotifier::singleton().remove(m_damage.get());
         m_damage.reset();
@@ -178,7 +203,12 @@
     Display* display = downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native();
 
     if (m_surface) {
-        WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
+        Vector<unsigned char> errorList = { BadDrawable, xDamageErrorCode(BadDamage) };
+#if USE(GLX)
+        if (s_glxErrorBase)
+            errorList.append(glxErrorCode(GLXBadWindow));
+#endif
+        WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, WTFMove(errorList));
         if (m_damage) {
             XDamageNotifier::singleton().remove(m_damage.get());
             m_damage.reset();
@@ -198,7 +228,12 @@
     float deviceScaleFactor = m_webPage.deviceScaleFactor();
     size.scale(deviceScaleFactor);
 
-    WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, { BadDrawable, xDamageErrorCode(BadDamage) });
+    Vector<unsigned char> errorList = { BadDrawable, xDamageErrorCode(BadDamage) };
+#if USE(GLX)
+    if (s_glxErrorBase)
+        errorList.append(glxErrorCode(GLXBadWindow));
+#endif
+    WebCore::XErrorTrapper trapper(display, WebCore::XErrorTrapper::Policy::Crash, WTFMove(errorList));
     ASSERT(downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()).native() == gdk_x11_display_get_xdisplay(gdk_display_get_default()));
 #if USE(GTK4)
     auto* visual = WK_XVISUAL(downcast<WebCore::PlatformDisplayX11>(WebCore::PlatformDisplay::sharedDisplay()));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to