Subject: port-i386/10965: wscons problems with 80x24 vga consoles
To: None <gnats-bugs@gnats.netbsd.org>
From: None <lukem@netbsd.org>
List: netbsd-bugs
Date: 09/06/2000 14:15:17
>Number:         10965
>Category:       port-i386
>Synopsis:       wscons has problems with 80x24 vga consoles
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 06 14:16:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Luke Mewburn
>Release:        NetBSD 1.5_ALPHA2 (& current)
>Organization:
	NetBSD Foundation
>Environment:
System: NetBSD argo.akimbo.com.au 1.5_ALPHA NetBSD 1.5_ALPHA (ARGO) #0: Mon Jul 17 22:43:41 EST 2000 lukem@argo.akimbo.com.au:/z/src/netbsd-1-5/src/sys/arch/i386/compile/ARGO i386

>Description:
	I notice that support has been added for 80x24 screens as well as
	80x25 screens. This is a good thing, and appears to work for any
	virtual screens other than the initial console.

	However, when I tried to hack the code so that 80x24 was the default,
	I ran into a problem I had when I first tried this a while ago, namely
	that line 25 appears to fill with garbage, on all of the virtual
	desktops. Further testing reveals that the `garbage' is approximately
	line 178 in the scrollback of the first desktop (aka the console).

	FYI: my modification involves a #define which allows you to set
	WSCONS_DEFAULT_TYPE to another value, such as "80x24" (defaults to
	"80x25").  I have attached a diff of of what I've done so far. 
	Whilst this currently almost works (modulo the problem above), I
	suspect it will fail if a size with a font other than 8x16 is used. 
	Maybe there a way that things can be changed so if the user uses
	"80x50" the correct thing occurs (in that the appropriate font
	is switched in as well)?

	PS: I have hard-coded WSCONS_DEFAULT_TYPE to "80x24" for my own
	testing. There is no reason that this couldn't just be a kernel
	config(1) option.

>How-To-Repeat:
	Apply my patch below (or any other mod to make the
	vga_stdscreen 80x24 instead of 80x25).

	Reboot, and notice that you're getting garbage from the
	scrollback appear in line 25 of the screen.

	Run `jot 178' and notice that the scrollback will start to
	cycle through line 25 on the screen, and notice that the 
	offset appears to be 178 lines.

>Fix:
	Not sure...
	Need a wscons / vga hacker to investigate

Index: ic/vga.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/vga.c,v
retrieving revision 1.28.2.3
diff -p -r1.28.2.3 vga.c
*** ic/vga.c	2000/08/31 17:05:58	1.28.2.3
--- ic/vga.c	2000/09/05 02:20:43
*************** static unsigned char fgansitopc[] = {
*** 162,178 ****
  #endif
  };
  
! const struct wsscreen_descr vga_stdscreen = {
  	"80x25", 80, 25,
  	&vga_emulops,
  	8, 16,
  	WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_BLINK
! }, vga_stdscreen_mono = {
  	"80x25", 80, 25,
  	&vga_emulops,
  	8, 16,
  	WSSCREEN_HILIT | WSSCREEN_UNDERLINE | WSSCREEN_BLINK | WSSCREEN_REVERSE
! }, vga_stdscreen_bf = {
  	"80x25bf", 80, 25,
  	&vga_emulops,
  	8, 16,
--- 162,178 ----
  #endif
  };
  
