Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus restore the right colour map when X exits



details:   https://anonhg.NetBSD.org/src/rev/5078b4457918
branches:  trunk
changeset: 797559:5078b4457918
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Jul 22 04:55:51 2014 +0000

description:
restore the right colour map when X exits

diffstat:

 sys/dev/sbus/tcx.c |  38 +++++++++++++++++++++++---------------
 1 files changed, 23 insertions(+), 15 deletions(-)

diffs (94 lines):

diff -r b83be7810040 -r 5078b4457918 sys/dev/sbus/tcx.c
--- a/sys/dev/sbus/tcx.c        Tue Jul 22 04:20:39 2014 +0000
+++ b/sys/dev/sbus/tcx.c        Tue Jul 22 04:55:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcx.c,v 1.54 2014/07/16 17:58:35 macallan Exp $ */
+/*     $NetBSD: tcx.c,v 1.55 2014/07/22 04:55:51 macallan Exp $ */
 
 /*
  *  Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.54 2014/07/16 17:58:35 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.55 2014/07/22 04:55:51 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -163,6 +163,7 @@
 static int     tcx_ioctl(void *, void *, u_long, void *, int, struct lwp *);
 static paddr_t tcx_mmap(void *, void *, off_t, int);
 
+static void    tcx_init_cmap(struct tcx_softc *);
 static void    tcx_init_screen(void *, struct vcons_screen *, int, long *);
 static void    tcx_clearscreen(struct tcx_softc *, int);
 static void    tcx_copyrows(void *, int, int, int);
@@ -212,7 +213,7 @@
        int node;
        struct fbdevice *fb = &sc->sc_fb;
        bus_space_handle_t bh;
-       int isconsole, i, j;
+       int isconsole;
        uint32_t confreg;
 
        sc->sc_dev = self;
@@ -377,17 +378,6 @@
        /* reset cursor & frame buffer controls */
        tcx_reset(sc);
 
-       /* Initialize the default color map. */
-       j = 0;
-       for (i = 0; i < 256; i++) {
-
-               sc->sc_cmap_red[i] = rasops_cmap[j];
-               sc->sc_cmap_green[i] = rasops_cmap[j + 1];
-               sc->sc_cmap_blue[i] = rasops_cmap[j + 2];
-               j += 3;
-       }
-       tcx_loadcmap(sc, 0, 256);
-
        if (!sc->sc_8bit)
            tcx_set_cursor(sc);
 
@@ -415,6 +405,7 @@
 
        sc->sc_bg = ri->ri_devcmap[(defattr >> 16) & 0xff];
        tcx_clearscreen(sc, 0);
+       tcx_init_cmap(sc);
 
        tcx_defscreendesc.nrows = ri->ri_rows;
        tcx_defscreendesc.ncols = ri->ri_cols;
@@ -536,6 +527,23 @@
 }
 
 static void
+tcx_init_cmap(struct tcx_softc *sc)
+{
+       int i, j;
+
+       /* Initialize the default color map. */
+       j = 0;
+       for (i = 0; i < 256; i++) {
+
+               sc->sc_cmap_red[i] = rasops_cmap[j];
+               sc->sc_cmap_green[i] = rasops_cmap[j + 1];
+               sc->sc_cmap_blue[i] = rasops_cmap[j + 2];
+               j += 3;
+       }
+       tcx_loadcmap(sc, 0, 256);
+}
+
+static void
 tcx_loadcmap(struct tcx_softc *sc, int start, int ncolors)
 {
        int i;
@@ -760,7 +768,7 @@
                                        sc->sc_mode = new_mode;
                                        if (new_mode == WSDISPLAYIO_MODE_EMUL)
                                        {
-                                               tcx_loadcmap(sc, 0, 256);
+                                               tcx_init_cmap(sc);
                                                tcx_clearscreen(sc, 0);
                                                vcons_redraw_screen(ms);
                                        } else if (!sc->sc_8bit)



Home | Main Index | Thread Index | Old Index