xserver: Branch 'master' - 13 commits

Keith Packard keithp at kemper.freedesktop.org
Wed Jan 27 14:25:12 PST 2010


 configure.ac                             |   34 +++++++++++++++++----
 cpprules.in                              |    1 
 doc/Makefile.am                          |   17 +---------
 glx/glapitemp.h                          |    2 -
 glx/glxdri2.c                            |    2 -
 glx/indirect_dispatch.h                  |    2 -
 glx/indirect_reqsize.h                   |    4 +-
 glx/indirect_size.h                      |    4 +-
 glx/indirect_size_get.c                  |    4 +-
 glx/indirect_size_get.h                  |    4 +-
 hw/xfree86/common/xf86Events.c           |   49 +++++++++++++------------------
 hw/xfree86/common/xf86cmap.c             |   31 +++++++++++--------
 hw/xfree86/modes/xf86Crtc.c              |    2 -
 hw/xfree86/os-support/bsd/bsd_VTsw.c     |    9 +++++
 hw/xfree86/os-support/sco/VTsw_sco.c     |   10 ++++++
 hw/xfree86/os-support/shared/VTsw_noop.c |    6 +++
 hw/xfree86/os-support/shared/VTsw_usl.c  |   11 ++++++
 hw/xfree86/os-support/solaris/sun_VTsw.c |   43 ++++++++++++++++++++++++---
 hw/xfree86/os-support/solaris/sun_init.c |   19 ++++++++----
 hw/xfree86/os-support/xf86_OSproc.h      |    1 
 os/log.c                                 |   11 ++++++
 21 files changed, 180 insertions(+), 86 deletions(-)

New commits:
commit b68f0204a2e4fa9d8884cbdd84b6a5df21d6b36e
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Wed Jan 27 09:10:41 2010 -0800

    xserver: require libdri 7.8.0 to build
    
    We depend on new DRI interfaces now, so require them in configure.ac.
    
    Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/configure.ac b/configure.ac
index d2623af..425db40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -773,7 +773,7 @@ REQUIRED_LIBS="xfont xau [pixman-1 >= 0.15.20]"
 dnl List of libraries that require a specific version
 LIBAPPLEWM="applewm >= 1.4"
 LIBDMX="dmx >= 1.0.99.1"
-LIBDRI="dri >= 7.1.0"
+LIBDRI="dri >= 7.8.0"
 LIBDRM="libdrm >= 2.3.0"
 LIBGL="gl >= 7.1.0"
 LIBXEXT="xext >= 1.0.99.4"
commit 003829072853546abd973266fe9b24d803f4f5cb
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Tue Jan 26 22:25:04 2010 -0800

    Avoid segfaults in XF86VidMode GammaRamp functions if randr_crtc is NULL
    
    Fixes crash when xscreensaver tries to use GammaRamp calls to fade out
    http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6915712
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c
index 08f557c..edd5ae9 100644
--- a/hw/xfree86/common/xf86cmap.c
+++ b/hw/xfree86/common/xf86cmap.c
@@ -1004,12 +1004,14 @@ xf86ChangeGammaRamp(
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 	RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
 
-	if (crtc->gammaSize != size)
-	    return BadValue;
+	if (crtc) {
+	    if (crtc->gammaSize != size)
+		return BadValue;
 
-	RRCrtcGammaSet(crtc, red, green, blue);
+	    RRCrtcGammaSet(crtc, red, green, blue);
 
-	return Success;
+	    return Success;
+	}
     }
 
     if(CMapScreenKey == NULL)
@@ -1077,7 +1079,8 @@ xf86GetGammaRampSize(ScreenPtr pScreen)
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 	RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
 
-	return crtc->gammaSize;
+	if (crtc)
+	    return crtc->gammaSize;
     }
 
     if(CMapScreenKey == NULL) return 0;
