Bug 243677

Summary: www/webkit2-gtk3: make WPE renderer optional (disabled by default, as it's unreliable)
Product: Ports & Packages Reporter: Christoph Moench-Tegeder <cmt>
Component: Individual Port(s)Assignee: freebsd-gnome (Nobody) <gnome>
Status: Closed FIXED    
Severity: Affects Only Me CC: kwm, val
Priority: --- Keywords: easy, patch, patch-ready
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=243680
Attachments:
Description Flags
disable WPE renderer, unbreaks liferea cmt: maintainer-approval-

Description Christoph Moench-Tegeder freebsd_committer freebsd_triage 2020-01-28 18:53:14 UTC
Created attachment 211139 [details]
disable WPE renderer, unbreaks liferea

since updating webkit2-gtk3 to 2.26.x (ports r516196) build of net/liferea fails during dumping of the introspection data (see BROKEN message in ports r516629).

Testing shows that this problem only exists if webkit has option WAYLAND enabled (unfortunately, that's the default).
Further digging revealed that that ABORT is raised in Source/WebKit/UIProcess/gtk/AcceleratedBackingStore.cpp AcceleratedBackingStore::checkRequirements() when the "display" is neither a "WAYLAND" or "X11" display. In fact, since (I think) https://bugs.webkit.org/show_bug.cgi?id=184406 creates "WPE" displays as the fallback (if WPE support has been enabled) when no regular X11 display (via GDK or similar) is available. That's exactly the situation with liferea: during build in poudriere, there's no $DISPLAY and no way to initialize a "real" display. That "WPE" fallback display later turns up in AcceleratedBackingStore::checkRequirements() where it is not handled and causes a fallthrough to the Abort. If WPE support hadn't been disabled, webkit would create a X11 "dummy" display as before - and that would cause no problems, if we got there.

Experimentation (filling in a few gaps in the code starting in AcceleratedBackingStore::checkRequirements()) is a trip down the rabbit hole (there're multiple missing pieces, I think), and the best I got was segfaults from some destructor.

As an alternative, I found cmake switch "USE_WPE_RENDERER" (default on) - when turned of, we get rid of the problematic code paths through WPE and liferea can build again just fine and it's BROKEN flag could be reset. (I'm not sure what use case WPE has in webkit-gtk on FreeBSD - surely we can use the GDK/GTK paths, as that's literally in the package name?)
Comment 1 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2020-01-29 21:42:04 UTC
Comment on attachment 211139 [details]
disable WPE renderer, unbreaks liferea

patch is obsolete
Comment 2 Christoph Moench-Tegeder freebsd_committer freebsd_triage 2020-01-29 21:43:25 UTC
jbeich@ confirmed that the WPE renderer is unreliable under wayland and has an elegant patch to make it optional:
https://docs.freebsd.org/cgi/getmsg.cgi?fetch=2838901+0+current/svn-ports-all

Let's track that.
Comment 3 Val Packett 2020-01-29 22:10:52 UTC
> I'm not sure what use case WPE has in webkit-gtk on FreeBSD

It's a better rendering backend on wayland, webkitgtk was doing very awkward things (being a compositor for the web processes) without it.
I'd rather not disable it.

> the WPE renderer is unreliable under wayland

I figured it out, reported to upstream: https://github.com/Igalia/WPEBackend-fdo/issues/94 We'll have a solution soon.

// for the liferea build, I'm glad this was fixed by bug 243680
Comment 4 Val Packett 2020-01-29 22:33:33 UTC
My patch for fixing the renderer — still waiting for upstream reaction, but this makes everything work for me. (the eglmesaext is just for building with mesa-dev, this has already been done upstream, the real part is the zero)

diff --git c/www/wpebackend-fdo/files/patch-src_ws.cpp i/www/wpebackend-fdo/files/patch-src_ws.cpp
new file mode 100644
index 000000000000..26125a314f4c
--- /dev/null
+++ i/www/wpebackend-fdo/files/patch-src_ws.cpp
@@ -0,0 +1,19 @@
+--- src/ws.cpp.orig	2020-01-29 22:15:53 UTC
++++ src/ws.cpp
+@@ -27,6 +27,7 @@
+ 
+ #include <EGL/egl.h>
+ #include <EGL/eglext.h>
++#include <EGL/eglmesaext.h>
+ #include "linux-dmabuf/linux-dmabuf.h"
+ #include "bridge/wpe-bridge-server-protocol.h"
+ #include <cassert>
+@@ -111,7 +112,7 @@ GSourceFuncs ServerSource::s_sourceFuncs = {
+ 
+         if (source.pfd.revents & G_IO_IN) {
+             struct wl_event_loop* eventLoop = wl_display_get_event_loop(source.display);
+-            wl_event_loop_dispatch(eventLoop, -1);
++            wl_event_loop_dispatch(eventLoop, 0);
+             wl_display_flush_clients(source.display);
+         }
+
Comment 5 commit-hook freebsd_committer freebsd_triage 2020-02-25 22:41:56 UTC
A commit references this bug:

Author: kwm
Date: Tue Feb 25 22:41:00 UTC 2020
New revision: 527142
URL: https://svnweb.freebsd.org/changeset/ports/527142

Log:
  Update wpebackend-fdo to 1.4.1.

  Add patch to fix the wayland renderer.

  PR:		243677
  Submitted by:	Greg V <greg AT unrelenting dot technology>

Changes:
  head/www/wpebackend-fdo/Makefile
  head/www/wpebackend-fdo/distinfo
  head/www/wpebackend-fdo/files/
  head/www/wpebackend-fdo/files/patch-src_ws.cpp
  head/www/wpebackend-fdo/pkg-plist