Title: [251122] trunk/Source
Revision
251122
Author
carlo...@webkit.org
Date
2019-10-14 22:30:13 -0700 (Mon, 14 Oct 2019)

Log Message

[GTK] White pages in AC mode: Cannot get default EGL display: EGL_BAD_PARAMETER
https://bugs.webkit.org/show_bug.cgi?id=202362

Reviewed by Carlos Alberto Lopez Perez.

Source/WebCore:

The problem is that PlatformDisplayLibWPE::initialize() is failing to initialize the EGL display for some
reason. We need to understand why, but we should also handle the case of failing to initialize the EGL display
and simply disable accelerated compositing mode to avoid white pages and crashes in websites using WebGL. This
patch doesn't actually fix the bug, it just handles the EGL display initialization failure.

* platform/graphics/PlatformDisplay.cpp:
(WebCore::PlatformDisplay::~PlatformDisplay): Set s_sharedDisplayForCompositing to nullptr when the shared
display for compositing is destroyed.
* platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
(WebCore::PlatformDisplayLibWPE::initialize): Return false when EGL display initialization fails.
* platform/graphics/libwpe/PlatformDisplayLibWPE.h:

Source/WebKit:

* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::updatePreferences): Disable accelerated compositing mode when we failed
to reate the shared display for compositing.
* WebProcess/glib/WebProcessGLib.cpp:
(WebKit::WebProcess::platformInitializeWebProcess): Destroy the wpe display when initialization fails.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (251121 => 251122)


--- trunk/Source/WebCore/ChangeLog	2019-10-15 05:28:55 UTC (rev 251121)
+++ trunk/Source/WebCore/ChangeLog	2019-10-15 05:30:13 UTC (rev 251122)
@@ -1,3 +1,22 @@
+2019-10-14  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] White pages in AC mode: Cannot get default EGL display: EGL_BAD_PARAMETER
+        https://bugs.webkit.org/show_bug.cgi?id=202362
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        The problem is that PlatformDisplayLibWPE::initialize() is failing to initialize the EGL display for some
+        reason. We need to understand why, but we should also handle the case of failing to initialize the EGL display
+        and simply disable accelerated compositing mode to avoid white pages and crashes in websites using WebGL. This
+        patch doesn't actually fix the bug, it just handles the EGL display initialization failure.
+
+        * platform/graphics/PlatformDisplay.cpp:
+        (WebCore::PlatformDisplay::~PlatformDisplay): Set s_sharedDisplayForCompositing to nullptr when the shared
+        display for compositing is destroyed.
+        * platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
+        (WebCore::PlatformDisplayLibWPE::initialize): Return false when EGL display initialization fails.
+        * platform/graphics/libwpe/PlatformDisplayLibWPE.h:
+
 2019-10-14  Chris Dumez  <cdu...@apple.com>
 
         [WK2] Have WebBackForwardCache class coordinate page caching in all WebProcesses

Modified: trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp (251121 => 251122)


--- trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2019-10-15 05:28:55 UTC (rev 251121)
+++ trunk/Source/WebCore/platform/graphics/PlatformDisplay.cpp	2019-10-15 05:30:13 UTC (rev 251122)
@@ -150,6 +150,8 @@
 #if USE(EGL)
     ASSERT(m_eglDisplay == EGL_NO_DISPLAY);
 #endif
+    if (s_sharedDisplayForCompositing == this)
+        s_sharedDisplayForCompositing = nullptr;
 }
 
 #if USE(EGL) || USE(GLX)

Modified: trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp (251121 => 251122)


--- trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp	2019-10-15 05:28:55 UTC (rev 251121)
+++ trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.cpp	2019-10-15 05:30:13 UTC (rev 251122)
@@ -66,7 +66,7 @@
     wpe_renderer_backend_egl_destroy(m_backend);
 }
 
