summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-12-08 11:37:51 -0800
committerKeith Packard <keithp@keithp.com>2016-05-26 16:07:54 -0700
commit30ac7567980a1eb79d084a63e0e74e1d9a3af673 (patch)
tree6864c1ea181723bf9bde36638193ca65e0f8929d /configure.ac
parent728c9570a05f03bd90343ff6f5b1a8fd3988864c (diff)
Create a threaded mechanism for input [v7]
The current SIGIO signal handler method, used at generation of input events, has a bunch of oddities. This patch introduces an alternative way using a thread, which is used to select() all input device file descriptors. A mutex was used to control the access to input structures by the main and input threads. Two pipes to emit alert events (such hotplug ones) and guarantee the proper communication between them was also used. Co-authored-by: Fernando Carrijo <fcarrijo@freedesktop.org> Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> v2: Fix non-Xorg link. Enable where supported by default. This also splits out the actual enabling of input threads to DDX-specific patches which follow v3: Make the input lock recursive v4: Use regular RECURSIVE_MUTEXes instead of rolling our own Respect the --disable-input-thread configuration option by providing stubs that expose the same API/ABI. Respond to style comments from Peter Hutterer. v5: use __func__ in inputthread debug and error mesages. Respond to style comments from Peter Hutterer. v6: use AX_PTHREAD instead of inlining pthread tests. Suggested by Emil Velikov <emil.l.velikov@gmail.com> v7: Use pthread_sigmask instead of sigprocmask when using threads Suggested by Adam Jackson <ajax@redhat.com> Signed-off-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac19
1 files changed, 19 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index c728d3007..6c96de2c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -832,6 +832,25 @@ SDK_REQUIRED_MODULES="$XPROTO $RANDRPROTO $RENDERPROTO $XEXTPROTO $INPUTPROTO $K
# Make SDK_REQUIRED_MODULES available for inclusion in xorg-server.pc
AC_SUBST(SDK_REQUIRED_MODULES)
+AC_CHECK_DECL([PTHREAD_MUTEX_RECURSIVE], [HAVE_RECURSIVE_MUTEX=yes], [HAVE_RECURSIVE_MUTEX=no], [[#include <pthread.h>]])
+
+THREAD_DEFAULT=no
+
+if test "x$HAVE_RECURSIVE_MUTEX" = "xyes" ; then
+ THREAD_DEFAULT=yes
+fi
+
+AC_ARG_ENABLE(input-thread, AS_HELP_STRING([--enable-input-thread],
+ [Enable input threads]),
+ [INPUTTHREAD=$enableval], [INPUTTHREAD=$THREAD_DEFAULT])
+
+if test "x$INPUTTHREAD" = "xyes" ; then
+ AX_PTHREAD(,AC_MSG_ERROR([threaded input requested but no pthread support has been found]))
+ SYS_LIBS="$SYS_LIBS $PTHREAD_LIBS"
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ AC_DEFINE(INPUTTHREAD, 1, [Use a separate input thread])
+fi
+
REQUIRED_MODULES="$FIXESPROTO $DAMAGEPROTO $XCMISCPROTO $XTRANS $BIGREQSPROTO $SDK_REQUIRED_MODULES"
dnl systemd socket activation