Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hp300/dev Fix two problems on old topcat(4) framebu...



details:   https://anonhg.NetBSD.org/src/rev/6e05e03ee90c
branches:  trunk
changeset: 378517:6e05e03ee90c
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Apr 15 14:43:19 2021 +0000

description:
Fix two problems on old topcat(4) framebuffers found on HP332/340.

- Fix panic on monochrome framebuffers. They don't have palette registers.
  The problem was reported from Anders Gustafsson and also Andrew Gillham
  back in 2013:
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg000086.html
   https://mail-index.netbsd.org/port-hp300/2013/09/28/msg000087.html
- Fix incorrect framebuffer width of 98542/98544 framebuffers on HP332.
  Reported from Andrew Gillham (98542) as above and Chris Hanson (98543):
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg000083.html
   https://mail-index.netbsd.org/port-hp300/2020/05/01/msg000164.html

Worth to pullup to netbsd-9.

diffstat:

 sys/arch/hp300/dev/diofb.c  |  11 ++++++++++-
 sys/arch/hp300/dev/topcat.c |  15 +++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diffs (70 lines):

diff -r e32e0a446455 -r 6e05e03ee90c sys/arch/hp300/dev/diofb.c
--- a/sys/arch/hp300/dev/diofb.c        Thu Apr 15 09:05:24 2021 +0000
+++ b/sys/arch/hp300/dev/diofb.c        Thu Apr 15 14:43:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: diofb.c,v 1.4 2014/03/24 19:42:58 christos Exp $       */
+/*     $NetBSD: diofb.c,v 1.5 2021/04/15 14:43:19 tsutsui Exp $        */
 /*     $OpenBSD: diofb.c,v 1.18 2010/12/26 15:40:59 miod Exp $ */
 
 /*
@@ -146,6 +146,15 @@ 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;
diff -r e32e0a446455 -r 6e05e03ee90c sys/arch/hp300/dev/topcat.c
--- a/sys/arch/hp300/dev/topcat.c       Thu Apr 15 09:05:24 2021 +0000
+++ b/sys/arch/hp300/dev/topcat.c       Thu Apr 15 14:43:19 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: topcat.c,v 1.4 2011/02/18 19:15:43 tsutsui Exp $       */
+/*     $NetBSD: topcat.c,v 1.5 2021/04/15 14:43:19 tsutsui Exp $       */
 /*     $OpenBSD: topcat.c,v 1.15 2006/08/11 18:33:13 miod Exp $        */
 
 /*
@@ -274,7 +274,10 @@ topcat_end_attach(struct topcat_softc *s
        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)
@@ -413,8 +416,12 @@ topcat_ioctl(void *v, void *vs, u_long c
                *(u_int *)data = fb->ri.ri_stride;
                return 0;
        case WSDISPLAYIO_GETCMAP:
+               if (fb->planemask == 1)
+                       return EPASSTHROUGH;
                return diofb_getcmap(fb, (struct wsdisplay_cmap *)data);
        case WSDISPLAYIO_PUTCMAP:
+               if (fb->planemask == 1)
+                       return EPASSTHROUGH;
                return topcat_setcmap(fb, (struct wsdisplay_cmap *)data);
        case WSDISPLAYIO_GVIDEO:
        case WSDISPLAYIO_SVIDEO:
@@ -429,6 +436,10 @@ topcat_setcolor(struct diofb *fb, u_int 
 {
        volatile struct tcboxfb *tc = (struct tcboxfb *)fb->regkva;
 
+       /* No color map registers on monochrome framebuffers. */
+       if (fb->planemask == 1)
+               return;
+
        if (tc->regs.fbid != GID_TOPCAT) {
                tccm_waitbusy(tc);
                tc->plane_mask = 0xff;



Home | Main Index | Thread Index | Old Index