-void PlatformDisplayLibWPE::initialize(int hostFd)
+bool PlatformDisplayLibWPE::initialize(int hostFd)
 {
     m_backend = wpe_renderer_backend_egl_create(hostFd);
 
@@ -73,10 +73,11 @@
     m_eglDisplay = eglGetDisplay(wpe_renderer_backend_egl_get_native_display(m_backend));
     if (m_eglDisplay == EGL_NO_DISPLAY) {
         WTFLogAlways("PlatformDisplayLibWPE: could not create the EGL display: %s.", GLContextEGL::lastErrorString());
-        return;
+        return false;
     }
 
     PlatformDisplay::initializeEGLDisplay();
+    return m_eglDisplay != EGL_NO_DISPLAY;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.h (251121 => 251122)


--- trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.h	2019-10-15 05:28:55 UTC (rev 251121)
+++ trunk/Source/WebCore/platform/graphics/libwpe/PlatformDisplayLibWPE.h	2019-10-15 05:30:13 UTC (rev 251122)
@@ -39,7 +39,7 @@
 
     virtual ~PlatformDisplayLibWPE();
 
-    void initialize(int);
+    bool initialize(int);
 
     struct wpe_renderer_backend_egl* backend() const { return m_backend; }
 

Modified: trunk/Source/WebKit/ChangeLog (251121 => 251122)


--- trunk/Source/WebKit/ChangeLog	2019-10-15 05:28:55 UTC (rev 251121)
+++ trunk/Source/WebKit/ChangeLog	2019-10-15 05:30:13 UTC (rev 251122)
@@ -1,3 +1,16 @@
+2019-10-14  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] White pages in AC mode: Cannot get default EGL display: EGL_BAD_PARAMETER
+        https://bugs.webkit.org/show_bug.cgi?id=202362
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
+        (WebKit::DrawingAreaCoordinatedGraphics::updatePreferences): Disable accelerated compositing mode when we failed
+        to reate the shared display for compositing.
+        * WebProcess/glib/WebProcessGLib.cpp:
+        (WebKit::WebProcess::platformInitializeWebProcess): Destroy the wpe display when initialization fails.
+
 2019-10-14  Chris Dumez  <cdu...@apple.com>
 
         [WK2] Have WebBackForwardCache class coordinate page caching in all WebProcesses

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp (251121 => 251122)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp	2019-10-15 05:28:55 UTC (rev 251121)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp	2019-10-15 05:30:13 UTC (rev 251122)
@@ -235,6 +235,13 @@
 void DrawingAreaCoordinatedGraphics::updatePreferences(const WebPreferencesStore& store)
 {
     Settings& settings = m_webPage.corePage()->settings();
+#if PLATFORM(WAYLAND) && USE(WPE_RENDERER)
+    if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland
+        && &PlatformDisplay::sharedDisplayForCompositing() == &PlatformDisplay::sharedDisplay()) {
+        // We failed to create the shared display for compositing, disable accelerated compositing.
+        settings.setAcceleratedCompositingEnabled(false);
+    }
+#endif
     settings.setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()));
     // Fixed position elements need to be composited and create stacking contexts
     // in order to be scrolled by the ScrollingCoordinator.

Modified: trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp (251121 => 251122)


--- trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2019-10-15 05:28:55 UTC (rev 251121)
+++ trunk/Source/WebKit/WebProcess/glib/WebProcessGLib.cpp	2019-10-15 05:30:13 UTC (rev 251122)
@@ -74,7 +74,8 @@
             if (hostClientFileDescriptor != -1) {
                 wpe_loader_init(parameters.implementationLibraryName.data());
                 m_wpeDisplay = WebCore::PlatformDisplayLibWPE::create();
-                m_wpeDisplay->initialize(hostClientFileDescriptor);
+                if (!m_wpeDisplay->initialize(hostClientFileDescriptor))
+                    m_wpeDisplay = nullptr;
             }
         }
 #else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to