NetBSD Problem Report #12730

Received: (qmail 15050 invoked from network); 23 Apr 2001 23:42:51 -0000
Message-Id: <20010423234318.20B2F1110F@www.netbsd.org>
Date: Mon, 23 Apr 2001 16:43:18 -0700 (PDT)
From: vii@altern.org
Sender: nobody@netbsd.org
Reply-To: vii@altern.org
To: gnats-bugs@gnats.netbsd.org
Subject: rasops2 has a bad "stamp" so characters appear garbled on 2bpp fbs
X-Send-Pr-Version: www-1.0

>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:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 23 23:43:01 +0000 2001
>Closed-Date:    Sat May 22 00:35:14 +0000 2021
>Last-Modified:  Sat May 22 00:35:14 +0000 2021
>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:
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 22 May 2021 00:35:14 +0000
State-Changed-Why:
this patch seems to have already been applied at some point.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.