Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus - make colour depth in fb mode configurable, de...



details:   https://anonhg.NetBSD.org/src/rev/b925a675b731
branches:  trunk
changeset: 378079:b925a675b731
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Jul 19 10:22:15 2023 +0000

description:
- make colour depth in fb mode configurable, default to 8bit
- support ioctl(FBIO*CMAP)

diffstat:

 sys/dev/sbus/files.sbus |   3 ++-
 sys/dev/sbus/mgx.c      |  34 ++++++++++++++++++++++++++++++----
 2 files changed, 32 insertions(+), 5 deletions(-)

diffs (86 lines):

diff -r 2e7529ba6868 -r b925a675b731 sys/dev/sbus/files.sbus
--- a/sys/dev/sbus/files.sbus   Tue Jul 18 16:59:57 2023 +0000
+++ b/sys/dev/sbus/files.sbus   Wed Jul 19 10:22:15 2023 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sbus,v 1.44 2019/05/08 13:40:19 isaki Exp $
+#      $NetBSD: files.sbus,v 1.45 2023/07/19 10:22:15 macallan Exp $
 #
 # Config file and device description for machine-independent SBUS code.
 # Included by ports that need it.
@@ -153,6 +153,7 @@ file        dev/sbus/cgtwelve.c             cgtwelve
 # SSB MGX
 defflag        opt_mgx.h       MGX_DEBUG
 defparam       opt_mgx.h       MGX_DEPTH=8
+defparam       opt_mgx.h       MGX_X_DEPTH=8
 device mgx: fb, rasops8, rasops32, wsemuldisplaydev, vcons, glyphcache
 attach mgx at sbus
 file   dev/sbus/mgx.c                  mgx
diff -r 2e7529ba6868 -r b925a675b731 sys/dev/sbus/mgx.c
--- a/sys/dev/sbus/mgx.c        Tue Jul 18 16:59:57 2023 +0000
+++ b/sys/dev/sbus/mgx.c        Wed Jul 19 10:22:15 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $ */
+/*     $NetBSD: mgx.c,v 1.24 2023/07/19 10:22:15 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.23 2023/06/28 11:08:47 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.24 2023/07/19 10:22:15 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1055,7 +1055,7 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
                                        mgx_init_palette(sc);
                                        vcons_redraw_screen(ms);
                                } else {
-                                       mgx_setup(sc, 32);
+                                       mgx_setup(sc, MGX_X_DEPTH);
                                        mgx_init_palette(sc);
                                }
                        }
@@ -1068,6 +1068,32 @@ mgx_ioctl(void *v, void *vs, u_long cmd,
        case WSDISPLAYIO_PUTCMAP:
                return mgx_putcmap(sc, (struct wsdisplay_cmap *)data);
 
+       case FBIOGETCMAP:
+#define        p ((struct fbcmap *)data)
+               {
+                       struct wsdisplay_cmap c = {
+                               .index = p->index,
+                               .count = p->count,
+                               .red = p->red,
+                               .green = p->green,
+                               .blue = p->blue
+                       };
+                       return mgx_getcmap(sc, &c);
+               }
+               break;
+       case FBIOPUTCMAP:
+               {
+                       struct wsdisplay_cmap c = {
+                               .index = p->index,
+                               .count = p->count,
+                               .red = p->red,
+                               .green = p->green,
+                               .blue = p->blue
+                       };
+                       return mgx_putcmap(sc, &c);
+               }
+               break;
+#undef p               
        case WSDISPLAYIO_GCURPOS:
                {
                        struct wsdisplay_curpos *cp = (void *)data;
@@ -1336,7 +1362,7 @@ mgxopen(dev_t dev, int flags, int mode, 
        if (sc->sc_mode == WSDISPLAYIO_MODE_MAPPED)
                return 0;
        sc->sc_mode = WSDISPLAYIO_MODE_MAPPED;
-       mgx_setup(sc, 32);
+       mgx_setup(sc, MGX_X_DEPTH);
        mgx_init_palette(sc);
        return 0;
 }



Home | Main Index | Thread Index | Old Index