Introduction ------------
This is the first of (many) parts in the upstreaming of the Wayland driver for Wine. Since the amount of code and commits is large, my approach is to upstream the driver in multiple parts in a serial fashion, with each part being a cohesive (to the degree possible) set of not too many commits. When each part is reviewed and merged, I will move on to proposing the next part. My main goal with this approach is to make reviewing easier and more focused. If you have other ideas about how to improve this process for the reviewers, please let me know.
A lot of pieces need to fall into place before the driver becomes even remotely functional, so, some MRs (especially the initial ones) will be a bit more preparatory in nature. To aid in the understanding of and justification for some of the code introduced in such MRs, all the remaining driver commits are always going to be available at https://gitlab.winehq.org/afrantzis/wine/-/tree/wayland.
Part 1 -------
This MR introduces the Wayland driver PE and unixlib components with some basic code, and prepares the makedep tool to be able to handle Wayland protocol files. Please see the individual commit message for more details.
Some questions I would appreciate some feedback on in the context of this MR:
1. Should the Wayland driver build be enabled by default at this point? (currently it's explicitly opt-in with --with-wayland) 2. How should the Wayland driver build be integrated with CI? (currently piggybacking on gitlab/build-linux by adding --with-wayland)
Note that building the Wayland driver should not affect running/testing on X11/Xwayland etc, since it's placed lower in the driver priority list.
Part 2 preview: We will handle basic Wayland wl_output (i.e., display) events and populate the Wine monitor information.
-- v3: winewayland.drv: Introduce wayland_mutex. winewayland.drv: Initialize basic per-thread Wayland instance.
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Add the initial driver stub for the Wayland driver and build it by default.
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com --- configure | 22 +++++++++++++++++ configure.ac | 6 +++++ dlls/winewayland.drv/Makefile.in | 6 +++++ dlls/winewayland.drv/dllmain.c | 30 +++++++++++++++++++++++ dlls/winewayland.drv/version.rc | 22 +++++++++++++++++ dlls/winewayland.drv/waylanddrv_dll.h | 28 +++++++++++++++++++++ dlls/winewayland.drv/winewayland.drv.spec | 0 7 files changed, 114 insertions(+) create mode 100644 dlls/winewayland.drv/Makefile.in create mode 100644 dlls/winewayland.drv/dllmain.c create mode 100644 dlls/winewayland.drv/version.rc create mode 100644 dlls/winewayland.drv/waylanddrv_dll.h create mode 100644 dlls/winewayland.drv/winewayland.drv.spec
diff --git a/configure b/configure index 80f0acd1f78..94512c2ac56 100755 --- a/configure +++ b/configure @@ -937,6 +937,7 @@ with_unwind with_usb with_v4l2 with_vulkan +with_wayland with_xcomposite with_xcursor with_xfixes @@ -1472,6 +1473,7 @@ enable_wineps_drv enable_winepulse_drv enable_wineusb_sys enable_winevulkan +enable_winewayland_drv enable_winex11_drv enable_winexinput_sys enable_wing32 @@ -2458,6 +2460,7 @@ Optional Packages: --without-usb do not use the libusb library --without-v4l2 do not use v4l2 (video capture) --without-vulkan do not use Vulkan + --without-wayland do not build the Wayland driver --without-xcomposite do not use the Xcomposite extension --without-xcursor do not use the Xcursor extension --without-xfixes do not use Xfixes for clipboard change notifications @@ -4386,6 +4389,13 @@ then : fi
+# Check whether --with-wayland was given. +if test ${with_wayland+y} +then : + withval=$with_wayland; +fi + + # Check whether --with-xcomposite was given. if test ${with_xcomposite+y} then : @@ -15541,6 +15551,17 @@ enable_winex11_drv=${enable_winex11_drv:-no} fi fi
+if false +then : + case "x$with_wayland" in + x) as_fn_append wine_notices "|Wayland ${notice_platform}development files not found, the Wayland driver won't be supported." ;; + xno) ;; + *) as_fn_error $? "Wayland ${notice_platform}development files not found, the Wayland driver won't be supported. +This is an error since --with-wayland was requested." "$LINENO" 5 ;; +esac +enable_winewayland_drv=${enable_winewayland_drv:-no} +fi + if test "$ac_cv_header_CL_cl_h" = "yes" then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for clGetPlatformInfo in -lOpenCL" >&5 @@ -21730,6 +21751,7 @@ wine_fn_config_makefile dlls/wineps16.drv16 enable_win16 wine_fn_config_makefile dlls/winepulse.drv enable_winepulse_drv wine_fn_config_makefile dlls/wineusb.sys enable_wineusb_sys wine_fn_config_makefile dlls/winevulkan enable_winevulkan +wine_fn_config_makefile dlls/winewayland.drv enable_winewayland_drv wine_fn_config_makefile dlls/winex11.drv enable_winex11_drv wine_fn_config_makefile dlls/winexinput.sys enable_winexinput_sys wine_fn_config_makefile dlls/wing.dll16 enable_win16 diff --git a/configure.ac b/configure.ac index 140f26aec16..b8b8ce32bf6 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,7 @@ AC_ARG_WITH(unwind, AS_HELP_STRING([--without-unwind],[do not use the libunwi AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb library])) AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)])) AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan])) +AC_ARG_WITH(wayland, AS_HELP_STRING([--without-wayland],[do not build the Wayland driver])) AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]), [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi]) AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]), @@ -1335,6 +1336,10 @@ else [enable_winex11_drv]) fi
+WINE_NOTICE_WITH(wayland, [false], + [Wayland ${notice_platform}development files not found, the Wayland driver won't be supported.], + [enable_winewayland_drv]) + dnl **** Check for OpenCL **** if test "$ac_cv_header_CL_cl_h" = "yes" then @@ -3138,6 +3143,7 @@ WINE_CONFIG_MAKEFILE(dlls/wineps16.drv16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/winepulse.drv) WINE_CONFIG_MAKEFILE(dlls/wineusb.sys) WINE_CONFIG_MAKEFILE(dlls/winevulkan) +WINE_CONFIG_MAKEFILE(dlls/winewayland.drv) WINE_CONFIG_MAKEFILE(dlls/winex11.drv) WINE_CONFIG_MAKEFILE(dlls/winexinput.sys) WINE_CONFIG_MAKEFILE(dlls/wing.dll16,enable_win16) diff --git a/dlls/winewayland.drv/Makefile.in b/dlls/winewayland.drv/Makefile.in new file mode 100644 index 00000000000..713b281b1bd --- /dev/null +++ b/dlls/winewayland.drv/Makefile.in @@ -0,0 +1,6 @@ +MODULE = winewayland.drv + +C_SRCS = \ + dllmain.c \ + +RC_SRCS = version.rc diff --git a/dlls/winewayland.drv/dllmain.c b/dlls/winewayland.drv/dllmain.c new file mode 100644 index 00000000000..7ab3341e61d --- /dev/null +++ b/dlls/winewayland.drv/dllmain.c @@ -0,0 +1,30 @@ +/* + * winewayland.drv entry points + * + * Copyright 2022 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "waylanddrv_dll.h" + +BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) +{ + if (reason != DLL_PROCESS_ATTACH) return TRUE; + + DisableThreadLibraryCalls(instance); + + return TRUE; +} diff --git a/dlls/winewayland.drv/version.rc b/dlls/winewayland.drv/version.rc new file mode 100644 index 00000000000..2d99c24f99c --- /dev/null +++ b/dlls/winewayland.drv/version.rc @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2020 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define WINE_FILEDESCRIPTION_STR "Wine Wayland driver" +#define WINE_FILENAME_STR "winewayland.drv" + +#include "wine/wine_common_ver.rc" diff --git a/dlls/winewayland.drv/waylanddrv_dll.h b/dlls/winewayland.drv/waylanddrv_dll.h new file mode 100644 index 00000000000..556898d44b2 --- /dev/null +++ b/dlls/winewayland.drv/waylanddrv_dll.h @@ -0,0 +1,28 @@ +/* + * Wayland driver DLL definitions + * + * Copyright 2022 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WAYLANDDRV_DLL_H +#define __WINE_WAYLANDDRV_DLL_H + +#include <stdarg.h> +#include "windef.h" +#include "winbase.h" + +#endif /* __WINE_WAYLANDDRV_DLL_H */ diff --git a/dlls/winewayland.drv/winewayland.drv.spec b/dlls/winewayland.drv/winewayland.drv.spec new file mode 100644 index 00000000000..e69de29bb2d
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com --- dlls/winewayland.drv/Makefile.in | 2 + dlls/winewayland.drv/dllmain.c | 4 ++ dlls/winewayland.drv/unixlib.h | 32 ++++++++++++++++ dlls/winewayland.drv/waylanddrv.h | 30 +++++++++++++++ dlls/winewayland.drv/waylanddrv_dll.h | 4 ++ dlls/winewayland.drv/waylanddrv_main.c | 53 ++++++++++++++++++++++++++ 6 files changed, 125 insertions(+) create mode 100644 dlls/winewayland.drv/unixlib.h create mode 100644 dlls/winewayland.drv/waylanddrv.h create mode 100644 dlls/winewayland.drv/waylanddrv_main.c
diff --git a/dlls/winewayland.drv/Makefile.in b/dlls/winewayland.drv/Makefile.in index 713b281b1bd..1d52f466c41 100644 --- a/dlls/winewayland.drv/Makefile.in +++ b/dlls/winewayland.drv/Makefile.in @@ -1,6 +1,8 @@ MODULE = winewayland.drv +UNIXLIB = winewayland.so
C_SRCS = \ dllmain.c \ + waylanddrv_main.c \
RC_SRCS = version.rc diff --git a/dlls/winewayland.drv/dllmain.c b/dlls/winewayland.drv/dllmain.c index 7ab3341e61d..89d981a4314 100644 --- a/dlls/winewayland.drv/dllmain.c +++ b/dlls/winewayland.drv/dllmain.c @@ -25,6 +25,10 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, void *reserved) if (reason != DLL_PROCESS_ATTACH) return TRUE;
DisableThreadLibraryCalls(instance); + if (__wine_init_unix_call()) return FALSE; + + if (WAYLANDDRV_UNIX_CALL(init, NULL)) + return FALSE;
return TRUE; } diff --git a/dlls/winewayland.drv/unixlib.h b/dlls/winewayland.drv/unixlib.h new file mode 100644 index 00000000000..427837523e3 --- /dev/null +++ b/dlls/winewayland.drv/unixlib.h @@ -0,0 +1,32 @@ +/* + * Copyright 2022 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WAYLANDDRV_UNIXLIB_H +#define __WINE_WAYLANDDRV_UNIXLIB_H + +#include <stdarg.h> +#include "winternl.h" +#include "wine/unixlib.h" + +enum waylanddrv_unix_func +{ + waylanddrv_unix_func_init, + waylanddrv_unix_func_count, +}; + +#endif /* __WINE_WAYLANDDRV_UNIXLIB_H */ diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h new file mode 100644 index 00000000000..ec656ea87fb --- /dev/null +++ b/dlls/winewayland.drv/waylanddrv.h @@ -0,0 +1,30 @@ +/* + * Wayland driver + * + * Copyright 2020 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_WAYLANDDRV_H +#define __WINE_WAYLANDDRV_H + +#ifndef __WINE_CONFIG_H +# error You must include config.h to use this header +#endif + +#include "unixlib.h" + +#endif /* __WINE_WAYLANDDRV_H */ diff --git a/dlls/winewayland.drv/waylanddrv_dll.h b/dlls/winewayland.drv/waylanddrv_dll.h index 556898d44b2..123b6cd5a61 100644 --- a/dlls/winewayland.drv/waylanddrv_dll.h +++ b/dlls/winewayland.drv/waylanddrv_dll.h @@ -25,4 +25,8 @@ #include "windef.h" #include "winbase.h"
+#include "unixlib.h" + +#define WAYLANDDRV_UNIX_CALL(func, params) WINE_UNIX_CALL(waylanddrv_unix_func_ ## func, params) + #endif /* __WINE_WAYLANDDRV_DLL_H */ diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c new file mode 100644 index 00000000000..396beac5828 --- /dev/null +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -0,0 +1,53 @@ +/* + * WAYLANDDRV initialization code + * + * Copyright 2020 Alexandre Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include "ntstatus.h" +#define WIN32_NO_STATUS + +#include "waylanddrv.h" + +static NTSTATUS waylanddrv_unix_init(void *arg) +{ + return 0; +} + +const unixlib_entry_t __wine_unix_call_funcs[] = +{ + waylanddrv_unix_init, +}; + +C_ASSERT(ARRAYSIZE(__wine_unix_call_funcs) == waylanddrv_unix_func_count); + +#ifdef _WIN64 + +const unixlib_entry_t __wine_unix_call_wow64_funcs[] = +{ + waylanddrv_unix_init, +}; + +C_ASSERT(ARRAYSIZE(__wine_unix_call_wow64_funcs) == waylanddrv_unix_func_count); + +#endif /* _WIN64 */
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Try to connect to the Wayland compositor, and fail driver initialization if we are unable to do so.
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com --- configure | 93 +++++++++++++++++++++++++- configure.ac | 9 ++- dlls/winewayland.drv/Makefile.in | 3 + dlls/winewayland.drv/wayland.c | 41 ++++++++++++ dlls/winewayland.drv/waylanddrv.h | 14 ++++ dlls/winewayland.drv/waylanddrv_main.c | 2 + include/config.h.in | 3 + tools/gitlab/image.docker | 1 + 8 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 dlls/winewayland.drv/wayland.c
diff --git a/configure b/configure index 94512c2ac56..22850f8b754 100755 --- a/configure +++ b/configure @@ -702,6 +702,8 @@ INOTIFY_LIBS INOTIFY_CFLAGS PCSCLITE_LIBS PCAP_LIBS +WAYLAND_CLIENT_LIBS +WAYLAND_CLIENT_CFLAGS X_EXTRA_LIBS X_LIBS X_PRE_LIBS @@ -1746,6 +1748,8 @@ ZYDIS_PE_CFLAGS ZYDIS_PE_LIBS XMKMF CPP +WAYLAND_CLIENT_CFLAGS +WAYLAND_CLIENT_LIBS INOTIFY_CFLAGS INOTIFY_LIBS DBUS_CFLAGS @@ -2551,6 +2555,10 @@ Some influential environment variables: Linker flags for the PE zydis, overriding the bundled version XMKMF Path to xmkmf, Makefile generator for X Window System CPP C preprocessor + WAYLAND_CLIENT_CFLAGS + C compiler flags for wayland-client, overriding pkg-config + WAYLAND_CLIENT_LIBS + Linker flags for wayland-client, overriding pkg-config INOTIFY_CFLAGS C compiler flags for libinotify, overriding pkg-config INOTIFY_LIBS @@ -15551,7 +15559,88 @@ enable_winex11_drv=${enable_winex11_drv:-no} fi fi
-if false +if test "x$with_wayland" != "xno" +then + rm -f conftest.err +if ${WAYLAND_CLIENT_CFLAGS:+false} : +then : + if test ${PKG_CONFIG+y} +then : + WAYLAND_CLIENT_CFLAGS=`$PKG_CONFIG --cflags wayland-client 2>conftest.err` +fi +fi + +if ${WAYLAND_CLIENT_LIBS:+false} : +then : + if test ${PKG_CONFIG+y} +then : + WAYLAND_CLIENT_LIBS=`$PKG_CONFIG --libs wayland-client 2>/dev/null` +fi +fi + + +printf "%s\n" "$as_me:${as_lineno-$LINENO}: wayland-client cflags: $WAYLAND_CLIENT_CFLAGS" >&5 +printf "%s\n" "$as_me:${as_lineno-$LINENO}: wayland-client libs: $WAYLAND_CLIENT_LIBS" >&5 +if test -s conftest.err; then + printf %s "$as_me:${as_lineno-$LINENO}: wayland-client errors: " >&5 + cat conftest.err >&5 +fi +rm -f conftest.err +ac_save_CPPFLAGS=$CPPFLAGS +CPPFLAGS="$CPPFLAGS $WAYLAND_CLIENT_CFLAGS" +ac_fn_c_check_header_compile "$LINENO" "wayland-client.h" "ac_cv_header_wayland_client_h" "$ac_includes_default" +if test "x$ac_cv_header_wayland_client_h" = xyes +then : + printf "%s\n" "#define HAVE_WAYLAND_CLIENT_H 1" >>confdefs.h + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wl_display_connect in -lwayland-client" >&5 +printf %s "checking for wl_display_connect in -lwayland-client... " >&6; } +if test ${ac_cv_lib_wayland_client_wl_display_connect+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lwayland-client $WAYLAND_CLIENT_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char wl_display_connect (); +int +main (void) +{ +return wl_display_connect (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_wayland_client_wl_display_connect=yes +else $as_nop + ac_cv_lib_wayland_client_wl_display_connect=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wayland_client_wl_display_connect" >&5 +printf "%s\n" "$ac_cv_lib_wayland_client_wl_display_connect" >&6; } +if test "x$ac_cv_lib_wayland_client_wl_display_connect" = xyes +then : + : +else $as_nop + WAYLAND_CLIENT_LIBS="" +fi + +CPPFLAGS=$ac_save_CPPFLAGS + +fi +if test -z "$WAYLAND_CLIENT_LIBS" then : case "x$with_wayland" in x) as_fn_append wine_notices "|Wayland ${notice_platform}development files not found, the Wayland driver won't be supported." ;; @@ -23053,6 +23142,8 @@ X_CFLAGS = $X_CFLAGS X_PRE_LIBS = $X_PRE_LIBS X_LIBS = $X_LIBS X_EXTRA_LIBS = $X_EXTRA_LIBS +WAYLAND_CLIENT_CFLAGS = $WAYLAND_CLIENT_CFLAGS +WAYLAND_CLIENT_LIBS = $WAYLAND_CLIENT_LIBS PCAP_LIBS = $PCAP_LIBS PCSCLITE_LIBS = $PCSCLITE_LIBS INOTIFY_CFLAGS = $INOTIFY_CFLAGS diff --git a/configure.ac b/configure.ac index b8b8ce32bf6..8ffbdb05a55 100644 --- a/configure.ac +++ b/configure.ac @@ -1336,7 +1336,14 @@ else [enable_winex11_drv]) fi
-WINE_NOTICE_WITH(wayland, [false], +if test "x$with_wayland" != "xno" +then + WINE_PACKAGE_FLAGS(WAYLAND_CLIENT,[wayland-client],,,, + [AC_CHECK_HEADERS([wayland-client.h]) + AC_CHECK_LIB(wayland-client,wl_display_connect,[:], + [WAYLAND_CLIENT_LIBS=""],[$WAYLAND_CLIENT_LIBS])]) +fi +WINE_NOTICE_WITH(wayland, [test -z "$WAYLAND_CLIENT_LIBS"], [Wayland ${notice_platform}development files not found, the Wayland driver won't be supported.], [enable_winewayland_drv])
diff --git a/dlls/winewayland.drv/Makefile.in b/dlls/winewayland.drv/Makefile.in index 1d52f466c41..fc1fe8119ec 100644 --- a/dlls/winewayland.drv/Makefile.in +++ b/dlls/winewayland.drv/Makefile.in @@ -1,8 +1,11 @@ MODULE = winewayland.drv UNIXLIB = winewayland.so +UNIX_CFLAGS = $(WAYLAND_CLIENT_CFLAGS) +UNIX_LIBS = $(WAYLAND_CLIENT_LIBS)
C_SRCS = \ dllmain.c \ + wayland.c \ waylanddrv_main.c \
RC_SRCS = version.rc diff --git a/dlls/winewayland.drv/wayland.c b/dlls/winewayland.drv/wayland.c new file mode 100644 index 00000000000..9b61427c8aa --- /dev/null +++ b/dlls/winewayland.drv/wayland.c @@ -0,0 +1,41 @@ +/* + * Wayland core handling + * + * Copyright (c) 2020 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include "waylanddrv.h" + +struct wl_display *process_wl_display = NULL; + +/********************************************************************** + * wayland_process_init + * + * Initialise the per process wayland objects. + * + */ +BOOL wayland_process_init(void) +{ + process_wl_display = wl_display_connect(NULL); + return process_wl_display != NULL; +} diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index ec656ea87fb..3fd8728d81b 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -25,6 +25,20 @@ # error You must include config.h to use this header #endif
+#include <wayland-client.h> + #include "unixlib.h"
+/********************************************************************** + * Globals + */ + +extern struct wl_display *process_wl_display DECLSPEC_HIDDEN; + +/********************************************************************** + * Wayland initialization + */ + +BOOL wayland_process_init(void) DECLSPEC_HIDDEN; + #endif /* __WINE_WAYLANDDRV_H */ diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c index 396beac5828..d4018683239 100644 --- a/dlls/winewayland.drv/waylanddrv_main.c +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -31,6 +31,8 @@
static NTSTATUS waylanddrv_unix_init(void *arg) { + if (!wayland_process_init()) return STATUS_UNSUCCESSFUL; + return 0; }
diff --git a/include/config.h.in b/include/config.h.in index 44ea547b7ec..2e806157ebd 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -645,6 +645,9 @@ /* Define to 1 if you have the <valgrind/valgrind.h> header file. */ #undef HAVE_VALGRIND_VALGRIND_H
+/* Define to 1 if you have the <wayland-client.h> header file. */ +#undef HAVE_WAYLAND_CLIENT_H + /* Define to 1 if you have the <X11/extensions/shape.h> header file. */ #undef HAVE_X11_EXTENSIONS_SHAPE_H
diff --git a/tools/gitlab/image.docker b/tools/gitlab/image.docker index 0d23a75483b..cf16ed49c95 100644 --- a/tools/gitlab/image.docker +++ b/tools/gitlab/image.docker @@ -37,6 +37,7 @@ RUN export DEBIAN_FRONTEND=noninteractive; \ libusb-1.0-0-dev:amd64 libusb-1.0-0-dev:i386 \ libv4l-dev:amd64 libv4l-dev:i386 \ libvulkan-dev:amd64 libvulkan-dev:i386 \ + libwayland-dev:amd64 libwayland-dev:i386 \ libx11-dev:amd64 libx11-dev:i386 \ libxcomposite-dev:amd64 libxcomposite-dev:i386 \ libxcursor-dev:amd64 libxcursor-dev:i386 \
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Handle allocation and deallocation of per-thread data (currently without any actual contents), and initialize them for the desktop window thread.
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com --- dlls/winewayland.drv/Makefile.in | 3 +- dlls/winewayland.drv/waylanddrv.h | 26 ++++++++++++++ dlls/winewayland.drv/waylanddrv_main.c | 50 ++++++++++++++++++++++++++ dlls/winewayland.drv/window.c | 50 ++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 dlls/winewayland.drv/window.c
diff --git a/dlls/winewayland.drv/Makefile.in b/dlls/winewayland.drv/Makefile.in index fc1fe8119ec..b3ad75fb624 100644 --- a/dlls/winewayland.drv/Makefile.in +++ b/dlls/winewayland.drv/Makefile.in @@ -1,11 +1,12 @@ MODULE = winewayland.drv UNIXLIB = winewayland.so UNIX_CFLAGS = $(WAYLAND_CLIENT_CFLAGS) -UNIX_LIBS = $(WAYLAND_CLIENT_LIBS) +UNIX_LIBS = -lwin32u $(WAYLAND_CLIENT_LIBS)
C_SRCS = \ dllmain.c \ wayland.c \ waylanddrv_main.c \ + window.c \
RC_SRCS = version.rc diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 3fd8728d81b..2b159a0a345 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -25,8 +25,13 @@ # error You must include config.h to use this header #endif
+#include <stdarg.h> #include <wayland-client.h>
+#include "windef.h" +#include "winbase.h" +#include "ntuser.h" + #include "unixlib.h"
/********************************************************************** @@ -35,10 +40,31 @@
extern struct wl_display *process_wl_display DECLSPEC_HIDDEN;
+/********************************************************************** + * Wayland thread data + */ + +struct wayland_thread_data +{ +}; + +extern struct wayland_thread_data *wayland_init_thread_data(void) DECLSPEC_HIDDEN; + +static inline struct wayland_thread_data *wayland_thread_data(void) +{ + return (struct wayland_thread_data *)(UINT_PTR)NtUserGetThreadInfo()->driver_data; +} + /********************************************************************** * Wayland initialization */
BOOL wayland_process_init(void) DECLSPEC_HIDDEN;
+/********************************************************************** + * USER driver functions + */ + +BOOL WAYLAND_CreateWindow(HWND hwnd) DECLSPEC_HIDDEN; + #endif /* __WINE_WAYLANDDRV_H */ diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c index d4018683239..294e9101d06 100644 --- a/dlls/winewayland.drv/waylanddrv_main.c +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -29,10 +29,60 @@
#include "waylanddrv.h"
+#include "wine/debug.h" +#include "wine/gdi_driver.h" + +#include <stdlib.h> + +WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); + +/*********************************************************************** + * Initialize per thread data + */ +struct wayland_thread_data *wayland_init_thread_data(void) +{ + struct wayland_thread_data *data = wayland_thread_data(); + + if (data) return data; + + if (!(data = calloc(1, sizeof(*data)))) + { + ERR("could not create data\n"); + NtTerminateProcess(0, 1); + } + + NtUserGetThreadInfo()->driver_data = (UINT_PTR)data; + + return data; +} + +/*********************************************************************** + * ThreadDetach (WAYLAND.@) + */ +static void WAYLAND_ThreadDetach(void) +{ + struct wayland_thread_data *data = wayland_thread_data(); + + if (data) + { + free(data); + /* clear data in case we get re-entered from user32 before the thread is truly dead */ + NtUserGetThreadInfo()->driver_data = 0; + } +} + +static const struct user_driver_funcs waylanddrv_funcs = +{ + .pCreateWindow = WAYLAND_CreateWindow, + .pThreadDetach = WAYLAND_ThreadDetach, +}; + static NTSTATUS waylanddrv_unix_init(void *arg) { if (!wayland_process_init()) return STATUS_UNSUCCESSFUL;
+ __wine_set_user_driver(&waylanddrv_funcs, WINE_GDI_DRIVER_VERSION); + return 0; }
diff --git a/dlls/winewayland.drv/window.c b/dlls/winewayland.drv/window.c new file mode 100644 index 00000000000..54c40a32bbb --- /dev/null +++ b/dlls/winewayland.drv/window.c @@ -0,0 +1,50 @@ +/* + * Window related functions + * + * Copyright 2020 Alexandros Frantzis for Collabora Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep unix +#endif + +#include "config.h" + +#include "waylanddrv.h" + +#include "wine/debug.h" + +#include "ntuser.h" + +WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); + +/********************************************************************** + * WAYLAND_CreateWindow + */ +BOOL WAYLAND_CreateWindow(HWND hwnd) +{ + TRACE("%p\n", hwnd); + + if (hwnd == NtUserGetDesktopWindow()) + { + /* Initialize wayland so that the desktop window thread has access + * to all the wayland related information (e.g., displays). */ + wayland_init_thread_data(); + } + + return TRUE; +}
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Every thread that requires interaction with Wayland maintains its own independent set of Wayland protocols objects. Events from Wayland protocol objects are dispatched into a thread-specific Wayland event queue.
This design simplifies synchronization, since there is no shared Wayland state between threads, and will later make it easier to dispatch events to the proper thread message queue. The downside is that there is some duplication of event dispatching if multiple GUI threads are present.
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com --- dlls/winewayland.drv/Makefile.in | 2 +- dlls/winewayland.drv/wayland.c | 128 +++++++++++++++++++++++++ dlls/winewayland.drv/waylanddrv.h | 20 ++++ dlls/winewayland.drv/waylanddrv_main.c | 10 ++ 4 files changed, 159 insertions(+), 1 deletion(-)
diff --git a/dlls/winewayland.drv/Makefile.in b/dlls/winewayland.drv/Makefile.in index b3ad75fb624..c712201da12 100644 --- a/dlls/winewayland.drv/Makefile.in +++ b/dlls/winewayland.drv/Makefile.in @@ -1,7 +1,7 @@ MODULE = winewayland.drv UNIXLIB = winewayland.so UNIX_CFLAGS = $(WAYLAND_CLIENT_CFLAGS) -UNIX_LIBS = -lwin32u $(WAYLAND_CLIENT_LIBS) +UNIX_LIBS = -lwin32u $(WAYLAND_CLIENT_LIBS) $(PTHREAD_LIBS)
C_SRCS = \ dllmain.c \ diff --git a/dlls/winewayland.drv/wayland.c b/dlls/winewayland.drv/wayland.c index 9b61427c8aa..650a102155b 100644 --- a/dlls/winewayland.drv/wayland.c +++ b/dlls/winewayland.drv/wayland.c @@ -26,8 +26,136 @@
#include "waylanddrv.h"
+#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); + struct wl_display *process_wl_display = NULL;
+static pthread_mutex_t thread_wayland_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +static struct wl_list thread_wayland_list = {&thread_wayland_list, &thread_wayland_list}; + +/********************************************************************** + * Registry handling + */ + +static void registry_handle_global(void *data, struct wl_registry *registry, + uint32_t id, const char *interface, + uint32_t version) +{ + struct wayland *wayland = data; + + TRACE("interface=%s version=%u id=%u\n", interface, version, id); + + if (strcmp(interface, "wl_compositor") == 0) + { + wayland->wl_compositor = + wl_registry_bind(registry, id, &wl_compositor_interface, 4); + } +} + +static void registry_handle_global_remove(void *data, struct wl_registry *registry, + uint32_t id) +{ + TRACE("id=%u\n", id); +} + +static const struct wl_registry_listener registry_listener = { + registry_handle_global, + registry_handle_global_remove +}; + +/********************************************************************** + * wayland_init + * + * Initialise a wayland instance. + */ +BOOL wayland_init(struct wayland *wayland) +{ + struct wl_display *wl_display_wrapper; + + TRACE("wayland=%p wl_display=%p\n", wayland, process_wl_display); + + wl_list_init(&wayland->thread_link); + + wayland->process_id = GetCurrentProcessId(); + wayland->thread_id = GetCurrentThreadId(); + wayland->wl_display = process_wl_display; + + if (!wayland->wl_display) + { + ERR("Failed to connect to wayland compositor\n"); + return FALSE; + } + + if (!(wayland->wl_event_queue = wl_display_create_queue(wayland->wl_display))) + { + ERR("Failed to create event queue\n"); + return FALSE; + } + + if (!(wl_display_wrapper = wl_proxy_create_wrapper(wayland->wl_display))) + { + ERR("Failed to create proxy wrapper for wl_display\n"); + return FALSE; + } + wl_proxy_set_queue((struct wl_proxy *) wl_display_wrapper, wayland->wl_event_queue); + + wayland->wl_registry = wl_display_get_registry(wl_display_wrapper); + wl_proxy_wrapper_destroy(wl_display_wrapper); + if (!wayland->wl_registry) + { + ERR("Failed to get to wayland registry\n"); + return FALSE; + } + + /* Populate registry */ + wl_registry_add_listener(wayland->wl_registry, ®istry_listener, wayland); + + /* We need three roundtrips. One to get and bind globals, one to handle all + * initial events produced from registering the globals and one more to + * handle potential third-order registrations. */ + wl_display_roundtrip_queue(wayland->wl_display, wayland->wl_event_queue); + wl_display_roundtrip_queue(wayland->wl_display, wayland->wl_event_queue); + wl_display_roundtrip_queue(wayland->wl_display, wayland->wl_event_queue); + + /* Keep a list of all thread wayland instances. */ + pthread_mutex_lock(&thread_wayland_mutex); + wl_list_insert(&thread_wayland_list, &wayland->thread_link); + pthread_mutex_unlock(&thread_wayland_mutex); + + wayland->initialized = TRUE; + + return TRUE; +} + +/********************************************************************** + * wayland_deinit + * + * Deinitialise a wayland instance, releasing all associated resources. + */ +void wayland_deinit(struct wayland *wayland) +{ + TRACE("%p\n", wayland); + + pthread_mutex_lock(&thread_wayland_mutex); + wl_list_remove(&wayland->thread_link); + pthread_mutex_unlock(&thread_wayland_mutex); + + if (wayland->wl_compositor) + wl_compositor_destroy(wayland->wl_compositor); + + if (wayland->wl_registry) + wl_registry_destroy(wayland->wl_registry); + + if (wayland->wl_event_queue) + wl_event_queue_destroy(wayland->wl_event_queue); + + wl_display_flush(wayland->wl_display); + + memset(wayland, 0, sizeof(*wayland)); +} + /********************************************************************** * wayland_process_init * diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index 2b159a0a345..a00a4a850da 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -25,6 +25,7 @@ # error You must include config.h to use this header #endif
+#include <pthread.h> #include <stdarg.h> #include <wayland-client.h>
@@ -40,12 +41,29 @@
extern struct wl_display *process_wl_display DECLSPEC_HIDDEN;
+/********************************************************************** + * Definitions for wayland types + */ + +struct wayland +{ + struct wl_list thread_link; + BOOL initialized; + DWORD process_id; + DWORD thread_id; + struct wl_display *wl_display; + struct wl_event_queue *wl_event_queue; + struct wl_registry *wl_registry; + struct wl_compositor *wl_compositor; +}; + /********************************************************************** * Wayland thread data */
struct wayland_thread_data { + struct wayland wayland; };
extern struct wayland_thread_data *wayland_init_thread_data(void) DECLSPEC_HIDDEN; @@ -60,6 +78,8 @@ static inline struct wayland_thread_data *wayland_thread_data(void) */
BOOL wayland_process_init(void) DECLSPEC_HIDDEN; +BOOL wayland_init(struct wayland *wayland) DECLSPEC_HIDDEN; +void wayland_deinit(struct wayland *wayland) DECLSPEC_HIDDEN;
/********************************************************************** * USER driver functions diff --git a/dlls/winewayland.drv/waylanddrv_main.c b/dlls/winewayland.drv/waylanddrv_main.c index 294e9101d06..e5d83d64a42 100644 --- a/dlls/winewayland.drv/waylanddrv_main.c +++ b/dlls/winewayland.drv/waylanddrv_main.c @@ -35,6 +35,7 @@ #include <stdlib.h>
WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv); +WINE_DECLARE_DEBUG_CHANNEL(winediag);
/*********************************************************************** * Initialize per thread data @@ -51,6 +52,14 @@ struct wayland_thread_data *wayland_init_thread_data(void) NtTerminateProcess(0, 1); }
+ if (!wayland_init(&data->wayland)) + { + ERR_(winediag)("waylanddrv: Can't open wayland display. Please ensure " + "that your wayland server is running and that " + "$WAYLAND_DISPLAY is set correctly.\n"); + NtTerminateProcess(0, 1); + } + NtUserGetThreadInfo()->driver_data = (UINT_PTR)data;
return data; @@ -65,6 +74,7 @@ static void WAYLAND_ThreadDetach(void)
if (data) { + wayland_deinit(&data->wayland); free(data); /* clear data in case we get re-entered from user32 before the thread is truly dead */ NtUserGetThreadInfo()->driver_data = 0;
From: Alexandros Frantzis alexandros.frantzis@collabora.com
Introduce a thin wrapper around pthread mutex to provide more robust mutex handling and informative error messages in case of suspected deadlock, similarly to ntdll.RtlEnterCriticalSection.
Signed-off-by: Alexandros Frantzis alexandros.frantzis@collabora.com --- dlls/winewayland.drv/wayland.c | 85 +++++++++++++++++++++++++++++-- dlls/winewayland.drv/waylanddrv.h | 15 ++++++ 2 files changed, 95 insertions(+), 5 deletions(-)
diff --git a/dlls/winewayland.drv/wayland.c b/dlls/winewayland.drv/wayland.c index 650a102155b..cd154e1543f 100644 --- a/dlls/winewayland.drv/wayland.c +++ b/dlls/winewayland.drv/wayland.c @@ -28,13 +28,88 @@
#include "wine/debug.h"
+#include <errno.h> +#include <stdlib.h> +#include <time.h> + WINE_DEFAULT_DEBUG_CHANNEL(waylanddrv);
struct wl_display *process_wl_display = NULL;
-static pthread_mutex_t thread_wayland_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +static struct wayland_mutex thread_wayland_mutex = +{ + PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, 0, 0, __FILE__ ": thread_wayland_mutex" +}; static struct wl_list thread_wayland_list = {&thread_wayland_list, &thread_wayland_list};
+/********************************************************************** + * wayland_mutex_lock + * + * Lock a mutex, emitting error messages in cases of suspected deadlock. + * In case of an unrecoverable error abort to ensure the program doesn't + * continue with an inconsistent state. + */ +void wayland_mutex_lock(struct wayland_mutex *wayland_mutex) +{ + UINT tid = GetCurrentThreadId(); + struct timespec timeout; + int err; + + clock_gettime(CLOCK_REALTIME, &timeout); + timeout.tv_sec += 5; + + while (TRUE) + { + err = pthread_mutex_timedlock(&wayland_mutex->mutex, &timeout); + if (!err) break; + + if (err == ETIMEDOUT) + { + ERR("mutex %p %s lock timed out in thread %04x, blocked by %04x, retrying (60 sec)\n", + wayland_mutex, wayland_mutex->name, tid, wayland_mutex->owner_tid); + clock_gettime(CLOCK_REALTIME, &timeout); + timeout.tv_sec += 60; + } + else + { + ERR("error locking mutex %p %s errno=%d, aborting\n", + wayland_mutex, wayland_mutex->name, errno); + abort(); + } + } + + wayland_mutex->owner_tid = tid; + wayland_mutex->lock_count++; +} + +/********************************************************************** + * wayland_mutex_unlock + * + * Unlock a mutex. + */ +void wayland_mutex_unlock(struct wayland_mutex *wayland_mutex) +{ + int err; + + wayland_mutex->lock_count--; + + if (wayland_mutex->lock_count == 0) + { + wayland_mutex->owner_tid = 0; + } + else if (wayland_mutex->lock_count < 0) + { + ERR("mutex %p %s lock_count is %d < 0\n", + wayland_mutex, wayland_mutex->name, wayland_mutex->lock_count); + } + + if ((err = pthread_mutex_unlock(&wayland_mutex->mutex))) + { + ERR("failed to unlock mutex %p %s errno=%d\n", + wayland_mutex, wayland_mutex->name, err); + } +} + /********************************************************************** * Registry handling */ @@ -120,9 +195,9 @@ BOOL wayland_init(struct wayland *wayland) wl_display_roundtrip_queue(wayland->wl_display, wayland->wl_event_queue);
/* Keep a list of all thread wayland instances. */ - pthread_mutex_lock(&thread_wayland_mutex); + wayland_mutex_lock(&thread_wayland_mutex); wl_list_insert(&thread_wayland_list, &wayland->thread_link); - pthread_mutex_unlock(&thread_wayland_mutex); + wayland_mutex_unlock(&thread_wayland_mutex);
wayland->initialized = TRUE;
@@ -138,9 +213,9 @@ void wayland_deinit(struct wayland *wayland) { TRACE("%p\n", wayland);
- pthread_mutex_lock(&thread_wayland_mutex); + wayland_mutex_lock(&thread_wayland_mutex); wl_list_remove(&wayland->thread_link); - pthread_mutex_unlock(&thread_wayland_mutex); + wayland_mutex_unlock(&thread_wayland_mutex);
if (wayland->wl_compositor) wl_compositor_destroy(wayland->wl_compositor); diff --git a/dlls/winewayland.drv/waylanddrv.h b/dlls/winewayland.drv/waylanddrv.h index a00a4a850da..3bcc2379a34 100644 --- a/dlls/winewayland.drv/waylanddrv.h +++ b/dlls/winewayland.drv/waylanddrv.h @@ -45,6 +45,14 @@ extern struct wl_display *process_wl_display DECLSPEC_HIDDEN; * Definitions for wayland types */
+struct wayland_mutex +{ + pthread_mutex_t mutex; + UINT owner_tid; + int lock_count; + const char *name; +}; + struct wayland { struct wl_list thread_link; @@ -81,6 +89,13 @@ BOOL wayland_process_init(void) DECLSPEC_HIDDEN; BOOL wayland_init(struct wayland *wayland) DECLSPEC_HIDDEN; void wayland_deinit(struct wayland *wayland) DECLSPEC_HIDDEN;
+/********************************************************************** + * Wayland mutex + */ + +void wayland_mutex_lock(struct wayland_mutex *wayland_mutex) DECLSPEC_HIDDEN; +void wayland_mutex_unlock(struct wayland_mutex *wayland_mutex) DECLSPEC_HIDDEN; + /********************************************************************** * USER driver functions */
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=130177
Your paranoid android.
=== debian11 (32 bit report) ===
dinput: device8.c:496: Test failed: WaitForSingleObject returned 0x102 device8.c:500: Test failed: WaitForSingleObject returned 0x102 device8.c:520: Test failed: got data size 0, expected 1 device8.c:521: Test failed: got action uAppData 0046BAAF, expected FFFFFFFF device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:551: Test failed: GetDeviceData returned 0 device8.c:555: Test failed: got data_size 0, expected 1 device8.c:496: Test failed: WaitForSingleObject returned 0x102 device8.c:500: Test failed: WaitForSingleObject returned 0x102 device8.c:520: Test failed: got data size 0, expected 1 device8.c:521: Test failed: got action uAppData 0046BAAF, expected 00000002 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:551: Test failed: GetDeviceData returned 0 device8.c:555: Test failed: got data_size 0, expected 1 device8.c:496: Test failed: WaitForSingleObject returned 0x102 device8.c:500: Test failed: WaitForSingleObject returned 0x102 device8.c:520: Test failed: got data size 0, expected 1 device8.c:521: Test failed: got action uAppData 0046BAAF, expected 0000000A device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:551: Test failed: GetDeviceData returned 0 device8.c:555: Test failed: got data_size 0, expected 1 device8.c:496: Test failed: WaitForSingleObject returned 0x102 device8.c:500: Test failed: WaitForSingleObject returned 0x102 device8.c:520: Test failed: got data size 0, expected 1 device8.c:521: Test failed: got action uAppData 0046BAAF, expected FFFFFFFF device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:551: Test failed: GetDeviceData returned 0 device8.c:555: Test failed: got data_size 0, expected 1 device8.c:496: Test failed: WaitForSingleObject returned 0x102 device8.c:500: Test failed: WaitForSingleObject returned 0x102 device8.c:520: Test failed: got data size 0, expected 1 device8.c:521: Test failed: got action uAppData 0046BAAF, expected 0000000B device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:551: Test failed: GetDeviceData returned 0 device8.c:555: Test failed: got data_size 0, expected 1 device8.c:496: Test failed: WaitForSingleObject returned 0x102 device8.c:500: Test failed: WaitForSingleObject returned 0x102 device8.c:520: Test failed: got data size 0, expected 1 device8.c:521: Test failed: got action uAppData 0046BAAF, expected 00000002 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:531: Test failed: WaitForSingleObject returned 0x102 device8.c:535: Test failed: WaitForSingleObject returned 0x102 device8.c:551: Test failed: GetDeviceData returned 0 device8.c:555: Test failed: got data_size 0, expected 1
On Thu Mar 2 12:22:23 2023 +0000, Alexandros Frantzis wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/2275/diffs?diff_id=35247&start_sha=cb6cb89be87522e607d1748faf97df2dacafc3d5#6cb3a7ca18cce41a1d9a2aba323acf8efde1a178_123_123)
Fixed!
On Thu Mar 2 12:22:24 2023 +0000, Alexandros Frantzis wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/2275/diffs?diff_id=35247&start_sha=cb6cb89be87522e607d1748faf97df2dacafc3d5#6cb3a7ca18cce41a1d9a2aba323acf8efde1a178_135_135)
Thanks, fixed!