From 4d883d846111c86cd91db096b63ed832ff0b7762 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Wed, 25 Aug 2021 12:50:29 +0000 Subject: [PATCH] x11-wm/mutter: expose nested Wayland support PR: 258042 Approved by: ? --- x11-wm/mutter/Makefile | 13 +- x11-wm/mutter/files/patch-meson.build | 12 +- x11-wm/mutter/files/patch-no-abstract | 153 ++++++++++++++++++ .../files/patch-src_backends_meta-egl.c | 81 ---------- x11-wm/mutter/files/patch-src_meson.build | 16 ++ x11-wm/mutter/pkg-plist | 2 + 6 files changed, 192 insertions(+), 85 deletions(-) create mode 100644 x11-wm/mutter/files/patch-no-abstract delete mode 100644 x11-wm/mutter/files/patch-src_backends_meta-egl.c create mode 100644 x11-wm/mutter/files/patch-src_meson.build diff --git a/x11-wm/mutter/Makefile b/x11-wm/mutter/Makefile index 395ea872a071..e490a71acd32 100644 --- a/x11-wm/mutter/Makefile +++ b/x11-wm/mutter/Makefile @@ -2,7 +2,7 @@ PORTNAME= mutter PORTVERSION= 3.36.6 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11-wm MASTER_SITES= GNOME DIST_SUBDIR= gnome @@ -49,7 +49,6 @@ CFLAGS+= -Wno-unknown-warning-option \ -Wno-format-nonliteral CPPFLAGS+= -fno-omit-frame-pointer MESON_ARGS= -Dlibwacom=false \ - -Dwayland=false \ -Dudev=false \ -Dnative_backend=false \ -Dprofiler=false \ @@ -66,4 +65,14 @@ MESON_ARGS+= -Dremote_desktop=false GLIB_SCHEMAS= org.gnome.mutter.gschema.xml \ org.gnome.mutter.wayland.gschema.xml +OPTIONS_DEFINE= WAYLAND +OPTIONS_DEFAULT=WAYLAND +OPTIONS_SUB= yes + +WAYLAND_BUILD_DEPENDS= xwayland-devel>0:x11-servers/xwayland-devel +WAYLAND_LIB_DEPENDS= libwayland-server.so:graphics/wayland +WAYLAND_RUN_DEPENDS= xwayland-devel>0:x11-servers/xwayland-devel +WAYLAND_USE= XORG=xau +WAYLAND_MESON_TRUE= wayland + .include diff --git a/x11-wm/mutter/files/patch-meson.build b/x11-wm/mutter/files/patch-meson.build index aaca6af54b4b..53c227ea26f0 100644 --- a/x11-wm/mutter/files/patch-meson.build +++ b/x11-wm/mutter/files/patch-meson.build @@ -1,6 +1,14 @@ ---- meson.build.orig 2020-09-28 15:41:47 UTC +--- meson.build.orig 2020-09-07 19:18:23 UTC +++ meson.build -@@ -320,22 +320,6 @@ if buildtype != 'plain' +@@ -167,6 +167,7 @@ endif + + have_wayland = get_option('wayland') + if have_wayland ++ libdrm_dep = dependency('libdrm') + wayland_server_dep = dependency('wayland-server', version: wayland_server_req) + wayland_client_dep = dependency('wayland-client', version: wayland_server_req) + wayland_protocols_dep = dependency('wayland-protocols', +@@ -320,22 +321,6 @@ if buildtype != 'plain' '-Wmissing-include-dirs', '-Wlogical-op', '-Wignored-qualifiers', diff --git a/x11-wm/mutter/files/patch-no-abstract b/x11-wm/mutter/files/patch-no-abstract new file mode 100644 index 000000000000..cecbc7a3d3df --- /dev/null +++ b/x11-wm/mutter/files/patch-no-abstract @@ -0,0 +1,153 @@ +https://gitlab.gnome.org/GNOME/mutter/-/commit/e2123768f635 + +mutter-WARNING **: failed to bind to @/tmp/.X11-unix/X0: No such file or directory + +--- src/wayland/meta-wayland-private.h.orig 2020-09-07 19:18:23 UTC ++++ src/wayland/meta-wayland-private.h +@@ -46,7 +46,6 @@ typedef struct + { + int display_index; + char *lock_file; +- int abstract_fd; + int unix_fd; + char *name; + } MetaXWaylandConnection; +--- src/wayland/meta-xwayland.c.orig 2020-09-07 19:18:23 UTC ++++ src/wayland/meta-xwayland.c +@@ -236,46 +236,6 @@ create_lock_file (int display, int *display_out) + } + + static int +-bind_to_abstract_socket (int display, +- gboolean *fatal) +-{ +- struct sockaddr_un addr; +- socklen_t size, name_size; +- int fd; +- +- fd = socket (PF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); +- if (fd < 0) +- { +- *fatal = TRUE; +- g_warning ("Failed to create socket: %m"); +- return -1; +- } +- +- addr.sun_family = AF_LOCAL; +- name_size = snprintf (addr.sun_path, sizeof addr.sun_path, +- "%c/tmp/.X11-unix/X%d", 0, display); +- size = offsetof (struct sockaddr_un, sun_path) + name_size; +- if (bind (fd, (struct sockaddr *) &addr, size) < 0) +- { +- *fatal = errno != EADDRINUSE; +- g_warning ("failed to bind to @%s: %m", addr.sun_path + 1); +- close (fd); +- return -1; +- } +- +- if (listen (fd, 1) < 0) +- { +- *fatal = errno != EADDRINUSE; +- g_warning ("Failed to listen on abstract socket @%s: %m", +- addr.sun_path + 1); +- close (fd); +- return -1; +- } +- +- return fd; +-} +- +-static int + bind_to_unix_socket (int display) + { + struct sockaddr_un addr; +@@ -381,26 +341,18 @@ meta_xwayland_override_display_number (int number) + static gboolean + open_display_sockets (MetaXWaylandManager *manager, + int display_index, +- int *abstract_fd_out, + int *unix_fd_out, + gboolean *fatal) + { +- int abstract_fd, unix_fd; ++ int unix_fd; + +- abstract_fd = bind_to_abstract_socket (display_index, +- fatal); +- if (abstract_fd < 0) +- return FALSE; +- + unix_fd = bind_to_unix_socket (display_index); + if (unix_fd < 0) + { + *fatal = FALSE; +- close (abstract_fd); + return FALSE; + } + +- *abstract_fd_out = abstract_fd; + *unix_fd_out = unix_fd; + + return TRUE; +@@ -429,7 +381,6 @@ choose_xdisplay (MetaXWaylandManager *manager, + } + + if (!open_display_sockets (manager, display, +- &connection->abstract_fd, + &connection->unix_fd, + &fatal)) + { +@@ -617,10 +568,9 @@ meta_xwayland_start_xserver (MetaXWaylandManager *mana + launcher = g_subprocess_launcher_new (flags); + + g_subprocess_launcher_take_fd (launcher, xwayland_client_fd[1], 3); +- g_subprocess_launcher_take_fd (launcher, manager->public_connection.abstract_fd, 4); +- g_subprocess_launcher_take_fd (launcher, manager->public_connection.unix_fd, 5); +- g_subprocess_launcher_take_fd (launcher, displayfd[1], 6); +- g_subprocess_launcher_take_fd (launcher, manager->private_connection.abstract_fd, 7); ++ g_subprocess_launcher_take_fd (launcher, manager->public_connection.unix_fd, 4); ++ g_subprocess_launcher_take_fd (launcher, displayfd[1], 5); ++ g_subprocess_launcher_take_fd (launcher, manager->private_connection.unix_fd, 6); + + g_subprocess_launcher_setenv (launcher, "WAYLAND_SOCKET", "3", TRUE); + +@@ -633,12 +583,11 @@ meta_xwayland_start_xserver (MetaXWaylandManager *mana + "-core", + "-auth", manager->auth_file, + "-listen", "4", +- "-listen", "5", +- "-displayfd", "6", ++ "-displayfd", "5", + #ifdef HAVE_XWAYLAND_INITFD +- "-initfd", "7", ++ "-initfd", "6", + #else +- "-listen", "7", ++ "-listen", "6", + #endif + NULL); + +@@ -756,14 +705,12 @@ meta_xwayland_init (MetaXWaylandManager *manager, + { + if (!open_display_sockets (manager, + manager->public_connection.display_index, +- &manager->public_connection.abstract_fd, + &manager->public_connection.unix_fd, + &fatal)) + return FALSE; + + if (!open_display_sockets (manager, + manager->private_connection.display_index, +- &manager->private_connection.abstract_fd, + &manager->private_connection.unix_fd, + &fatal)) + return FALSE; +@@ -774,7 +721,7 @@ meta_xwayland_init (MetaXWaylandManager *manager, + + if (policy == META_DISPLAY_POLICY_ON_DEMAND) + { +- g_unix_fd_add (manager->public_connection.abstract_fd, G_IO_IN, ++ g_unix_fd_add (manager->public_connection.unix_fd, G_IO_IN, + xdisplay_connection_activity_cb, manager); + } + diff --git a/x11-wm/mutter/files/patch-src_backends_meta-egl.c b/x11-wm/mutter/files/patch-src_backends_meta-egl.c deleted file mode 100644 index 9a63abd4c487..000000000000 --- a/x11-wm/mutter/files/patch-src_backends_meta-egl.c +++ /dev/null @@ -1,81 +0,0 @@ -$OpenBSD: patch-src_backends_meta-egl_c,v 1.2 2018/04/26 09:19:27 jasper Exp $ - -Revert non-portable portion of: -From b7b5fb293d1de3af9e533f2063749fde7a790945 Mon Sep 17 00:00:00 2001 -From: Daniel Stone -Date: Tue, 11 Jul 2017 16:03:26 +0100 -Subject: [PATCH] wayland: Add zwp_linux_dmabuf_v1 support - -Index: src/backends/meta-egl.c ---- src/backends/meta-egl.c.orig 2020-09-07 19:18:23 UTC -+++ src/backends/meta-egl.c -@@ -69,8 +69,6 @@ struct _MetaEgl - PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquireKHR; - PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC eglStreamConsumerAcquireAttribNV; - -- PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT; -- PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT; - }; - - G_DEFINE_TYPE (MetaEgl, meta_egl, G_TYPE_OBJECT) -@@ -1019,51 +1017,6 @@ meta_egl_stream_consumer_acquire (MetaEgl *egl, - return TRUE; - } - --gboolean --meta_egl_query_dma_buf_formats (MetaEgl *egl, -- EGLDisplay display, -- EGLint max_formats, -- EGLint *formats, -- EGLint *num_formats, -- GError **error) --{ -- if (!is_egl_proc_valid (egl->eglQueryDmaBufFormatsEXT, error)) -- return FALSE; -- -- if (!egl->eglQueryDmaBufFormatsEXT (display, max_formats, formats, -- num_formats)) -- { -- set_egl_error (error); -- return FALSE; -- } -- -- return TRUE; --} -- --gboolean --meta_egl_query_dma_buf_modifiers (MetaEgl *egl, -- EGLDisplay display, -- EGLint format, -- EGLint max_modifiers, -- EGLuint64KHR *modifiers, -- EGLBoolean *external_only, -- EGLint *num_modifiers, -- GError **error) --{ -- if (!is_egl_proc_valid (egl->eglQueryDmaBufModifiersEXT, error)) -- return FALSE; -- -- if (!egl->eglQueryDmaBufModifiersEXT (display, format, max_modifiers, -- modifiers, external_only, -- num_modifiers)) -- { -- set_egl_error (error); -- return FALSE; -- } -- -- return TRUE; --} -- - #define GET_EGL_PROC_ADDR(proc) \ - egl->proc = (void *) eglGetProcAddress (#proc); - -@@ -1100,8 +1053,6 @@ meta_egl_constructed (GObject *object) - GET_EGL_PROC_ADDR (eglStreamConsumerAcquireKHR); - GET_EGL_PROC_ADDR (eglStreamConsumerAcquireAttribNV); - -- GET_EGL_PROC_ADDR (eglQueryDmaBufFormatsEXT); -- GET_EGL_PROC_ADDR (eglQueryDmaBufModifiersEXT); - } - - #undef GET_EGL_PROC_ADDR diff --git a/x11-wm/mutter/files/patch-src_meson.build b/x11-wm/mutter/files/patch-src_meson.build new file mode 100644 index 000000000000..7a4a85024ee7 --- /dev/null +++ b/x11-wm/mutter/files/patch-src_meson.build @@ -0,0 +1,16 @@ +../src/wayland/meta-wayland-buffer.c:53:10: fatal error: 'drm_fourcc.h' file not found +#include + ^~~~~~~~~~~~~~ + +--- src/meson.build.orig 2020-09-07 19:18:23 UTC ++++ src/meson.build +@@ -113,6 +113,9 @@ if have_x11 + endif + + if have_wayland ++ mutter_lib_deps += [ ++ libdrm_dep, # drm_fourcc.h on non-Linux ++ ] + mutter_pkg_deps += [ + wayland_server_dep, + ] diff --git a/x11-wm/mutter/pkg-plist b/x11-wm/mutter/pkg-plist index 091b6b195893..b4fe30cf28aa 100644 --- a/x11-wm/mutter/pkg-plist +++ b/x11-wm/mutter/pkg-plist @@ -164,6 +164,7 @@ include/mutter-6/cogl/cogl/cogl-texture.h include/mutter-6/cogl/cogl/cogl-trace.h include/mutter-6/cogl/cogl/cogl-types.h include/mutter-6/cogl/cogl/cogl-version.h +%%WAYLAND%%include/mutter-6/cogl/cogl/cogl-wayland-server.h include/mutter-6/cogl/cogl/cogl-xlib-renderer.h include/mutter-6/cogl/cogl/cogl-xlib.h include/mutter-6/cogl/cogl/cogl.h @@ -264,6 +265,7 @@ share/GConf/gsettings/mutter-schemas.convert share/applications/mutter.desktop share/gnome-control-center/keybindings/50-mutter-navigation.xml share/gnome-control-center/keybindings/50-mutter-system.xml +%%WAYLAND%%share/gnome-control-center/keybindings/50-mutter-wayland.xml share/gnome-control-center/keybindings/50-mutter-windows.xml share/locale/am/LC_MESSAGES/mutter.mo share/locale/ar/LC_MESSAGES/mutter.mo