From 6a2a926ad5d053759677a67a6851b5c49a099fbe Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 18 Jul 2019 17:29:28 +0300 Subject: [PATCH] xwayland: add support for xdg-output-unstable-v1 version 3 This adds support for xdg-output-unstable-v1 version 3, added in [1]. This new version deprecates zxdg_output_v1.done and replaces it with wl_output.done. If the version is high enough, there's no need to wait for both an xdg_output.done event and a wl_output.done event -- we only care about wl_output.done. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/commit/962dd535372c8e4681374c23d2603cbe06cd7031 Signed-off-by: Simon Ser --- configure.ac | 30 +++++++++++++++--------------- hw/xwayland/xwayland-output.c | 22 +++++++++++++++++++--- hw/xwayland/xwayland.c | 4 +++- meson.build | 2 +- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 8b1d3982e..393114f1f 100644 --- a/configure.ac +++ b/configure.ac @@ -94,7 +94,7 @@ if test "x$GCC" = xyes ; then fi dnl Check for dtrace program (needed to build Xserver dtrace probes) -dnl Also checks for , since some Linux distros have an +dnl Also checks for , since some Linux distros have an dnl ISDN trace program named dtrace AC_ARG_WITH(dtrace, AS_HELP_STRING([--with-dtrace=PATH], [Enable dtrace probes (default: enabled if dtrace found)]), @@ -114,7 +114,7 @@ if test "x$WDTRACE" = "xyes" -o "x$WDTRACE" = "xauto" ; then fi fi if test "x$WDTRACE" != "xno" ; then - AC_DEFINE(XSERVER_DTRACE, 1, + AC_DEFINE(XSERVER_DTRACE, 1, [Define to 1 if the DTrace Xserver provider probes should be built in.]) # Solaris/OpenSolaris require dtrace -G to build dtrace probe information into @@ -221,7 +221,7 @@ AC_CACHE_CHECK([for SYSV IPC], #include #include ]],[[ -{ +{ int id; id = shmget(IPC_PRIVATE, 512, S_IRUSR | S_IWUSR); if (id < 0) return -1; @@ -233,12 +233,12 @@ if test "x$ac_cv_sysv_ipc" = xyes; then AC_DEFINE(HAVE_SYSV_IPC, 1, [Define to 1 if SYSV IPC is available]) fi -dnl OpenBSD /dev/xf86 aperture driver +dnl OpenBSD /dev/xf86 aperture driver if test -c /dev/xf86 ; then AC_DEFINE(HAS_APERTURE_DRV, 1, [System has /dev/xf86 aperture driver]) fi -dnl BSD APM support +dnl BSD APM support AC_CHECK_HEADER([machine/apmvar.h],[ AC_CHECK_HEADER([sys/event.h], ac_cv_BSD_KQUEUE_APM=yes, @@ -246,7 +246,7 @@ AC_CHECK_HEADER([machine/apmvar.h],[ AM_CONDITIONAL(BSD_APM, [test "x$ac_cv_BSD_APM" = xyes]) AM_CONDITIONAL(BSD_KQUEUE_APM, [test "x$ac_cv_BSD_KQUEUE_APM" = xyes]) - + dnl glibc backtrace support check AC_CHECK_HEADER([execinfo.h],[ AC_CHECK_LIB(c, backtrace, [ @@ -284,7 +284,7 @@ case $host_cpu in *netbsd*) AC_DEFINE(USE_I386_IOPL) SYS_LIBS=-li386 ;; - *openbsd*) AC_DEFINE(USE_I386_IOPL) + *openbsd*) AC_DEFINE(USE_I386_IOPL) SYS_LIBS=-li386 ;; esac @@ -603,7 +603,7 @@ AC_ARG_ENABLE(xshmfence, AS_HELP_STRING([--disable-xshmfence], [Disable xsh dnl chown/chmod to be setuid root as part of build dnl Replaces InstallXserverSetUID in imake -AC_ARG_ENABLE(install-setuid, +AC_ARG_ENABLE(install-setuid, AS_HELP_STRING([--enable-install-setuid], [Install Xorg server as owned by root with setuid bit (default: auto)]), [SETUID=$enableval], [SETUID=auto]) @@ -685,7 +685,7 @@ case $host_os in [xorg_cv_Carbon_framework=yes], [xorg_cv_Carbon_framework=no]) LDFLAGS=$save_LDFLAGS]) - + if test "X$xorg_cv_Carbon_framework" = Xyes; then XQUARTZ=yes else @@ -1898,9 +1898,9 @@ if test "x$XORG" = xyes; then AC_MSG_ERROR([This release no longer supports Solaris versions older than Solaris 8.]) fi AC_CHECK_DECL([_LP64], [SOLARIS_64="yes"], [SOLARIS_64="no"]) - + case $host_cpu in - sparc*) + sparc*) SOLARIS_INOUT_ARCH="sparcv8plus" ;; i*86|x86_64*) @@ -2266,13 +2266,13 @@ if test "$KDRIVE" = yes; then # Xephyr needs nanosleep() which is in librt on Solaris AC_CHECK_FUNC([nanosleep], [], AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt")) - + # damage shadow extension glx (NOTYET) fb mi KDRIVE_INC='-I$(top_srcdir)/hw/kdrive/src' KDRIVE_PURE_INCS="$KDRIVE_INC $MIEXT_SYNC_INC $MIEXT_DAMAGE_INC $MIEXT_SHADOW_INC $XEXT_INC $FB_INC $MI_INC" KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux' KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC" - + KDRIVE_CFLAGS="$XSERVER_CFLAGS" KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB" @@ -2297,7 +2297,7 @@ AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes]) dnl Xwayland DDX -XWAYLANDMODULES="wayland-client >= 1.3.0 wayland-protocols >= 1.10" +XWAYLANDMODULES="wayland-client >= 1.3.0 wayland-protocols >= 1.18" if test "x$XF86VIDMODE" = xyes; then XWAYLANDMODULES="$XWAYLANDMODULES $VIDMODEPROTO" fi @@ -2372,7 +2372,7 @@ AM_CONDITIONAL(XWAYLAND_EGLSTREAM, [test "x$XWAYLAND_EGLSTREAM" = "xyes"]) dnl and the rest of these are generic, so they're in config.h -dnl +dnl dnl though, thanks to the passing of some significant amount of time, the dnl above is probably a complete fallacy, and you should not rely on it. dnl but this is still actually better than imake, honest. -daniels diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index aa6f37864..e32ba1284 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -308,9 +308,10 @@ output_handle_done(void *data, struct wl_output *wl_output) xwl_output->wl_output_done = TRUE; /* Apply the changes from wl_output only if both "done" events are received, - * or if xdg-output is not supported. + * if xdg-output is not supported or if xdg-output version is high enough. */ - if (xwl_output->xdg_output_done || !xwl_output->xdg_output) + if (xwl_output->xdg_output_done || !xwl_output->xdg_output || + zxdg_output_v1_get_version(xwl_output->xdg_output) >= 3) apply_output_change(xwl_output); } @@ -352,14 +353,29 @@ xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output) struct xwl_output *xwl_output = data; xwl_output->xdg_output_done = TRUE; - if (xwl_output->wl_output_done) + if (xwl_output->wl_output_done && + zxdg_output_v1_get_version(xdg_output) < 3) apply_output_change(xwl_output); } +static void +xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output, + const char *name) +{ +} + +static void +xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output, + const char *description) +{ +} + static const struct zxdg_output_v1_listener xdg_output_listener = { xdg_output_handle_logical_position, xdg_output_handle_logical_size, xdg_output_handle_done, + xdg_output_handle_name, + xdg_output_handle_description, }; struct xwl_output * diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 2475366e0..667748a12 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -807,8 +807,10 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, xwl_screen->expecting_event++; } else if (strcmp(interface, "zxdg_output_manager_v1") == 0) { + /* We support xdg-output from version 1 to version 3 */ + version = min(version, 3); xwl_screen->xdg_output_manager = - wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, 1); + wl_registry_bind(registry, id, &zxdg_output_manager_v1_interface, version); xwl_screen_init_xdg_output(xwl_screen); } #ifdef XWL_HAS_GLAMOR diff --git a/meson.build b/meson.build index def32e9b9..77bde232a 100644 --- a/meson.build +++ b/meson.build @@ -62,7 +62,7 @@ libdrm_req = '>= 2.4.89' libselinux_req = '>= 2.0.86' xext_req = '>= 1.0.99.4' wayland_req = '>= 1.3.0' -wayland_protocols_req = '>= 1.10' +wayland_protocols_req = '>= 1.18' gbm_req = '>= 10.2' xf86dgaproto_req = '>= 2.0.99.1' -- GitLab