Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/dev Initialize the default colormap to 0 == b...



details:   https://anonhg.NetBSD.org/src/rev/f979a4c0e270
branches:  trunk
changeset: 475827:f979a4c0e270
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Aug 26 22:53:41 1999 +0000

description:
Initialize the default colormap to 0 == black, all others == full white.

diffstat:

 sys/arch/sparc/dev/bt_subr.c |  23 ++++++++++++++++++++++-
 sys/arch/sparc/dev/btvar.h   |   3 ++-
 sys/arch/sparc/dev/cgsix.c   |  11 ++++-------
 sys/arch/sparc/dev/cgthree.c |  15 +++++++--------
 sys/arch/sparc/dev/p9100.c   |  23 ++++-------------------
 sys/arch/sparc/dev/tcx.c     |   9 ++++-----
 6 files changed, 43 insertions(+), 41 deletions(-)

diffs (193 lines):

diff -r fb431904c770 -r f979a4c0e270 sys/arch/sparc/dev/bt_subr.c
--- a/sys/arch/sparc/dev/bt_subr.c      Thu Aug 26 22:44:29 1999 +0000
+++ b/sys/arch/sparc/dev/bt_subr.c      Thu Aug 26 22:53:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bt_subr.c,v 1.8 1999/03/24 05:51:10 mrg Exp $ */
+/*     $NetBSD: bt_subr.c,v 1.9 1999/08/26 22:53:41 thorpej Exp $ */
 
 /*
  * Copyright (c) 1993
@@ -119,3 +119,24 @@
        }
        return (0);
 }
+
+/*
+ * Initialize the color map to the default state:
+ *
+ *     - 0 is black
+ *     - all other entries are full white
+ */
+void
+bt_initcmap(cm, cmsize)
+       union bt_cmap *cm;
+       int cmsize;
+{
+       int i;
+       u_char *cp;
+
+       cp = &cm->cm_map[0][0];
+       cp[0] = cp[1] = cp[2] = 0;
+
+       for (i = 1, cp = &cm->cm_map[i][0]; i < cmsize; cp += 3, i++)
+               cp[0] = cp[1] = cp[2] = 0xff;
+}
diff -r fb431904c770 -r f979a4c0e270 sys/arch/sparc/dev/btvar.h
--- a/sys/arch/sparc/dev/btvar.h        Thu Aug 26 22:44:29 1999 +0000
+++ b/sys/arch/sparc/dev/btvar.h        Thu Aug 26 22:53:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: btvar.h,v 1.2 1994/11/20 20:51:56 deraadt Exp $ */
+/*     $NetBSD: btvar.h,v 1.3 1999/08/26 22:53:42 thorpej Exp $ */
 
 /*
  * Copyright (c) 1993
@@ -63,6 +63,7 @@
  */
 int    bt_getcmap __P((struct fbcmap *, union bt_cmap *, int));
 int    bt_putcmap __P((struct fbcmap *, union bt_cmap *, int));
+void   bt_initcmap __P((union bt_cmap *, int));
 
 /*
  * Compute (x / 4) * 3 and (x / 4) * 4.  These are used in turning
diff -r fb431904c770 -r f979a4c0e270 sys/arch/sparc/dev/cgsix.c
--- a/sys/arch/sparc/dev/cgsix.c        Thu Aug 26 22:44:29 1999 +0000
+++ b/sys/arch/sparc/dev/cgsix.c        Thu Aug 26 22:53:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgsix.c,v 1.44 1999/07/30 18:11:38 thorpej Exp $ */
+/*     $NetBSD: cgsix.c,v 1.45 1999/08/26 22:53:42 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -158,8 +158,6 @@
        int isconsole;
        int isfb;
 {
-       int i;
-       volatile struct bt_regs *bt = sc->sc_bt;
        struct fbdevice *fb = &sc->sc_fb;
 
        fb->fb_driver = &cg6_fbdriver;
@@ -180,10 +178,9 @@
        /* reset cursor & frame buffer controls */
        cg6_reset(sc);
 
-       /* grab initial (current) color map (DOES THIS WORK?) */
-       bt->bt_addr = 0;
-       for (i = 0; i < 256 * 3; i++)
-               ((char *)&sc->sc_cmap)[i] = bt->bt_cmap >> 24;
+       /* initialize to the default color map */
+       bt_initcmap(&sc->sc_cmap, 256);
+       cg6_loadcmap(sc, 0, 256);
 
        /* enable video */
        sc->sc_thc->thc_misc |= THC_MISC_VIDEN;
diff -r fb431904c770 -r f979a4c0e270 sys/arch/sparc/dev/cgthree.c
--- a/sys/arch/sparc/dev/cgthree.c      Thu Aug 26 22:44:29 1999 +0000
+++ b/sys/arch/sparc/dev/cgthree.c      Thu Aug 26 22:53:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cgthree.c,v 1.40 1998/11/19 15:38:24 mrg Exp $ */
+/*     $NetBSD: cgthree.c,v 1.41 1999/08/26 22:53:42 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -353,13 +353,14 @@
        struct fbdevice *fb = &sc->sc_fb;
        volatile struct bt_regs *bt;
 
+       fb->fb_type.fb_cmsize = 256;
        fb->fb_type.fb_size = fb->fb_type.fb_height * fb->fb_linebytes;
        printf(": %s, %d x %d", name,
                fb->fb_type.fb_width, fb->fb_type.fb_height);
 
 
        /* Transfer video magic to board, if it's not running */
-       if ((sc->sc_fbc->fbc_ctrl & FBC_TIMING) == 0)
+       if ((sc->sc_fbc->fbc_ctrl & FBC_TIMING) == 0) {
                for (i = 0; i < sizeof(cg3_videoctrl)/sizeof(cg3_videoctrl[0]);
                     i++) {
                        volatile struct fbcontrol *fbc = sc->sc_fbc;
@@ -374,13 +375,11 @@
                                break;
                        }
                }
+       }
 
-       /* grab initial (current) color map */
-       fb->fb_type.fb_cmsize = 256;
-       bt = &sc->sc_fbc->fbc_dac;
-       bt->bt_addr = 0;
-       for (i = 0; i < 256 * 3 / 4; i++)
-               sc->sc_cmap.cm_chip[i] = bt->bt_cmap;
+       /* Initialize the default color map. */
+       bt_initcmap(&sc->sc_cmap, 256);
+       cgthreeloadcmap(sc, 0, 256);
 
        /* make sure we are not blanked */
        cgthree_set_video(sc, 1);
diff -r fb431904c770 -r f979a4c0e270 sys/arch/sparc/dev/p9100.c
--- a/sys/arch/sparc/dev/p9100.c        Thu Aug 26 22:44:29 1999 +0000
+++ b/sys/arch/sparc/dev/p9100.c        Thu Aug 26 22:53:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: p9100.c,v 1.5 1999/08/11 01:41:06 matt Exp $ */
+/*     $NetBSD: p9100.c,v 1.6 1999/08/26 22:53:42 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -250,14 +250,9 @@
        if ((1 << fb->fb_type.fb_depth) != fb->fb_type.fb_cmsize)
                printf(", %d entry colormap", fb->fb_type.fb_cmsize);
 
-       /* grab initial (current) color map */
-       p9100_ramdac_write(sc, DAC_CMAP_RDIDX, 0);
-       for (i = 0; i < fb->fb_type.fb_cmsize; i++) {
-               int j;
-               for (j = 0; j < 3; j++) {
-                       sc->sc_cmap.cm_map[i][j] = p9100_ramdac_read(sc, DAC_CMAP_DATA);
-               }
-       }
+       /* Initialize the default color map. */
+       bt_initcmap(&sc->sc_cmap, 256);
+       p9100loadcmap(sc, 0, 256);
 
        /* make sure we are not blanked */
        p9100_set_video(sc, 1);
@@ -277,16 +272,6 @@
                         fb->fb_pixels[i] = 0;
                     }
                }
-               sc->sc_cmap.cm_map[0][0] = 0;
-               sc->sc_cmap.cm_map[0][1] = 0;
-               sc->sc_cmap.cm_map[0][2] = 0;
-               sc->sc_cmap.cm_map[1][0] = 0xff;
-               sc->sc_cmap.cm_map[1][1] = 0xff;
-               sc->sc_cmap.cm_map[1][2] = 0xff;
-               p9100loadcmap(sc, 0, 2);
-               sc->sc_cmap.cm_map[255][0] = 0xff;
-               sc->sc_cmap.cm_map[255][1] = 0xff;
-               sc->sc_cmap.cm_map[255][2] = 0xff;
                p9100loadcmap(sc, 255, 1);
                fbrcons_init(fb);
 #endif
diff -r fb431904c770 -r f979a4c0e270 sys/arch/sparc/dev/tcx.c
--- a/sys/arch/sparc/dev/tcx.c  Thu Aug 26 22:44:29 1999 +0000
+++ b/sys/arch/sparc/dev/tcx.c  Thu Aug 26 22:53:41 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcx.c,v 1.13 1998/07/29 18:36:09 pk Exp $ */
+/*     $NetBSD: tcx.c,v 1.14 1999/08/26 22:53:42 thorpej Exp $ */
 
 /*
  *  Copyright (c) 1996,1998 The NetBSD Foundation, Inc.
@@ -220,10 +220,9 @@
        /* reset cursor & frame buffer controls */
        tcx_reset(sc);
 
-       /* grab initial (current) color map (DOES THIS WORK?) */
-       bt->bt_addr = 0;
-       for (i = 0; i < 256 * 3; i++)
-               ((char *)&sc->sc_cmap)[i] = bt->bt_cmap >> 24;
+       /* Initialize the default color map. */
+       bt_initcmap(&sc->sc_cmap, 256);
+       tcx_loadcmap(sc, 0, 256);
 
        /* enable video */
        sc->sc_thc->thc_hcmisc |= THC_MISC_VIDEN;



Home | Main Index | Thread Index | Old Index