Re: HP 9000 Series 332 support. Hardware request.

Andrew Gillham <[email protected]> Fri, 27 Sep 2013 16:15:10 -0700
Newsgroups gmane.os.netbsd.ports.hp300
Message-ID <CAM3EeKc60NRLJhCmx3NqGc8yNyG0NvasAawBRuPdbrUPEdNTag@mail.gmail.com>
On Fri, Sep 27, 2013 at 3:33 PM, Andrew Gillham <[email protected]> wrote:
>
> I will add the check for 'planes > 1' that David suggested and also
> adjust the width when the height is 400.
> Thanks!

I need to verify this is working correctly on the actual
monitor/keyboard but it attaches properly:
topcat0 at intio0 addr 0x560000: 512x400 monochrome HP98542 topcat frame buffer

Diff attached, comments welcome.

-Andrew
topcat.diff (application/octet-stream, 1.8 KB)
Index: diofb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/dev/diofb.c,v
retrieving revision 1.3
diff -u -r1.3 diofb.c
--- diofb.c	18 Feb 2011 19:15:43 -0000	1.3
+++ diofb.c	27 Sep 2013 23:11:55 -0000
@@ -146,6 +146,14 @@
 	if (fb->dheight > fb->fbheight)
 		fb->dheight = fb->fbheight;
 
+	/*
+	 * Some monochrome displays, such as the HP332 internal video
+	 * appear to return a display width of 1024 instead of 512.
+	 */
+	if (fbr->num_planes == 1 && fb->dheight == 400)
+		if (fb->dwidth == 1024)
+			fb->dwidth = 512;
+
 	fb->planes = fbr->num_planes;
 	if (fb->planes > 8)
 		fb->planes = 8;
Index: topcat.c
===================================================================
RCS file: /cvsroot/src/sys/arch/hp300/dev/topcat.c,v
retrieving revision 1.4
diff -u -r1.4 topcat.c
--- topcat.c	18 Feb 2011 19:15:43 -0000	1.4
+++ topcat.c	27 Sep 2013 23:11:55 -0000
@@ -274,7 +274,10 @@
 	case GID_TOPCAT:
 		switch (sc->sc_fb->planes) {
 		case 1:
-			fbname = "HP98544 topcat";
+			if (sc->sc_fb->dheight == 400)
+				fbname = "HP98542 topcat";
+			else
+				fbname = "HP98544 topcat";
 			break;
 		case 4:
 			if (sc->sc_fb->dheight == 400)
@@ -344,9 +347,10 @@
 	fb->bmv = topcat_windowmove;
 	topcat_restore(fb);
 	diofb_fbsetup(fb);
-	for (i = 0; i <= fb->planemask; i++)
-		topcat_setcolor(fb, i);
-
+	if (fb->planes > 1) {
+		for (i = 0; i <= fb->planemask; i++)
+			topcat_setcolor(fb, i);
+	}
 	return 0;
 }
 
@@ -398,8 +402,10 @@
 		fb->mapmode = *(u_int *)data;
 		if (fb->mapmode == WSDISPLAYIO_MODE_EMUL) {
 			topcat_restore(fb);
-			for (i = 0; i <= fb->planemask; i++)
-				topcat_setcolor(fb, i);
+			if (fb->planes > 1) {
+				for (i = 0; i <= fb->planemask; i++)
+					topcat_setcolor(fb, i);
+			}
 		}
 		return 0;
 	case WSDISPLAYIO_GINFO: