Commit 50c1b197 authored by Alexandros Frantzis's avatar Alexandros Frantzis Committed by Alexandre Julliard

winewayland.drv: Perform basic per-process Wayland initialization.

Try to connect to the Wayland compositor, and fail driver initialization if we are unable to do so. Signed-off-by: 's avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
parent 5ef250c0
......@@ -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
......@@ -937,6 +939,7 @@ with_unwind
with_usb
with_v4l2
with_vulkan
with_wayland
with_xcomposite
with_xcursor
with_xfixes
......@@ -1746,6 +1749,8 @@ ZYDIS_PE_CFLAGS
ZYDIS_PE_LIBS
XMKMF
CPP
WAYLAND_CLIENT_CFLAGS
WAYLAND_CLIENT_LIBS
INOTIFY_CFLAGS
INOTIFY_LIBS
DBUS_CFLAGS
......@@ -2460,6 +2465,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
......@@ -2550,6 +2556,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
......@@ -4388,6 +4398,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 :
......@@ -15543,6 +15560,98 @@ enable_winex11_drv=${enable_winex11_drv:-no}
fi
fi
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." ;;
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
......@@ -23036,6 +23145,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
......
......@@ -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,17 @@ else
[enable_winex11_drv])
fi
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])
dnl **** Check for OpenCL ****
if test "$ac_cv_header_CL_cl_h" = "yes"
then
......
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
/*
* 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;
}
......@@ -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 */
......@@ -31,6 +31,8 @@
static NTSTATUS waylanddrv_unix_init(void *arg)
{
if (!wayland_process_init()) return STATUS_UNSUCCESSFUL;
return 0;
}
......
......@@ -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
......
......@@ -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 \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment