Subject: kern/12730: rasops2 has a bad "stamp" so characters appear garbled on 2bpp fbs
To: None <gnats-bugs@gnats.netbsd.org>
From: None <vii@altern.org>
List: netbsd-bugs
Date: 04/23/2001 16:43:18
>Number:         12730
>Category:       kern
>Synopsis:       rasops2 has a bad "stamp" so characters appear garbled on 2bpp fbs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 23 16:43:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     John Fremlin
>Release:        current
>Organization:
NA
>Environment:
NA
>Description:
rasops2.c is broken and prints garbled characters.
>How-To-Repeat:
Use a 2bpp framebuffer with rasops2
>Fix:
Index: README
===================================================================
RCS file: /pub/NetBSD-CVS/syssrc/sys/dev/rasops/README,v
retrieving revision 1.4
diff -u -r1.4 README
--- README	1999/10/07 09:04:10	1.4
+++ README	2001/04/23 23:42:05
@@ -9,12 +9,13 @@
 - There is no generic `putchar' function for 2bpp
 - Color handling for 2bpp is broken
 - copycols() from rasops_bitops.h is broken in right->left case
-- The stamp mutex is not particularly safe
+- The stamp mutex is not particularly safe. Further, you will bust the
+	stack if your compiler doesn't optimize tail calls into jumps.
 - 64-bit types are not used on machines that are 64-bit
 - We should never be doing reads/writes of less than 32-bits
 - Flags in attribute values are hardcoded
 - Need a manpage
-- Should handle multiple fonts simulatneously
+- Should handle multiple fonts simultaneously
 - Generate an `empty' box character when we have no match?
 - Use 'int' in lieu of 'int32' where we can
 - Compress some cases in rasops1.c
Index: rasops2.c
===================================================================
RCS file: /pub/NetBSD-CVS/syssrc/sys/dev/rasops/rasops2.c,v
retrieving revision 1.6
diff -u -r1.6 rasops2.c
--- rasops2.c	2000/06/13 13:36:57	1.6
+++ rasops2.c	2001/04/23 23:42:07
@@ -146,6 +146,7 @@
 		fs = 0;		/* shutup gcc */
 	} else {
 		uc -= ri->ri_font->firstchar;
+		
 		fr = (u_char *)ri->ri_font->data + uc * ri->ri_fontscale;
 		fs = ri->ri_font->stride;
 	}
@@ -248,10 +249,10 @@
 	stamp_attr = attr;
 
 	for (i = 0; i < 16; i++) {
-		stamp[i] = (i & 1 ? fg : bg);
-		stamp[i] |= (i & 2 ? fg : bg) << 2;
-		stamp[i] |= (i & 4 ? fg : bg) << 4;
-		stamp[i] |= (i & 8 ? fg : bg) << 6;
+		stamp[i] = (i & 1 ? fg : bg) << 6;
+		stamp[i] |= (i & 2 ? fg : bg) << 4;
+		stamp[i] |= (i & 4 ? fg : bg) << 2;
+		stamp[i] |= (i & 8 ? fg : bg);
 	}
 }
 
@@ -259,7 +260,7 @@
  * Put a single character. This is for 8-pixel wide fonts.
  */
 static void
-rasops2_putchar8(cookie, row, col, uc, attr)
+rasops2_putchar8(cookie, row, col, uc, attr) /* 8 pixels is 2 bytes */
 	void *cookie;
 	int row, col;
 	u_int uc;

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