xserver: Branch 'master' - 5 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat May 18 15:05:36 UTC 2019


 configure.ac            |    8 +++++++-
 include/dix-config.h.in |    3 +++
 include/meson.build     |    4 ++++
 include/os.h            |    4 ++++
 mi/mibitblt.c           |    4 ++++
 os/inputthread.c        |    4 ++++
 os/utils.c              |    8 ++++----
 os/xserver_poll.c       |    4 ++++
 8 files changed, 34 insertions(+), 5 deletions(-)

New commits:
commit 965eda947d4c847c6e520317b57024b4586507ec
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Apr 25 23:11:08 2019 +0100

    mi: Provide ffs when compiling using MinGW
    
    I don't know how I feel about the promise made in 2e7f790b :)

diff --git a/mi/mibitblt.c b/mi/mibitblt.c
index 4f7e29170..84f8da65a 100644
--- a/mi/mibitblt.c
+++ b/mi/mibitblt.c
@@ -62,6 +62,10 @@ SOFTWARE.
 #include <X11/Xmd.h>
 #include "servermd.h"
 
+#ifdef __MINGW32__
+#define ffs __builtin_ffs
+#endif
+
 /* MICOPYAREA -- public entry for the CopyArea request
  * For each rectangle in the source region
  *     get the pixels with GetSpans
commit a838c840a3f8c55157615f072b9a3c3a4b476b37
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Apr 25 22:44:49 2019 +0100

    os: Ensure sigset_t is provided when compiling for MinGW
    
    Only _sigset_t is defined by MinGW's signal.h

diff --git a/include/os.h b/include/os.h
index a1835cd6a..bb3348b18 100644
--- a/include/os.h
+++ b/include/os.h
@@ -721,6 +721,10 @@ os_move_fd(int fd);
 
 #include <signal.h>
 
+#if defined(WIN32) && !defined(__CYGWIN__)
+typedef _sigset_t sigset_t;
+#endif
+
 extern _X_EXPORT int
 xthread_sigmask(int how, const sigset_t *set, sigset_t *oldest);
 
commit 7b4b030df8f9c994f3dc60cf85e74d234464af28
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Jul 28 14:46:15 2016 +0100

    configure: Check for sigprocmask
    
    MinGW defines SIG_BLOCK, but doesn't have signal masks, so rather than
    checking for SIG_BLOCK, add a configure check for sigprocmask.
    
    v2:
    Also add check to meson.build

diff --git a/configure.ac b/configure.ac
index 215dd64fe..23c0ac285 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,7 +159,8 @@ dnl Checks for library functions.
 AC_CHECK_FUNCS([backtrace geteuid getuid issetugid getresuid \
 	getdtablesize getifaddrs getpeereid getpeerucred getprogname getzoneid \
 	mmap posix_fallocate seteuid shmctl64 strncasecmp vasprintf vsnprintf \
-	walkcontext setitimer poll epoll_create1 mkostemp memfd_create])
+	walkcontext setitimer poll epoll_create1 mkostemp memfd_create \
+	sigprocmask])
 AC_CONFIG_LIBOBJ_DIR([os])
 AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup\
 	timingsafe_memcmp])
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 9eb1a924e..b463a17f3 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -512,4 +512,7 @@
 /* Have <sys/sysmacros.h> header */
 #undef HAVE_SYS_SYSMACROS_H
 
+/* Have sigprocmask */
+#undef HAVE_SIGPROCMASK
+
 #endif /* _DIX_CONFIG_H_ */
diff --git a/include/meson.build b/include/meson.build
index 527025b24..2c1b49e06 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -155,6 +155,7 @@ conf_data.set('HAVE_SETEUID', cc.has_function('seteuid'))
 conf_data.set('HAVE_SETITIMER', cc.has_function('setitimer'))
 conf_data.set('HAVE_SHMCTL64', cc.has_function('shmctl64'))
 conf_data.set('HAVE_SIGACTION', cc.has_function('sigaction'))
+conf_data.set('HAVE_SIGPROCMASK', cc.has_function('sigprocmask'))
 conf_data.set('HAVE_STRCASECMP', cc.has_function('strcasecmp'))
 conf_data.set('HAVE_STRCASESTR', cc.has_function('strcasestr'))
 conf_data.set('HAVE_STRLCAT', cc.has_function('strlcat', dependencies: libbsd_dep))