@@ -1106,17 +1109,19 @@ xf86GetGammaRamp(
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
 	RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
 
-	if (crtc->gammaSize < size)
-	    return BadValue;
+	if (crtc) {
+	    if (crtc->gammaSize < size)
+		return BadValue;
 
-	if (!RRCrtcGammaGet(crtc))
-	    return BadImplementation;
+	    if (!RRCrtcGammaGet(crtc))
+		return BadImplementation;
 
-	memcpy(red, crtc->gammaRed, size * sizeof(*red));
-	memcpy(green, crtc->gammaGreen, size * sizeof(*green));
-	memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
+	    memcpy(red, crtc->gammaRed, size * sizeof(*red));
+	    memcpy(green, crtc->gammaGreen, size * sizeof(*green));
+	    memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
 
-	return Success;
+	    return Success;
+	}
     }
 
     if(CMapScreenKey == NULL) 
commit 19d03d4f49e08442f58cf02240e3e6bab04633d2
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Tue Jan 26 20:15:49 2010 -0500

    doc: finish the removal of SecurityPolicy file man pages
    
    The variable was unassigned  but all the code was left in.
    
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/doc/Makefile.am b/doc/Makefile.am
index d3911c9..bee64b6 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,35 +1,24 @@
-appmandir = $(APP_MAN_DIR)
-filemandir = $(FILE_MAN_DIR)
 
 # Xserver.man covers options generic to all X servers built in this tree
 # (i.e. those handled in the os/utils.c options processing instead of in
 #  the DDX-level options processing)
+appmandir = $(APP_MAN_DIR)
 appman_PRE = Xserver.man.pre
-fileman_PRE =
 
 appman_PROCESSED = $(appman_PRE:man.pre=man)
-fileman_PROCESSED = $(fileman_PRE:man.pre=man)
-
 appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@)
-fileman_DATA = $(fileman_PRE:man.pre=@FILE_MAN_SUFFIX@)
-
-BUILT_SOURCES = $(appman_PROCESSED) $(fileman_PROCESSED)
 
-CLEANFILES = $(appman_PROCESSED) $(appman_DATA) \
-		$(fileman_PROCESSED) $(fileman_DATA)
+BUILT_SOURCES = $(appman_PROCESSED)
+CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
 
 include $(top_srcdir)/cpprules.in
 
 .man.$(APP_MAN_SUFFIX):
 	cp $< $@
 
-.man.$(FILE_MAN_SUFFIX):
-	cp $< $@
-
 EXTRAMANDEFS = -D__default_font_path__="`echo $(COMPILEDDEFAULTFONTPATH) | sed -e 's/,/, /g'`"
 
 # Docs about X server internals that we ship with source but don't install
 DEVEL_DOCS = smartsched
 
-
 EXTRA_DIST = $(DEVEL_DOCS) $(appman_PRE) $(fileman_PRE)
commit 7962c8f78964d460c76f76dda2795b971a8c2a94
Author: Gaetan Nadon <memsize at videotron.ca>
Date:   Tue Jan 26 20:02:13 2010 -0500

    man: add missing __datadir__ for Xserver XWin man pages
    
    The man pages display __datadir__/fonts/X11/... because __datadir__
    is missing in cpprules.in. Problem was introduced in commit:
    b54bc14ce0ae38c4863794bc3096ca86cdb23908
    when replacing __projectroot__ in the previous font path.
    
    Reviewed-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/cpprules.in b/cpprules.in
index 7219e36..2e0856b 100644
--- a/cpprules.in
+++ b/cpprules.in
@@ -36,6 +36,7 @@ MANDEFS = \
 	-D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \
 	-D__mandir__=$(mandir) \
 	-D__projectroot__=$(prefix) \
+	-D__datadir__=$(datadir) \
 	-D__xconfigfile__=$(__XCONFIGFILE__) \
 	-D__xconfigdir__=$(__XCONFIGDIR__) \
 	-D__xkbdir__=$(XKB_BASE_DIRECTORY) \
commit d2322b6309bf15a45002b42e7e6ba3d6b5bfa932
Author: Kok, Auke <auke-jan.h.kok at intel.com>
Date:   Wed Jan 27 11:34:45 2010 -0800

    xserver: Add timestamps to logfile output.
    
    Add timestamps in seconds derived from clock_monotonic to the log
    file.
    
    Signed-off-by: Auke Kok <auke-jan.h.kok at intel.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/os/log.c b/os/log.c