! const struct wsscreen_descr vga_25lscreen = {
  	"80x25", 80, 25,
  	&vga_emulops,
  	8, 16,
  	WSSCREEN_WSCOLORS | WSSCREEN_HILIT | WSSCREEN_BLINK
! }, vga_25lscreen_mono = {
  	"80x25", 80, 25,
  	&vga_emulops,
  	8, 16,
  	WSSCREEN_HILIT | WSSCREEN_UNDERLINE | WSSCREEN_BLINK | WSSCREEN_REVERSE
! }, vga_25lscreen_bf = {
  	"80x25bf", 80, 25,
  	&vga_emulops,
  	8, 16,
*************** const struct wsscreen_descr vga_stdscree
*** 227,234 ****
  #define VGA_SCREEN_CANTWOFONTS(type) (!((type)->capabilities & WSSCREEN_HILIT))
  
  const struct wsscreen_descr *_vga_scrlist[] = {
! 	&vga_stdscreen,
! 	&vga_stdscreen_bf,
  	&vga_40lscreen,
  	&vga_40lscreen_bf,
  	&vga_50lscreen,
--- 227,234 ----
  #define VGA_SCREEN_CANTWOFONTS(type) (!((type)->capabilities & WSSCREEN_HILIT))
  
  const struct wsscreen_descr *_vga_scrlist[] = {
! 	&vga_25lscreen,
! 	&vga_25lscreen_bf,
  	&vga_40lscreen,
  	&vga_40lscreen_bf,
  	&vga_50lscreen,
*************** const struct wsscreen_descr *_vga_scrlis
*** 237,243 ****
  	&vga_24lscreen_bf,
  	/* XXX other formats, graphics screen? */
  }, *_vga_scrlist_mono[] = {
! 	&vga_stdscreen_mono,
  	&vga_40lscreen_mono,
  	&vga_50lscreen_mono,
  	&vga_24lscreen_mono,
--- 237,243 ----
  	&vga_24lscreen_bf,
  	/* XXX other formats, graphics screen? */
  }, *_vga_scrlist_mono[] = {
! 	&vga_25lscreen_mono,
  	&vga_40lscreen_mono,
  	&vga_50lscreen_mono,
  	&vga_24lscreen_mono,
*************** vga_init(vc, iot, memt)
*** 517,523 ****
  	vc->nscreens = 0;
  	LIST_INIT(&vc->screens);
  	vc->active = NULL;
! 	vc->currenttype = vh->vh_mono ? &vga_stdscreen_mono : &vga_stdscreen;
  	callout_init(&vc->vc_switch_callout);
  
  	vc->vc_fonts[0] = &vga_builtinfont;
--- 517,533 ----
  	vc->nscreens = 0;
  	LIST_INIT(&vc->screens);
  	vc->active = NULL;
! 
! #define WSCONS_DEFAULT_TYPE	"80x24"
! #ifndef WSCONS_DEFAULT_TYPE
! #define WSCONS_DEFAULT_TYPE	"80x25"
! #endif
! 	vc->currenttype = wsdisplay_screentype_pick(vh->vh_mono ?
! 	    &vga_screenlist_mono : &vga_screenlist, WSCONS_DEFAULT_TYPE);
! 	if (vc->currenttype == NULL)
! 		panic("vga_init: unknown screen type `%s'",
! 		    WSCONS_DEFAULT_TYPE);
! 
  	callout_init(&vc->vc_switch_callout);
  
  	vc->vc_fonts[0] = &vga_builtinfont;
Index: wscons/wsdisplay.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsdisplay.c,v
retrieving revision 1.37.4.1
diff -p -r1.37.4.1 wsdisplay.c
*** wscons/wsdisplay.c	2000/06/30 16:27:53	1.37.4.1
--- wscons/wsdisplay.c	2000/09/05 02:20:50
*************** struct wsscreen *wsscreen_attach __P((st
*** 101,108 ****
  				      const struct wsscreen_descr *, void *,
  				      int, int, long));
  void wsscreen_detach __P((struct wsscreen *));
- static const struct wsscreen_descr *
- wsdisplay_screentype_pick __P((const struct wsscreen_list *, const char *));
  int wsdisplay_addscreen __P((struct wsdisplay_softc *, int, const char *, const char *));
  static void wsdisplay_shutdownhook __P((void *));
  static void wsdisplay_addscreen_print __P((struct wsdisplay_softc *, int, int));
--- 101,106 ----
*************** wsscreen_detach(scr)
*** 298,304 ****
  	free(scr, M_DEVBUF);
  }
  
! static const struct wsscreen_descr *
  wsdisplay_screentype_pick(scrdata, name)
  	const struct wsscreen_list *scrdata;
  	const char *name;
--- 296,302 ----
  	free(scr, M_DEVBUF);
  }
  
! const struct wsscreen_descr *
  wsdisplay_screentype_pick(scrdata, name)
  	const struct wsscreen_list *scrdata;
  	const char *name;
Index: wscons/wsdisplayvar.h
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/wscons/wsdisplayvar.h,v
retrieving revision 1.14.4.1
diff -p -r1.14.4.1 wsdisplayvar.h
*** wscons/wsdisplayvar.h	2000/06/30 16:27:53	1.14.4.1
--- wscons/wsdisplayvar.h	2000/09/05 02:20:50
*************** int wsdisplay_cfg_ioctl __P((struct wsdi
*** 198,200 ****
--- 198,202 ----
   * for general use
   */
  void wsdisplay_switchtoconsole __P((void));
+ const struct wsscreen_descr *
+     wsdisplay_screentype_pick __P((const struct wsscreen_list *, const char *));

>Release-Note:
>Audit-Trail:
>Unformatted: