6879897 SIGIO input handlers should be disabled by default until SIGIO handler issues are fixed nv_126
authorAlan Coopersmith <Alan.Coopersmith@Sun.COM>
Mon, 12 Oct 2009 10:18:03 -0700
changeset 806 a0152e9c720d
parent 805 717bd05652fb
child 807 1f2628bfa0b0
6879897 SIGIO input handlers should be disabled by default until SIGIO handler issues are fixed
open-src/xserver/xorg/patch-list
open-src/xserver/xorg/sigio-disable.patch
--- a/open-src/xserver/xorg/patch-list	Mon Oct 12 10:18:03 2009 -0700
+++ b/open-src/xserver/xorg/patch-list	Mon Oct 12 10:18:03 2009 -0700
@@ -14,6 +14,7 @@
 cli-nobanner.patch
 catch-dlerrors.patch
 sigio.patch,-p1
+sigio-disable.patch,-p1
 make_xkm_output_dir.patch
 dtlogin-userinfo.patch
 IA.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/open-src/xserver/xorg/sigio-disable.patch	Mon Oct 12 10:18:03 2009 -0700
@@ -0,0 +1,246 @@
+[Adjusted to apply cleanly to 1.6.5]
+
+From e2c64551808988657069006f74c6780973ec0557 Mon Sep 17 00:00:00 2001
+From: Alan Coopersmith <[email protected]>
+Date: Tue, 15 Sep 2009 21:13:48 -0700
+Subject: [PATCH] Add configuration option for use of SIGIO handlers for input events
+
+Boolean option to enable/disable SIGIO handlers is set by the first
+of these found:
+  - UseSIGIO option is set in xorg.conf ServerFlags
+  - Default set at build time by ./configure --enable-use-sigio-by-default
+  - Platform default value: Solaris = no, all others = yes
+
+This matches the current settings on all platforms except Solaris.
+This reverts Solaris (for now) to the settings used in Xorg 1.6, before
+SIGIO support for Solaris was added, due to some system level bugs that
+won't be resolved in time for Xorg 1.7 release, but allows us to enable
+when those are resolved (or when we need to test if they're resolved).
+See http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6879897
+
+Signed-off-by: Alan Coopersmith <[email protected]>
+Signed-off-by: Peter Hutterer <[email protected]>
+---
+ configure.ac                         |   16 ++++++++++++++++
+ hw/xfree86/common/xf86Config.c       |   19 +++++++++++++++++++
+ hw/xfree86/common/xf86Helper.c       |    2 +-
+ hw/xfree86/common/xf86Privstr.h      |    2 ++
+ hw/xfree86/doc/man/xorg.conf.man.pre |    9 +++++++++
+ hw/xfree86/os-support/shared/sigio.c |    6 ++++++
+ include/xorg-config.h.in             |    3 +++
+ 7 files changed, 56 insertions(+), 1 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f6b91cd..f13ec5c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -379,7 +379,8 @@ AM_CONDITIONAL(PPC_VIDEO, [test "x$PPC_VIDEO" = xyes])
+ AM_CONDITIONAL(SPARC64_VIDEO, [test "x$SPARC64_VIDEO" = xyes])
+ 
+ DRI=no
+ KDRIVE_HW=no
++USE_SIGIO_BY_DEFAULT="yes"
+ dnl it would be nice to autodetect these *CONS_SUPPORTs
+ case $host_os in
+   *freebsd* | *dragonfly*)
+@@ -408,6 +409,9 @@ case $host_os in
+ 	;;
+   *solaris*)
+ 	PKG_CHECK_EXISTS(libdrm, DRI=yes, DRI=no)
++	# Disable use of SIGIO by default until some system bugs are
++	# fixed - see Sun/OpenSolaris bug id 6879897
++	USE_SIGIO_BY_DEFAULT="no"
+ 	;;
+   darwin*)
+ 	AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
+@@ -442,6 +446,9 @@
+ AC_ARG_ENABLE(debug,         AS_HELP_STRING([--enable-debug],
+ 				  [Enable debugging (default: disabled)]),
+ 			        [DEBUGGING=$enableval], [DEBUGGING=no])
++AC_ARG_ENABLE(sigio-default, AS_HELP_STRING([--enable-use-sigio-by-default]
++  [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
++                                [USE_SIGIO_BY_DEFAULT=$enableval], [])
+ AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
+ 				[INT10="$withval"],
+ 				[INT10="$DEFAULT_INT10"])
+@@ -756,6 +764,14 @@ fi
+ AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
+ CONFIG_LIB='$(top_builddir)/config/libconfig.la'
+ 
++if test "x$USE_SIGIO_BY_DEFAULT" = xyes; then
++	USE_SIGIO_BY_DEFAULT_VALUE=TRUE
++else
++	USE_SIGIO_BY_DEFAULT_VALUE=FALSE
++fi
++AC_DEFINE_UNQUOTED([USE_SIGIO_BY_DEFAULT], [$USE_SIGIO_BY_DEFAULT_VALUE],
++		   [Use SIGIO handlers for input device events by default])
++
+ AC_MSG_CHECKING([for glibc...])
+ AC_PREPROC_IFELSE([
+ #include <features.h>
+diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
+index 82c3993..0605f37 100644
+--- a/hw/xfree86/common/xf86Config.c
++++ b/hw/xfree86/common/xf86Config.c
+@@ -708,6 +708,7 @@ typedef enum {
+     FLAG_AUTO_ENABLE_DEVICES,
+     FLAG_GLX_VISUALS,
+     FLAG_DRI2,
++    FLAG_USE_SIGIO
+ } FlagValues;
+    
+ static OptionInfoRec FlagOptions[] = {
+@@ -765,6 +766,8 @@ static OptionInfoRec FlagOptions[] = {
+         {0}, FALSE },
+   { FLAG_DRI2,			"DRI2",				OPTV_BOOLEAN,
+ 	{0}, FALSE },
++  { FLAG_USE_SIGIO,		"UseSIGIO",			OPTV_BOOLEAN,
++	{0}, USE_SIGIO_BY_DEFAULT },
+   { -1,				NULL,				OPTV_NONE,
+ 	{0}, FALSE },
+ };
+@@ -832,6 +835,22 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
+ 	    xf86Msg(X_CONFIG, "Ignoring ABI Version\n");
+     }
+ 
++    if (xf86SIGIOSupported()) {
++	xf86GetOptValBool(FlagOptions, FLAG_USE_SIGIO, &xf86Info.useSIGIO);
++	if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) {
++	    from = X_CONFIG;
++	} else {
++	    from = X_DEFAULT;
++	}
++	if (!xf86Info.useSIGIO) {
++	    xf86Msg(from, "Disabling SIGIO handlers for input devices\n");
++	} else if (from == X_CONFIG) {
++	    xf86Msg(from, "Enabling SIGIO handlers for input devices\n");
++	}
++    } else {
++	xf86Info.useSIGIO = FALSE;
++    }
++
+     if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) {
+         xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES,
+                           &xf86Info.autoAddDevices);
+diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
+index 9a2468d..56ab266 100644
+--- a/hw/xfree86/common/xf86Helper.c
++++ b/hw/xfree86/common/xf86Helper.c
+@@ -2312,7 +2312,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
+      * yet.  Should handle this differently so that alternate async methods
+      * work correctly with this too.
+      */
+-    pScrn->silkenMouse = useSM && xf86SIGIOSupported();
++    pScrn->silkenMouse = useSM && xf86Info.useSIGIO && xf86SIGIOSupported();
+     if (serverGeneration == 1)
+ 	xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n",
+ 		   pScrn->silkenMouse ? "enabled" : "disabled");
+diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h
+index 26f822d..9982601 100644
+--- a/hw/xfree86/common/xf86Privstr.h
++++ b/hw/xfree86/common/xf86Privstr.h
+@@ -87,6 +87,8 @@ typedef struct {
+     Bool		miscModInDevEnabled;	/* Allow input devices to be
+ 						 * changed */
+     Bool		miscModInDevAllowNonLocal;
++    Bool		useSIGIO;		/* Use SIGIO for handling
++						   input device events */
+     Pix24Flags		pixmap24;
+     MessageType		pix24From;
+ #ifdef __i386__
+diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre
+index 35f3687..e3cbcf5 100644
+--- a/hw/xfree86/doc/man/xorg.conf.man.pre
++++ b/hw/xfree86/doc/man/xorg.conf.man.pre
+@@ -450,6 +450,15 @@ core file.
+ In general you never want to use this option unless you are debugging an __xservername__
+ server problem and know how to deal with the consequences.
+ .TP 7
++.BI "Option \*qUseSIGIO\*q  \*q" boolean \*q
++This controls whether the __xservername__ server requests that events from
++input devices be reported via a SIGIO signal handler (also known as SIGPOLL
++on some platforms), or only reported via the standard select(3) loop.
++The default behaviour is platform specific.   In general you do not want to
++use this option unless you are debugging the __xservername__ server, or
++working around a specific bug until it is fixed, and understand the
++consequences.
++.TP 7
+ .BI "Option \*qDontVTSwitch\*q  \*q" boolean \*q
+ This disallows the use of the
+ .BI Ctrl+Alt+F n
+diff --git a/hw/xfree86/os-support/shared/sigio.c b/hw/xfree86/os-support/shared/sigio.c
+index 44136cc..aed5654 100644
+--- a/hw/xfree86/os-support/shared/sigio.c
++++ b/hw/xfree86/os-support/shared/sigio.c
+@@ -145,6 +145,9 @@ xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *closure)
+     int blocked;
+     int installed = FALSE;
+ 
++    if (!xf86Info.useSIGIO)
++	return 0;
++
+     for (i = 0; i < MAX_FUNCS; i++)
+     {
+ 	if (!xf86SigIOFuncs[i].f)
+@@ -216,6 +219,9 @@ xf86RemoveSIGIOHandler(int fd)
+     int maxfd;
+     int ret;
+ 
++    if (!xf86Info.useSIGIO)
++	return 0;
++
+     max = 0;
+     maxfd = -1;
+     ret = 0;
+diff --git a/include/xorg-config.h.in b/include/xorg-config.h.in
+index d159420..794de7a 100644
+--- a/include/xorg-config.h.in
++++ b/include/xorg-config.h.in
+@@ -130,4 +130,7 @@
+ /* Path to text files containing PCI IDs */
+ #undef PCI_TXT_IDS_PATH
+ 
++/* Use SIGIO handlers for input device events by default */
++#undef USE_SIGIO_BY_DEFAULT
++
+ #endif /* _XORG_CONFIG_H_ */
+-- 
+1.5.6.5
+
+From 2edf967b00963559552d061bb98b15243d978279 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <[email protected]>
+Date: Thu, 17 Sep 2009 15:24:01 +1000
+Subject: [PATCH] xserver: SIGIO option handling was incorrect.
+
+reported by a user on #radeon when DRI1 broke.
+
+Signed-off-by: Dave Airlie <[email protected]>
+---
+ hw/xfree86/common/xf86Config.c |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
+index 0605f37..f5dc9f4 100644
+--- a/hw/xfree86/common/xf86Config.c
++++ b/hw/xfree86/common/xf86Config.c
+@@ -767,7 +767,7 @@ static OptionInfoRec FlagOptions[] = {
+   { FLAG_DRI2,			"DRI2",				OPTV_BOOLEAN,
+ 	{0}, FALSE },
+   { FLAG_USE_SIGIO,		"UseSIGIO",			OPTV_BOOLEAN,
+-	{0}, USE_SIGIO_BY_DEFAULT },
++	{0}, FALSE },
+   { -1,				NULL,				OPTV_NONE,
+ 	{0}, FALSE },
+ };
+@@ -836,7 +836,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
+     }
+ 
+     if (xf86SIGIOSupported()) {
+-	xf86GetOptValBool(FlagOptions, FLAG_USE_SIGIO, &xf86Info.useSIGIO);
++	xf86Info.useSIGIO = xf86ReturnOptValBool(FlagOptions, FLAG_USE_SIGIO, USE_SIGIO_BY_DEFAULT);
+ 	if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) {
+ 	    from = X_CONFIG;
+ 	} else {
+-- 
+1.5.6.5
+