index e20b6d3..03dc11f 100644
--- a/os/log.c
+++ b/os/log.c
@@ -258,6 +258,14 @@ LogVWrite(int verb, const char *f, va_list args)
 {
     static char tmpBuffer[1024];
     int len = 0;
+    static Bool newline = TRUE;
+
+    if (newline) {
+	sprintf(tmpBuffer, "[%10.3f] ", GetTimeInMillis() / 1000.0);
+	len = strlen(tmpBuffer);
+	if (logFile)
+	    fwrite(tmpBuffer, len, 1, logFile);
+    }
 
     /*
      * Since a va_list can only be processed once, write the string to a
@@ -268,6 +276,7 @@ LogVWrite(int verb, const char *f, va_list args)
 	vsnprintf(tmpBuffer, sizeof(tmpBuffer), f, args);
 	len = strlen(tmpBuffer);
     }
+    newline = (tmpBuffer[len-1] == '\n');
     if ((verb < 0 || logVerbosity >= verb) && len > 0)
 	fwrite(tmpBuffer, len, 1, stderr);
     if ((verb < 0 || logFileVerbosity >= verb) && len > 0) {
commit 0b21a0416b4cb2c32da5e3fda05a0682eb97d56e
Merge: 1e6fd65... 837bd2b...
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Jan 27 14:14:15 2010 -0800

    Merge remote branch 'alanc/master'

commit 1e6fd65d0b95260253828678131885a4ec21c594
Author: Michael Vogt <mvo at ubuntu.com>
Date:   Mon Jan 25 18:41:20 2010 +0100

    xfree86/modes: only call gamma_set if its non NULL
    
    I ran accross a crash with xf86-video-nv-2.1.15 [1] and xserver
    1.7.3.901. It looks like the problem is that gamma_set is called even
    if that is NULL.
    
    [1] https://launchpad.net/bugs/494627
    
    Reviewed-By: Matthias Hopf <mhopf at suse.de>
    Signed-off-by: Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index d015c6a..573fe96 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -354,7 +354,7 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
     }
 
     /* Only upload when needed, to avoid unneeded delays. */
-    if (!crtc->active)
+    if (!crtc->active && crtc->funcs->gamma_set)
 	crtc->funcs->gamma_set(crtc, crtc->gamma_red, crtc->gamma_green,
                                             crtc->gamma_blue, crtc->gamma_size);
 
commit 0688dca044f966abc3da667f6d4e79e7cf47f996
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 21 10:31:04 2010 -0800

    dri2: Fix order of operations issue in __glXdriSwapEvent test.
    
    Clients would have received swap events regardless of asking for it.
    
    Signed-off-by: Eric Anholt <eric at anholt.net>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 69fd39b..0f998de 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -174,7 +174,7 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust,
     __GLXdrawable *drawable = data;
     xGLXBufferSwapComplete wire;
 
-    if (!drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK)
+    if (!(drawable->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
 	return;
 
     wire.type = __glXEventBase + GLX_BufferSwapComplete;
commit 837bd2bbc02b893f96861b48c1f02b7b8e7e3e48
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Fri Oct 16 22:32:15 2009 -0700

    Remove unbalanced ( from failure to move log error
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Reviewed-by: Dan Nicholson <dbn.lists at gmail.com>

diff --git a/os/log.c b/os/log.c
index 08fa1f2..e20b6d3 100644
--- a/os/log.c
+++ b/os/log.c
@@ -187,7 +187,7 @@ LogInit(const char *fname, const char *backup)
 		sprintf(oldLog, "%s%s", logFileName, suffix);
 		free(suffix);
 		if (rename(logFileName, oldLog) == -1) {
-		    FatalError("Cannot move old log file (\"%s\" to \"%s\"\n",
+		    FatalError("Cannot move old log file \"%s\" to \"%s\"\n",
 			       logFileName, oldLog);
 		}
 		free(oldLog);
commit 138d4c1670ebab435bf00627c97098a3a54b81a6
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Sat Jan 16 21:03:00 2010 -0800

    glx: Sun compilers now support some gcc __attribute__ values
    
    Sun cc 5.9 and later (__SUNPRO_C >= 0x590) support __attribute__
    calls for aligned, always_inline, noinline, pure, const, and malloc.
    
    This commit consists of the related updates to files that were
    regenerated by gl_XML.py in mesa after adding the __SUNPRO_C checks to it
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Signed-off-by: Brian Paul <brianp at vmware.com>

diff --git a/glx/glapitemp.h b/glx/glapitemp.h
index 09259f4..ddd67af 100644
--- a/glx/glapitemp.h
+++ b/glx/glapitemp.h
@@ -27,7 +27,7 @@
  */
 
 
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
 #    define HIDDEN  __attribute__((visibility("hidden")))
 #  else
 #    define HIDDEN
diff --git a/glx/indirect_dispatch.h b/glx/indirect_dispatch.h
index 014e417..6cc322c 100644
--- a/glx/indirect_dispatch.h
+++ b/glx/indirect_dispatch.h
@@ -28,7 +28,7 @@
 #if !defined( _INDIRECT_DISPATCH_H_ )
 #  define _INDIRECT_DISPATCH_H_
 
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
 #    define HIDDEN  __attribute__((visibility("hidden")))
 #  else
 #    define HIDDEN
diff --git a/glx/indirect_reqsize.h b/glx/indirect_reqsize.h
index 26211ee..05ad591 100644
--- a/glx/indirect_reqsize.h
+++ b/glx/indirect_reqsize.h
@@ -28,13 +28,13 @@
 #if !defined( _INDIRECT_REQSIZE_H_ )
 #  define _INDIRECT_REQSIZE_H_
 
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
 #    define HIDDEN  __attribute__((visibility("hidden")))
 #  else
 #    define HIDDEN
 #  endif
 
-#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #    define PURE __attribute__((pure))
 #  else
 #    define PURE
diff --git a/glx/indirect_size.h b/glx/indirect_size.h
index 9ba0bd6..af0919f 100644
--- a/glx/indirect_size.h
+++ b/glx/indirect_size.h
@@ -36,7 +36,7 @@
  * \author Ian Romanick <idr at us.ibm.com>
  */
 
-#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #    define PURE __attribute__((pure))
 #  else
 #    define PURE
@@ -48,7 +48,7 @@
 #    define FASTCALL
 #  endif
 
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
 #    define INTERNAL  __attribute__((visibility("internal")))
 #  else
 #    define INTERNAL
diff --git a/glx/indirect_size_get.c b/glx/indirect_size_get.c
index 80f81de..475aa58 100644
--- a/glx/indirect_size_get.c
+++ b/glx/indirect_size_get.c
@@ -32,7 +32,7 @@
 #include "indirect_util.h"
 #include "indirect_size.h"
 
-#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #    define PURE __attribute__((pure))
 #  else
 #    define PURE
@@ -44,7 +44,7 @@
 #    define FASTCALL
 #  endif
 
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
 #    define INTERNAL  __attribute__((visibility("internal")))
 #  else
 #    define INTERNAL
diff --git a/glx/indirect_size_get.h b/glx/indirect_size_get.h
index 4fcb55b..378baa6 100644
--- a/glx/indirect_size_get.h
+++ b/glx/indirect_size_get.h
@@ -36,7 +36,7 @@
  * \author Ian Romanick <idr at us.ibm.com>
  */
 
-#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+#  if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
 #    define PURE __attribute__((pure))
 #  else
 #    define PURE
@@ -48,7 +48,7 @@
 #    define FASTCALL
 #  endif
 
-#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
+#  if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))) && defined(__ELF__)
 #    define INTERNAL  __attribute__((visibility("internal")))
 #  else
 #    define INTERNAL
commit 79e7b0b875634d0f9e1a95232a4e38adf617bc14
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Sat Jan 16 10:45:32 2010 -0800

    Only enable kdrive input drivers on Linux by default
    
    Fixes build on non-Linux platforms by restoring the defaults to
    where they were before commit 6c2b3a4247d10a50699ffa6abb643c5e959eefa8,
    to only enable the Linux kbd, mouse & evdev drivers when building
    on Linux platforms.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/configure.ac b/configure.ac
index 8c1085b..a187452 100644
--- a/configure.ac
+++ b/configure.ac
@@ -641,9 +641,9 @@ AC_ARG_ENABLE(xephyr,         AS_HELP_STRING([--enable-xephyr], [Build the kdriv
 AC_ARG_ENABLE(xfake,          AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
 AC_ARG_ENABLE(xfbdev,         AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
 dnl kdrive options
-AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: enabled)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=yes])
-AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: enabled)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=yes])
-AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: enabled)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=yes])
+AC_ARG_ENABLE(kdrive-kbd,     AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
+AC_ARG_ENABLE(kdrive-mouse,   AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
+AC_ARG_ENABLE(kdrive-evdev,   AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
 
 
 dnl chown/chmod to be setuid root as part of build
@@ -1995,9 +1995,6 @@ XEPHYR_LIBS=
 XEPHYR_INCS=
 
 AM_CONDITIONAL(KDRIVE, [test x$KDRIVE = xyes])
-AM_CONDITIONAL(KDRIVE_KBD, test "x$KDRIVE_KBD" = xyes)
-AM_CONDITIONAL(KDRIVE_EVDEV, test "x$KDRIVE_EVDEV" = xyes)
-AM_CONDITIONAL(KDRIVE_MOUSE, test "x$KDRIVE_MOUSE" = xyes)
 
 if test "$KDRIVE" = yes; then
     AC_DEFINE(KDRIVESERVER,1,[Build Kdrive X server])
@@ -2072,6 +2069,26 @@ if test "$KDRIVE" = yes; then
 	*linux*)
 	    KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.la'
             KDRIVELINUX=yes
+	    if test "x$KDRIVE_EVDEV" = xauto; then
+		KDRIVE_EVDEV=yes
+	    fi
+	    if test "x$KDRIVE_KBD" = xauto; then
+		KDRIVE_KBD=yes
+	    fi
+	    if test "x$KDRIVE_MOUSE" = xauto; then
+		KDRIVE_MOUSE=yes
+	    fi
+	    ;;
+	*)
+	    if test "x$KDRIVE_EVDEV" = xauto; then
+		KDRIVE_EVDEV=no
+	    fi
+	    if test "x$KDRIVE_KBD" = xauto; then
+		KDRIVE_KBD=no
+	    fi
+	    if test "x$KDRIVE_MOUSE" = xauto; then
+		KDRIVE_MOUSE=no
+	    fi
 	    ;;
     esac
     KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.la'
@@ -2090,6 +2107,9 @@ AC_SUBST([KDRIVE_PURE_LIBS])
 AC_SUBST([KDRIVE_LOCAL_LIBS])
 AC_SUBST([KDRIVE_LIBS])
 AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
+AM_CONDITIONAL(KDRIVE_EVDEV, [test "x$KDRIVE_EVDEV" = xyes])
+AM_CONDITIONAL(KDRIVE_KBD,   [test "x$KDRIVE_KBD" = xyes])
+AM_CONDITIONAL(KDRIVE_MOUSE, [test "x$KDRIVE_MOUSE" = xyes])
 AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
 AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
 AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
commit 39ab474197bdad7d8e9ef496df2d61cbea39d370
Author: Alan Coopersmith <alan.coopersmith at sun.com>
Date:   Tue Dec 15 19:07:38 2009 -0800

    Move OS-specific VT key handler code from common to os-support
    
    Adds new function xf86Activate to the OS-specific *VTsw*.c files
    and calls it from xf86ProcessActionEvent
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>
    Tested-by: Tiago Vignatti <tiago.vignatti at nokia.com> (GNU/Linux)

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 8e6a15b..ebf03bf 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -194,55 +194,40 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
 	if (!xf86Info.dontZoom)
 	    xf86ZoomViewport(xf86Info.currentScreen, -1);
 	break;
-#if defined(VT_ACTIVATE)
     case ACTION_SWITCHSCREEN:
 	if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
 	    int vtno = *((int *) arg);
-#if defined(__SCO__) || defined(__UNIXWARE__)
-	    vtno--;
-#endif
-#if defined(sun)
-	    if (vtno == xf86Info.vtno) {
-		break;
-	    } else {
-		struct vt_stat state;
-		if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0)
-			break;
-
-		if ((state.v_state & (1 << vtno)) == 0)
-			break;
-	    }
 
-	    xf86Info.vtRequestsPending = TRUE;
-	    xf86Info.vtPendingNum = vtno;
-#else
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0)
-		ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
-#endif
+	    if (vtno != xf86Info.vtno) {
+		if (!xf86VTActivate(vtno)) {
+		    ErrorF("Failed to switch from vt%02d to vt%02d: %s\n",
+			   xf86Info.vtno, vtno, strerror(errno));
+		}
+	    }
 	}
 	break;
     case ACTION_SWITCHSCREEN_NEXT:
 	if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
-#if defined(__SCO__) || defined(__UNIXWARE__)
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
-#else
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno + 1) < 0)
-#endif
-#if defined (__SCO__) || (defined(sun) && defined (__i386__) && defined (SVR4)) || defined(__UNIXWARE__)
-		if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 0) < 0)
-#else
-		if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, 1) < 0)
-#endif
-		    ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+	    if (!xf86VTActivate(xf86Info.vtno + 1)) {
+		/* If first try failed, assume this is the last VT and
+		 * try wrapping around to the first vt.
+		 */
+		if (!xf86VTActivate(1)) {
+		    ErrorF("Failed to switch from vt%02d to next vt: %s\n",
+			   xf86Info.vtno, strerror(errno));
+		}
+	    }
 	}
 	break;
     case ACTION_SWITCHSCREEN_PREV:
 	if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
-	    if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno - 1) < 0)
-		ErrorF("Failed to switch consoles (%s)\n", strerror(errno));
+	    if (!xf86VTActivate(xf86Info.vtno - 1)) {
+		/* Don't know what the maximum VT is, so can't wrap around */
+		ErrorF("Failed to switch from vt%02d to previous vt: %s\n",
+		       xf86Info.vtno, strerror(errno));
+	    }
 	}
 	break;
-#endif
     default:
 	break;
     }
