Instead of actually processing input in the handler, the conservative
path just raises enough of a dispatch exception to bomb out of request
processing and handle input instead.

Signed-off-by: Adam Jackson <[email protected]>
---
 configure.ac                   |    3 +++
 hw/xfree86/common/xf86Events.c |   34 ++++++++++++++++++++++++++--------
 include/xorg-config.h.in       |    3 +++
 3 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index c0bf98f..8ad773e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -606,6 +606,9 @@ AC_ARG_ENABLE(aiglx,          
AS_HELP_STRING([--enable-aiglx], [Build accelerate
 AC_ARG_ENABLE(glx-tls,        AS_HELP_STRING([--enable-glx-tls], [Build GLX 
with TLS support (default: disabled)]),
                                 [GLX_USE_TLS=$enableval],
                                 [GLX_USE_TLS=no])
+AC_ARG_ENABLE(conservative-sigio, 
AS_HELP_STRING([--enable-conservative-sigio], [Build conservative SIGIO handler 
(default: disabled)]),
+                               [CONSERVATIVE_SIGIO=$enableval],
+                               [CONSERVATIVE_SIGIO=no])
 
 dnl Extensions.
 AC_ARG_ENABLE(registry,       AS_HELP_STRING([--disable-registry], [Build 
string registry module (default: enabled)]), [XREGISTRY=$enableval], 
[XREGISTRY=yes])
diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 2e82848..34fb3cb 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -300,10 +300,30 @@ xf86SigioReadInput(int fd, void *closure)
     errno = errno_save;
 }
 
-/*
- * xf86AddEnabledDevice --
- *
- */
+#ifdef CONSERVATIVE_SIGIO
+
+static void
+time_to_yield(int fd, void *closure)
+{
+    isItTimeToYield = 1;
+}
+
+void
+xf86AddEnabledDevice(InputInfoPtr pInfo)
+{
+    xf86InstallSIGIOHandler(pInfo->fd, time_to_yield, NULL);
+    AddEnabledDevice(pInfo->fd);
+}
+
+void
+xf86RemoveEnabledDevice(InputInfoPtr pInfo)
+{
+    xf86RemoveSIGIOHandler(pInfo->fd);
+    RemoveEnabledDevice(pInfo->fd);
+}
+
+#else /* aggressive SIGIO */
+
 void
 xf86AddEnabledDevice(InputInfoPtr pInfo)
 {
@@ -312,10 +332,6 @@ xf86AddEnabledDevice(InputInfoPtr pInfo)
     }
 }
 
-/*
- * xf86RemoveEnabledDevice --
- *
- */
 void
 xf86RemoveEnabledDevice(InputInfoPtr pInfo)
 {
@@ -324,6 +340,8 @@ xf86RemoveEnabledDevice(InputInfoPtr pInfo)
     }
 }
 
+#endif
+
 static int *xf86SignalIntercept = NULL;
 
 void
diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
index 56ffda2..e3797d6 100644
--- a/include/xorg-config.h.in
+++ b/include/xorg-config.h.in
@@ -142,4 +142,7 @@
 /* Build with libdrm support */
 #undef WITH_LIBDRM
 
+/* Conservative SIGIO handler */
+#undef CONSERVATIVE_SIGIO
+
 #endif /* _XORG_CONFIG_H_ */
-- 
1.7.2.3

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to