NetBSD Problem Report #36666

From mouse@Sparkle.Rodents.Montreal.QC.CA  Thu Jul 19 05:05:32 2007
Return-Path: <mouse@Sparkle.Rodents.Montreal.QC.CA>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id D58B863B93E
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 19 Jul 2007 05:05:31 +0000 (UTC)
Message-Id: <200707190505.BAA24133@Sparkle.Rodents.Montreal.QC.CA>
Date: Thu, 19 Jul 2007 01:05:26 -0400 (EDT)
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Reply-To: mouse@Rodents.Montreal.QC.CA
To: gnats-bugs@NetBSD.org
Subject: [dM] hpcfb space optimization code clears incorrectly
X-Send-Pr-Version: 3.95

>Number:         36666
>Category:       port-hpcmips
>Synopsis:       [dM] dev/hpc/hpcfb.c space optimization code incorrectly clears areas sometimes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-hpcmips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 19 05:10:00 +0000 2007
>Last-Modified:  Mon Jul 23 14:30:01 +0000 2007
>Originator:     der Mouse
>Release:        NetBSD 3.1
>Organization:
	Dis-
>Environment:
System: NetBSD Darkstar.Rodents.Montreal.QC.CA 3.1 NetBSD 3.1 (DARKSTAR) #11: Wed Jul 18 23:07:02 EDT 2007 mouse@Darkstar.Rodents.Montreal.QC.CA:/usr/src/sys/arch/hpcmips/compile/DARKSTAR hpcmips
Architecture: mipsel
Machine: hpcmips
hpcfb.c,v 1.31.2.1
>Description:
	Under some circumstances, the code in hpcfb.c that attempts to
	avoid rewriting stuff unnecessarily (mostly, the stuff using
	maxcol/spacecol) clears character cells incorrectly.
>How-To-Repeat:
	I've constructed files to demonstrate the bug.  This was
	observed with a text editor, on a file which I am not prepared
	to disclose the exact contents of, but it turns out that this
	obfuscated version works equally well to demonstrate the bug.

	$ uudecode -p > setup-stuff << \END
	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[,3-(&ULQ0!M;;6@;6S%`91M;,3LQ2`I4
	`
	end
	END
	$ uudecode -p > show-bug << \END
	begin 644 foo
	$&ULQ30``
	`
	end
	END

	Then, on a 106x36 hpcfb-driven display using "sun" emulation
	(in my case, a z50 display with a 6x13 font - a suitable font
	is enclosed below), "cat setup-stuff" will display a screenful
	of text.  Note the line near the middle reading
	"InfibulateTheGonkulator(1);".

	Then "cat setup-stuff show-bug".  As you can see by looking at
	it with (eg) hexdump, show-bug just scrolls the screen by one
	line.  Note that everything after the "The" on the line I
	pointed out above gets erased (incorrectly) by the scroll.

	Here's that 6x13 font, in the form of a (bzip2ed) .h file
	suitable for dropping into dev/wsfont/ (with suitable edits to
	wsfont.c and the kernel config, of course).

	begin 644 fixed6x13.h.bz2
	M0EIH.3%!62936=&4=M4`C$!?__0P?_______________________________
	M_____^`6WQ>`?/HF```!O@WT``%]#*%"@`"B.O0/'4[`KZ```.B0`!Z"(0`$
	MP``!`#0`T"#0E3:1@`3```$,`1H:,``C3(P`````31@``(TP"8!"E3]$R,>_
	M4J$GFIE,RH]/95/4_4:C:F0:9#1IA&@&`F@T:&3(:&3$9#1D&@-&0R-`-,$&
	M(,330:#1D:8(!B:80:))3]4T,C3$T-,GI-&1@0:&C$9,C:FGI&AD]33(,@9/
	M4]0R#`F@T--#30,FFAHTR&3:GJ9/4Q&@::#$#!-&0T`?J"$I*494-!H&@```
	M&1H#0!H!H`&0`,0!DT#09&@!H-`#$````TT&@T:/U$`#3T1Z3Q09*)H4R;*&
	MAZADT]0T--``T/4``'I-#(`T`-#3:AXB`:`R&CU-#30#3::F@9-`&C0#0`:9
	MJ`T#3U#(!252:2AH&DPT!H`)I@)I@`1I@C1B,3``$R8$P`09#)IA-,!,3`$P
	M`3)@"8$-,!&)IB,C3HU('1)!S)U=R$CDB.#A4'`8@IR5=&G<-S0!R<-PX`$N
	M`!FN$02\'TFJJVB"75'5NO\G5>W_SZN^J,=SL[U?,:W=K3>[]BZR.=V\%T<W
	M;:9`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2[MZ^HA
	M2ZV<BV2'*^A!+4K<Y7#:GPT&B"2U4J-\;N(<<=]:%%K/;J03Y!7U&18"()-'
	M/(%Q4ALOLE]`WV=Z2#$?*RTNVB%N=.&%-(]E:ZKQAB749<DQYGFB'T+2'/]"
	MKI[AW/SOO569X]6=F).$M<RY`>Z6$@V95H*T5K,Z$1E2"V$O"218+$+M#)9R
	M_'JQH%CJ-1-8O-W2LVU)J[F[41=O67UE'2Y=;L36%\#&'%B\!,&B+%LGA'8,
	MVUI@T.;<3"$\NC7?AGDK8R0:XVH4<F%27+?863ZL2]PHAD3&"E,=TDCI>J^I
	MF7U6KK&@E],M:EEQO">4_=G+S`,#J#9KL[S1AB[.\^8DE>U-1N[-KR8UF9H\
	MZ9P19YVJHEP80BTNR;&31S[47DV3LV.$H[5K3ZEGF[KB\]\K<K'/F>RZ68)H
	M:H*BAXH`BL/,V-6B(@4K(UD+@)O?MF/9*S\?!7!QGXXT+\.K1AP.*#>:B0TQ
	MOWB!%>.05D*7KM@&IN19,K=KOT%&-)8#DV%C;-:2D$!'4'\D"C+&D9+K11-\
	M=$"TY2='"]51$W(=S*KEFDD=V'Y\)QSTD%PR`+<>39CPP<452$53A64/<X)-
	MID?449(8D^U)<S/G0R!9NZX-IJ--N+=AAB9CXCI0W;-5!9Y=K@V^96-H!``B
	MKGLU*Z7E5+INDJKG,#KG1^@]>YKM?/.;4-.A;9.,LSJ@(0HA@(`#>,!"R"`8
	M"`#<W')AG6#+%&A'6TC@FEE*UODL'+4$RMDQH4;LF%`NEM;&SJFDQOD1I>,B
	CB(]%,6F2UI+IZX$B]G,M(Z(,8#`0``!_(7<D4X4)#1E';5#&
	`
	end

>Fix:
	The best I can offer right now is the hpcfb.c I'm using.  It
	actually has a number of changes:

	- Fixes this problem.  I've just ripped out all the whitespace
	   optimization code; it impairs speed, but I prefer slow to
	   broken.

	- Uses RI_CENTER, in case the font size does not divide the
	   screen size exactly (I'd rather have it centred than smushed
	   into the upper left).

	- Fixes a bug that prevents RI_CENTER from working right (see
	   the change "@@ -853,7 +852,9 @@" below).

	- Makes clearing the framebuffer clear the whole framebuffer,
	   even if some of it doesn't correspond to character
	   positions.

	I realize that this is not the most useful fix, but at the
	moment it's all I have to offer.  I've been meaning to write
	something better; if I do, I'll add it to this PR.

	In the meantime, the hpcfb.c I mentioned above is at
	ftp.rodents.montreal.qc.ca:/mouse/misc/hpcfb/interim-hpcfb.c.
	Enclosed here is a diff from hpcfb.c,v 1.31.2.1:

	--- hpcfb.c.stock	2007-07-18 23:02:14.000000000 -0400
	+++ hpcfb.c.mouse	2007-05-05 16:02:57.000000000 -0400
	@@ -109,8 +109,6 @@
	 };

	 struct hpcfb_tvrow {
	-	int maxcol;
	-	int spacecol;
	 	struct hpcfb_vchar col[HPCFB_MAX_COLUMN];
	 };

	@@ -448,6 +446,7 @@
	 #else
	 	ri->ri_flg = RI_CURSOR;
	 #endif
	+	ri->ri_flg |= RI_CENTER;
	 	switch (ri->ri_depth) {
	 	case 8:
	 		if (32 <= fbconf->hf_pack_width &&
	@@ -853,7 +852,9 @@
	 	/* switch screen to new one */
	 	dc->dc_state |= HPCFB_DC_CURRENT;
	 	dc->dc_state &= ~HPCFB_DC_ABORT;
	+	/* XXX not until "too dangerous" setting 6 lines above is enabled
	 	dc->dc_rinfo.ri_bits = dc->dc_fbaddr;
	+	*/
	 	sc->sc_dc = dc;

	 	/* redraw screen image */
	@@ -965,7 +966,6 @@
	 {
	 	struct hpcfb_tvrow *vscn = dc->dc_tvram;
	 	struct hpcfb_vchar *vc = &vscn[row].col[col];
	-	struct hpcfb_vchar *vcb;

	 	if (vscn == 0)
	 		return;
	@@ -978,14 +978,6 @@
	 		dc->dc_max_row = row;

	 #endif /* HPCFB_JUMP */
	-	if (vscn[row].maxcol +1 == col)
	-		vscn[row].maxcol = col;
	-	else if (vscn[row].maxcol < col) {
	-		vcb =  &vscn[row].col[vscn[row].maxcol+1];
	-		memset(vcb, 0,
	-		    sizeof(struct hpcfb_vchar)*(col-vscn[row].maxcol-1));
	-		vscn[row].maxcol = col;
	-	}
	 	vc->c = uc;
	 	vc->attr = attr;
	 	dc->dc_state &= ~HPCFB_DC_TDRAWING;
	@@ -1062,10 +1054,7 @@
	 #endif /* HPCFB_JUMP */

	 	memcpy(dvc, svc, ncols*sizeof(struct hpcfb_vchar));
	-	if (vscn[row].maxcol < srccol+ncols-1)
	-		vscn[row].maxcol = srccol+ncols-1;
	-	if (vscn[row].maxcol < dstcol+ncols-1)
	-		vscn[row].maxcol = dstcol+ncols-1;
	+
	 	dc->dc_state &= ~HPCFB_DC_TDRAWING;
	 #ifdef HPCFB_JUMP
	 	hpcfb_check_update(dc);
	@@ -1124,6 +1113,7 @@
	     int ncols, long attr)
	 {
	 	struct hpcfb_tvrow *vscn = dc->dc_tvram;
	+	struct hpcfb_tvrow *r;

	 	if (vscn == 0)
	 		return;
	@@ -1136,9 +1126,12 @@
	 		dc->dc_max_row = row;
	 #endif /* HPCFB_JUMP */

	-	vscn[row].maxcol = startcol-1;
	-	if (vscn[row].spacecol < startcol+ncols-1)
	-		vscn[row].spacecol = startcol+ncols-1;
	+	r = &vscn[row];
	+	for (;ncols>0;startcol++,ncols--) {
	+		r->col[startcol].c = ' ';
	+		r->col[startcol].attr = 0;
	+	}
	+
	 	dc->dc_state &= ~HPCFB_DC_TDRAWING;
	 #ifdef HPCFB_JUMP
	 	hpcfb_check_update(dc);
	@@ -1223,10 +1216,7 @@
	 	}

	 	for (i = 0; i < num; i++) {
	-		memcpy(&dvc->col[0], &svc->col[0], sizeof(struct hpcfb_vchar)*(svc->maxcol+1));
	-		if (svc->maxcol < dvc->maxcol && dvc->spacecol < dvc->maxcol)
	-			dvc->spacecol = dvc->maxcol;
	-		dvc->maxcol = svc->maxcol;
	+		memcpy(&dvc->col[0], &svc->col[0], sizeof(struct hpcfb_vchar)*dc->dc_cols);
	 		svc+=d;
	 		dvc+=d;
	 	}
	@@ -1244,7 +1234,6 @@
	 {
	 	struct hpcfb_devconfig *dc = (struct hpcfb_devconfig *)cookie;
	 	struct rasops_info *ri = &dc->dc_rinfo;
	-	int cols;
	 	struct hpcfb_tvrow *vscn = dc->dc_tvram;
	 	struct hpcfb_vchar *svc;
	 	int i, j;
	@@ -1272,6 +1261,20 @@
	 	if (ri->ri_bits == NULL)
	 		return;

	+	if (all) {
	+		/* Make sure we clear the whole framebuffer, even if
	+		   it's not all in use by characters.  XXX goes under
	+		   the hood of rasops allocattr in the way it extracts
	+		   the bg colour-- but so does hpcfb_putchar().... */
	+		long int attr;
	+		struct rasops_info *ri;
	+		hpcfb_allocattr(dc,WSCOL_WHITE,WSCOL_BLACK,0,&attr);
	+		ri = &dc->dc_rinfo;
	+		memset( dc->dc_fbaddr,
	+			ri->ri_devcmap[(attr>>16)&15],
	+			ri->ri_stride*ri->ri_height );
	+	}
	+
	 	dc->dc_state |= HPCFB_DC_DRAWING;
	 	dc->dc_state |= HPCFB_DC_TDRAWING;
	 	for (i = 0; i < num; i++) {
	@@ -1279,27 +1282,15 @@
	 			break;
	 		if ((dc->dc_state&HPCFB_DC_CURRENT) == 0)
	 			break;
	-		cols = vscn[row+i].maxcol;
	-		for (j = 0; j <= cols; j++) {
	+		svc = &vscn[row+i].col[0];
	+		for (j = 0; j < dc->dc_cols; j++) {
	 			if (dc->dc_state&HPCFB_DC_ABORT)
	 				continue;
	 			if ((dc->dc_state&HPCFB_DC_CURRENT) == 0)
	 				continue;
	-			svc = &vscn[row+i].col[j];
	 			rasops_emul.putchar(ri, row + i, j, svc->c, svc->attr);
	+			svc ++;
	 		}
	-		if (all)
	-			cols = dc->dc_cols-1;
	-		else
	-			cols = vscn[row+i].spacecol;
	-		for (; j <= cols; j++) {
	-			if (dc->dc_state&HPCFB_DC_ABORT)
	-				continue;
	-			if ((dc->dc_state&HPCFB_DC_CURRENT) == 0)
	-				continue;
	-			rasops_emul.putchar(ri, row + i, j, ' ', 0);
	-		}
	-		vscn[row+i].spacecol = 0;
	 	}
	 	if (dc->dc_state&HPCFB_DC_ABORT)
	 		dc->dc_state &= ~HPCFB_DC_ABORT;
	@@ -1446,8 +1437,9 @@
	 hpcfb_tv_eraserows(struct hpcfb_devconfig *dc, int row, int nrow, long attr)
	 {
	 	struct hpcfb_tvrow *vscn = dc->dc_tvram;
	-	int cols;
	 	int i;
	+	int j;
	+	struct hpcfb_vchar *svc;

	 	if (vscn == 0)
	 		return;
	@@ -1462,10 +1454,11 @@
	 #endif /* HPCFB_JUMP */

	 	for (i = 0; i < nrow; i++) {
	-		cols = vscn[row+i].maxcol;
	-		if (vscn[row+i].spacecol < cols)
	-			vscn[row+i].spacecol = cols;
	-		vscn[row+i].maxcol = -1;
	+		svc = &vscn[row+i].col[0];
	+		for (j = 0; j < dc->dc_cols; j ++) {
	+			svc[j].c = ' ';
	+			svc[j].attr = 0;
	+		}
	 	}
	 #ifdef HPCFB_JUMP
	 	hpcfb_check_update(dc);

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

>Audit-Trail:
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
To: gnats-bugs@NetBSD.org, port-hpcmips@NetBSD.org
Cc: 
Subject: Re: port-hpcmips/36666: [dM] hpcfb space optimization code clears incorrectly
Date: Sat, 21 Jul 2007 18:53:11 -0400 (EDT)

 Pursuant to port-hpcmips/36666, I've got a better hpcfb.c.  It scrolls
 both reasonably snappily and, as far as my tests can tell, correctly
 (which of course really just means I haven't yet tripped over any of
 the bugs it doubtless has).

 ftp.rodents.montreal.qc.ca:/mouse/misc/hpcfb/better-hpcfb.c is the new
 hpcfb.c.

 /~\ The ASCII				der Mouse
 \ / Ribbon Campaign
  X  Against HTML	       mouse@rodents.montreal.qc.ca
 / \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

From: "Andy Ruhl" <acruhl@gmail.com>
To: "der Mouse" <mouse@rodents.montreal.qc.ca>
Cc: gnats-bugs@netbsd.org, port-hpcmips@netbsd.org
Subject: Re: port-hpcmips/36666: [dM] hpcfb space optimization code clears incorrectly
Date: Mon, 23 Jul 2007 07:26:18 -0700

 On 7/21/07, der Mouse <mouse@rodents.montreal.qc.ca> wrote:
 > Pursuant to port-hpcmips/36666, I've got a better hpcfb.c.  It scrolls
 > both reasonably snappily and, as far as my tests can tell, correctly
 > (which of course really just means I haven't yet tripped over any of
 > the bugs it doubtless has).
 >
 > ftp.rodents.montreal.qc.ca:/mouse/misc/hpcfb/better-hpcfb.c is the new
 > hpcfb.c.

 I blindly ran off and assumed that this was patched against current,
 but it looks like it's for 3.1... A current kernel didn't build :)

 I built a 3.1 kernel with this patch and it seems to work pretty good.
 I did ls on a big directory and it seems to scroll quite a bit faster.

 This is on a NEC MobilePro 880.

 Thanks!

 Andy

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.