Subject: xsrc/29123: X server virtual console switching
To: None <xsrc-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Cliff Wright <cliff@vixen.snipe444.org>
List: netbsd-bugs
Date: 01/25/2005 22:50:00
>Number:         29123
>Category:       xsrc
>Synopsis:       X server virtual console switching
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    xsrc-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 25 22:50:00 +0000 2005
>Originator:     Cliff Wright
>Release:        NetBSD 2.0
>Organization:
	
>Environment:
	
	
System: NetBSD vixen 2.0_BETA NetBSD 2.0_BETA (vixen) #0: Mon Oct 4 22:37:41 PDT 2004 cliff@vixen:/usr/src/sys/arch/i386/compile/vixen i386
Architecture: i386
Machine: i386
>Description:
	
	When multiple X servers are started using multiple virtual
	consoles (e.g. using the gdmflexiserver of the gdm package),
	a server may fail to switch to the new virtual console
	if the switch takes more than a second. 
	The 1 second timeout can be seen in the routine xf86OpenConsole
	(about line 257) in the file:
	xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c
	However their is a comment that FreeBSD no longer needed to use
	the code with the timeout, as an initial switch to the first
	virtual console is no longer needed, and thus a test for FreeBSD,
	which would skip that code was implemented. It appears to me that
	NetBSD also does not need the special switch code, so I patched the
	code for NetBSD (patch is below in Fix section). I do not know
	what version of NetBSD caused this requirement to be dropped,
	so put a test for version 1.6, but it may be earlier.

>How-To-Repeat:
	
	While an X server is running, start another on a different virtual
	console. Expect to see a new screen display. This may hang
	having switched to the first virtual console that typically has
	a text display. Large sceen size seems to result in longer switch
	times that may exceed the 1 second allowed for the switch.
>Fix:
	
--- xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c.orig	2004-03-05 06:29:17.000000000 -0800
+++ xsrc/xfree/xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c	2005-01-24 19:01:43.000000000 -0800
@@ -231,6 +231,7 @@
 #endif
 #if defined (SYSCONS_SUPPORT) || defined (PCVT_SUPPORT)
 	case SYSCONS:
+	case PCVT:
 	    /* as of FreeBSD 2.2.8, syscons driver does not need the #1 vt
 	     * switching anymore. Here we check for FreeBSD 3.1 and up.
 	     * Add cases for other *BSD that behave the same.
@@ -239,9 +240,10 @@
 	    if (strcmp(uts.sysname, "FreeBSD") == 0) {
 		i = atof(uts.release) * 100;
 		if (i >= 310) goto acquire_vt;
+	    } else if (strcmp(uts.sysname, "NetBSD") == 0) {
+		i = atof(uts.release) * 100;
+		if (i >= 160) goto acquire_vt;	/*XXX what below 1.6 works ? */
 	    }
-	    /* otherwise fall through */
-	case PCVT:
 	    /*
 	     * First activate the #1 VT.  This is a hack to allow a server
 	     * to be started while another one is active.  There should be

>Unformatted: