Module Name:    src
Committed By:   tsutsui
Date:           Mon Apr 29 15:34:57 UTC 2024

Modified Files:
        src/sys/arch/hp300/dev: diofb.c topcat.c

Log Message:
Move a check of topcat(4) specific fb width quirks to topcat.c.

We need to check fb->planes but it's propbed in topcat.c after
common diofb_fbinquire() is called.

Also add a comment that it looks these 1 bpp and 4 bpp boards have
VRAM with sparse address layout and we have to handle
512 pixels per line with 1024 bytes per line.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hp300/dev/diofb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hp300/dev/topcat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hp300/dev/diofb.c
diff -u src/sys/arch/hp300/dev/diofb.c:1.7 src/sys/arch/hp300/dev/diofb.c:1.8
--- src/sys/arch/hp300/dev/diofb.c:1.7	Sat Aug  7 16:18:53 2021
+++ src/sys/arch/hp300/dev/diofb.c	Mon Apr 29 15:34:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: diofb.c,v 1.7 2021/08/07 16:18:53 thorpej Exp $	*/
+/*	$NetBSD: diofb.c,v 1.8 2024/04/29 15:34:57 tsutsui Exp $	*/
 /*	$OpenBSD: diofb.c,v 1.18 2010/12/26 15:40:59 miod Exp $	*/
 
 /*
@@ -146,15 +146,6 @@ diofb_fbinquire(struct diofb *fb, int sc
 	if (fb->dheight > fb->fbheight)
 		fb->dheight = fb->fbheight;
 
-	/*
-	 * Some displays, such as the HP332 and HP340 internal video
-	 * appear to return a display width of 1024 instead of 512.
-	 */
-	if (fbr->num_planes == 1 || fbr->num_planes == 4) {
-		if (fb->dwidth == 1024 && fb->dheight == 400)
-			fb->dwidth = 512;
-	}
-
 	fb->planes = fbr->num_planes;
 	if (fb->planes > 8)
 		fb->planes = 8;

Index: src/sys/arch/hp300/dev/topcat.c
diff -u src/sys/arch/hp300/dev/topcat.c:1.6 src/sys/arch/hp300/dev/topcat.c:1.7
--- src/sys/arch/hp300/dev/topcat.c:1.6	Wed Nov 30 11:36:50 2022
+++ src/sys/arch/hp300/dev/topcat.c	Mon Apr 29 15:34:57 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: topcat.c,v 1.6 2022/11/30 11:36:50 tsutsui Exp $	*/
+/*	$NetBSD: topcat.c,v 1.7 2024/04/29 15:34:57 tsutsui Exp $	*/
 /*	$OpenBSD: topcat.c,v 1.15 2006/08/11 18:33:13 miod Exp $	*/
 
 /*
@@ -344,6 +344,19 @@ topcat_reset(struct diofb *fb, int scode
 		fb->planemask = (1 << fb->planes) - 1;
 	}
 
+	/*
+	 * Some displays, such as the HP332 and HP340 internal video
+	 * and HP98542/98543 appear to return a display width of 1024
+	 * instead of 512.
+	 * 
+	 * It looks these boards have VRAM with sparse address layout,
+	 * i.e. 1 bit or 4 bits per pixel but 2 bytes per pixel, so
+	 * we have to handle 512 pixels per line with 1024 bytes per line.
+	 */
+	if (fb->planes <= 4 && fb->dwidth == 1024 && fb->dheight == 400) {
+		fb->dwidth = 512;
+	}
+
 	fb->bmv = topcat_windowmove;
 	topcat_restore(fb);
 	diofb_fbsetup(fb);

Reply via email to