diff --git a/os/inputthread.c b/os/inputthread.c
index e6694afda..361d96efa 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -558,7 +558,11 @@ extern int InputThreadUnregisterDev(int fd)
 
 int xthread_sigmask(int how, const sigset_t *set, sigset_t *oldset)
 {
+#ifdef HAVE_SIGPROCMASK
     return sigprocmask(how, set, oldset);
+#else
+    return 0;
+#endif
 }
 
 #endif
diff --git a/os/utils.c b/os/utils.c
index f04bf8045..d1cd07ccc 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1281,7 +1281,7 @@ SmartScheduleInit(void)
 #endif
 }
 
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
 static sigset_t PreviousSignalMask;
 static int BlockedSignalCount;
 #endif
@@ -1289,7 +1289,7 @@ static int BlockedSignalCount;
 void
 OsBlockSignals(void)
 {
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
     if (BlockedSignalCount++ == 0) {
         sigset_t set;
 
@@ -1311,7 +1311,7 @@ OsBlockSignals(void)
 void
 OsReleaseSignals(void)
 {
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
     if (--BlockedSignalCount == 0) {
         xthread_sigmask(SIG_SETMASK, &PreviousSignalMask, 0);
     }
@@ -1321,7 +1321,7 @@ OsReleaseSignals(void)
 void
 OsResetSignals(void)
 {
-#ifdef SIG_BLOCK
+#ifdef HAVE_SIGPROCMASK
     while (BlockedSignalCount > 0)
         OsReleaseSignals();
     input_force_unlock();
commit 6c5d048095379a85f1862429b9049edc1c82e167
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Jul 28 14:09:51 2016 +0100

    os: Fix build of xserver_poll.c on MinGW
    
    Include winsock.h for definition of fd_set type and select()
    
    Future work: Maybe this also needs some error checking for fd > FD_SETSIZE?

diff --git a/os/xserver_poll.c b/os/xserver_poll.c
index f152cda21..1927dfa10 100644
--- a/os/xserver_poll.c
+++ b/os/xserver_poll.c
@@ -84,6 +84,10 @@
 #include <string.h>                          /* string functions */
 #include "xserver_poll.h"
 
+#if defined(WIN32) && !defined(__CYGWIN__)
+#include <X11/Xwinsock.h>
+#endif
+
 /*---------------------------------------------------------------------------*\
 				  Macros
 \*---------------------------------------------------------------------------*/
commit 246b729df87e94e405a8b257f34a22fa2719d30c
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date:   Thu Jul 28 14:26:38 2016 +0100

    configure: Force --disable-input-thread for MinGW
    
    I don't think an input thread can ever be useful on Windows.
    
    There is a pthread emulation, so having the thread itself isn't much of
    a problem.
    
    However, there is no device to wait on for Windows events, and even if
    we were to replace select() with WFMO, Windows wants to send events for
    a window to the thread which created that window.
    
    So, disable input thread by default for MinGW
    
    v2:
    Also add similar to meson.build

diff --git a/configure.ac b/configure.ac
index 5055d271d..215dd64fe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -791,6 +791,11 @@ if test "x$HAVE_RECURSIVE_MUTEX" = "xyes" ; then
 	THREAD_DEFAULT=yes
 fi
 
+case $host_os in
+	mingw*) THREAD_DEFAULT=no  ;;
+	*)
+esac
+
 AC_ARG_ENABLE(input-thread, AS_HELP_STRING([--enable-input-thread],
 	     [Enable input threads]),
 	     [INPUTTHREAD=$enableval], [INPUTTHREAD=$THREAD_DEFAULT])
diff --git a/include/meson.build b/include/meson.build
index 65781b7a0..527025b24 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -60,6 +60,9 @@ else
   if not enable_input_thread and get_option('input_thread') == 'true'
     error('Input thread enabled and PTHREAD_MUTEX_RECURSIVE not found')
   endif
+  if host_machine.system() == 'windows' and get_option('input_thread') == 'auto'
+      enable_input_thread = false
+  endif
 endif
 conf_data.set('HAVE_INPUTTHREAD', enable_input_thread)
 


More information about the xorg-commit mailing list