diff --git a/hw/xfree86/os-support/bsd/bsd_VTsw.c b/hw/xfree86/os-support/bsd/bsd_VTsw.c
index 476a0e9..4842be5 100644
--- a/hw/xfree86/os-support/bsd/bsd_VTsw.c
+++ b/hw/xfree86/os-support/bsd/bsd_VTsw.c
@@ -92,3 +92,12 @@ xf86VTSwitchTo()
 #endif
 	return(TRUE);
 }
+
+Bool
+xf86VTActivate(int vtno)
+{
+	if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
+		return(FALSE);
+	}
+	return(TRUE);
+}
diff --git a/hw/xfree86/os-support/sco/VTsw_sco.c b/hw/xfree86/os-support/sco/VTsw_sco.c
index d126e78..0a59fb9 100644
--- a/hw/xfree86/os-support/sco/VTsw_sco.c
+++ b/hw/xfree86/os-support/sco/VTsw_sco.c
@@ -115,3 +115,13 @@ xf86VTSwitchTo(void)
     return TRUE;
   }
 }
+
+Bool
+xf86VTActivate(int vtno)
+{
+	if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno - 1) < 0) {
+		return(FALSE);
+	}
+
+	return(TRUE);
+}
diff --git a/hw/xfree86/os-support/shared/VTsw_noop.c b/hw/xfree86/os-support/shared/VTsw_noop.c
index 78cbe0e..3425840 100644
--- a/hw/xfree86/os-support/shared/VTsw_noop.c
+++ b/hw/xfree86/os-support/shared/VTsw_noop.c
@@ -52,3 +52,9 @@ xf86VTSwitchTo(void)
 {
 	return(TRUE);
 }
+
+Bool
+xf86VTActivate(int vtno)
+{
+	return(TRUE);
+}
diff --git a/hw/xfree86/os-support/shared/VTsw_usl.c b/hw/xfree86/os-support/shared/VTsw_usl.c
index 9308640..393f1c0 100644
--- a/hw/xfree86/os-support/shared/VTsw_usl.c
+++ b/hw/xfree86/os-support/shared/VTsw_usl.c
@@ -88,3 +88,14 @@ xf86VTSwitchTo(void)
 		return(TRUE);
 	}
 }
+
+Bool
+xf86VTActivate(int vtno)
+{
+#ifdef VT_ACTIVATE
+	if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno) < 0) {
+		return(FALSE);
+	}
+#endif
+	return(TRUE);
+}
diff --git a/hw/xfree86/os-support/solaris/sun_VTsw.c b/hw/xfree86/os-support/solaris/sun_VTsw.c
index 7f4e08e..1e2774b 100644
--- a/hw/xfree86/os-support/solaris/sun_VTsw.c
+++ b/hw/xfree86/os-support/solaris/sun_VTsw.c
@@ -118,3 +118,20 @@ xf86VTSwitchTo(void)
 		return(TRUE);
 	}
 }
+
+Bool
+xf86VTActivate(int vtno)
+{
+	struct vt_stat state;
+
+	if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0)
+		return(FALSE);
+
+	if ((state.v_state & (1 << vtno)) == 0)
+		return(FALSE);
+
+	xf86Info.vtRequestsPending = TRUE;
+	xf86Info.vtPendingNum = vtno;
+
+	return(TRUE);
+}
diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h
index c1a1173..f0cb768 100644
--- a/hw/xfree86/os-support/xf86_OSproc.h
+++ b/hw/xfree86/os-support/xf86_OSproc.h
@@ -199,6 +199,7 @@ extern _X_EXPORT Bool xf86SIGIOSupported (void);
 typedef void (*PMClose)(void);
 extern _X_EXPORT void xf86OpenConsole(void);
 extern _X_EXPORT void xf86CloseConsole(void);
+extern _X_HIDDEN Bool xf86VTActivate(int vtno);
 extern _X_EXPORT Bool xf86VTSwitchPending(void);
 extern _X_EXPORT Bool xf86VTSwitchAway(void);
 extern _X_EXPORT Bool xf86VTSwitchTo(void);
commit 15ca3312c069526b7f2207de9dfb9b9e851caf95
Author: Aaron Zang <Aaron.Zang at Sun.COM>
Date:   Mon Dec 14 17:55:46 2009 -0800

    Solaris: Avoid switching to inactive VT's
    
    Fix for OpenSolaris bug 6876992: "[vconsole] Ctrl+Alt+F12 switchs to blank
    console screen with hotkeys property turned-off"
    http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6876992
    
    Xorg needs to do sanity test for the VT it is commanded to switch to.
    If the VT is not opened by any process, discard the switching request.
    
    The changes also contain the fix for some flaws discovered when
    getting the new gdm to run.
    
    Signed-off-by: Aaron Zang <Aaron.Zang at Sun.COM>
    Signed-off-by: Alan Coopersmith <alan.coopersmith at sun.com>

diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c
index 8cd765a..8e6a15b 100644
--- a/hw/xfree86/common/xf86Events.c
+++ b/hw/xfree86/common/xf86Events.c
@@ -202,8 +202,16 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
 	    vtno--;
 #endif
 #if defined(sun)
-	    if (vtno == xf86Info.vtno)
+	    if (vtno == xf86Info.vtno) {
 		break;
+	    } else {
+		struct vt_stat state;
+		if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &state) < 0)
+			break;
+
+		if ((state.v_state & (1 << vtno)) == 0)
+			break;
+	    }
 
 	    xf86Info.vtRequestsPending = TRUE;
 	    xf86Info.vtPendingNum = vtno;
diff --git a/hw/xfree86/os-support/solaris/sun_VTsw.c b/hw/xfree86/os-support/solaris/sun_VTsw.c
index ded2f27..7f4e08e 100644
--- a/hw/xfree86/os-support/solaris/sun_VTsw.c
+++ b/hw/xfree86/os-support/solaris/sun_VTsw.c
@@ -38,17 +38,27 @@
  * Handle the VT-switching interface for Solaris/OpenSolaris
  */
 
+static int xf86VTPruneDoor = 0;
+
 void
-xf86VTRequest(int sig)
+xf86VTRelease(int sig)
 {
-	if (xf86Info.vtPendingNum != -1)
+	if (xf86Info.vtPendingNum == -1)
 	{
-		ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
-		xf86Info.vtPendingNum = -1;
-
+		xf86VTPruneDoor = 1;
+		xf86Info.vtRequestsPending = TRUE;
 		return;
 	}
 
+	ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
+	xf86Info.vtPendingNum = -1;
+
+	return;
+}
+
+void
+xf86VTAcquire(int sig)
+{
 	xf86Info.vtRequestsPending = TRUE;
 	return;
 }
@@ -68,6 +78,12 @@ xf86VTSwitchAway(void)
 
 	xf86Info.vtRequestsPending = FALSE;
 
+	if (xf86VTPruneDoor) {
+		xf86VTPruneDoor = 0;
+		ioctl(xf86Info.consoleFd, VT_RELDISP, 1);
+		return (TRUE);
+	}
+
 	vt_door_arg.vt_ev = VT_EV_HOTKEYS;
 	vt_door_arg.vt_num = xf86Info.vtPendingNum;
 	door_arg.data_ptr = (char *)&vt_door_arg;
diff --git a/hw/xfree86/os-support/solaris/sun_init.c b/hw/xfree86/os-support/solaris/sun_init.c
index 2c569f0..5846866 100644
--- a/hw/xfree86/os-support/solaris/sun_init.c
+++ b/hw/xfree86/os-support/solaris/sun_init.c
@@ -39,6 +39,8 @@ static Bool Protect0 = FALSE;
 static int VTnum = -1;
 static int xf86StartVT = -1;
 static int vtEnabled = 0;
+extern void xf86VTAcquire(int);
+extern void xf86VTRelease(int);
 #endif
 
 /* Device to open as xf86Info.consoleFd */
@@ -137,7 +139,8 @@ xf86OpenConsole(void)
 	    else
 	    {
 		if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
-		    (xf86Info.vtno == -1)) {
+		    (xf86Info.vtno == -1))
+		{
 		    FatalError("xf86OpenConsole: Cannot find a free VT\n");
 		}
 	    }
@@ -146,7 +149,8 @@ xf86OpenConsole(void)
 	    snprintf(consoleDev, PATH_MAX, "/dev/vt/%d", xf86Info.vtno);
 	}
 
-	if (fd != -1) {
+	if (fd != -1)
+	{
 	    close(fd);
 	}
 
@@ -178,11 +182,12 @@ xf86OpenConsole(void)
 	    if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
 		FatalError("xf86OpenConsole: VT_GETMODE failed\n");
 
-	    OsSignal(SIGUSR1, xf86VTRequest);
+	    OsSignal(SIGUSR1, xf86VTAcquire);
+	    OsSignal(SIGUSR2, xf86VTRelease);
 
 	    VT.mode = VT_PROCESS;
-	    VT.relsig = SIGUSR1;
 	    VT.acqsig = SIGUSR1;
+	    VT.relsig = SIGUSR2;
 
 	    if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
 		FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
@@ -204,7 +209,8 @@ xf86OpenConsole(void)
     else /* serverGeneration != 1 */
     {
 #ifdef HAS_USL_VTS
-	if (vtEnabled) {
+	if (vtEnabled)
+	{
 	    /*
 	     * Now re-get the VT
 	     */
@@ -285,7 +291,8 @@ xf86CloseConsole(void)
 #endif
 
 #ifdef HAS_USL_VTS
-    if (vtEnabled == 1) {
+    if (vtEnabled)
+    {
 	if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
 	{
 	    VT.mode = VT_AUTO;		/* Set default vt handling */


More information about the xorg-commit mailing list