Module Name:    src
Committed By:   macallan
Date:           Wed Apr 13 23:31:25 UTC 2011

Modified Files:
        src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
use the same function whenever we change colour depth
also, when opening the fb device switch to 32bit and back to 8 on close, not
the other way around


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sparc/dev/cgfourteen.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.65 src/sys/arch/sparc/dev/cgfourteen.c:1.66
--- src/sys/arch/sparc/dev/cgfourteen.c:1.65	Tue Aug 31 21:14:57 2010
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Apr 13 23:31:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.65 2010/08/31 21:14:57 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.66 2011/04/13 23:31:25 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -477,20 +477,10 @@
 	case CG14_SET_PIXELMODE: {
 		int depth = *(int *)data;
 
-		switch (depth) {
-		case 8:
-			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
-			    CG14_MCTL, CG14_MCTL_ENABLEVID | 
-			    CG14_MCTL_PIXMODE_8 | CG14_MCTL_POWERCTL);
-			break;
-		case 32:
-			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
-			    CG14_MCTL, CG14_MCTL_ENABLEVID | 
-			    CG14_MCTL_PIXMODE_32 | CG14_MCTL_POWERCTL);
-			break;
-		default:
+		if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 			return EINVAL;
-		}
+
+		cg14_set_depth(sc, depth);
 		}
 		break;
 	default:
@@ -586,6 +576,7 @@
 static void
 cg14_init(struct cgfourteen_softc *sc)
 {
+#if 0
 	volatile uint32_t *clut;
 	volatile uint8_t  *xlut;
 	int i;
@@ -613,12 +604,16 @@
 	 */
 	sc->sc_ctl->ctl_mctl = CG14_MCTL_ENABLEVID | CG14_MCTL_PIXMODE_8 |
 		CG14_MCTL_POWERCTL;
+#else
+	cg14_set_depth(sc, 32);
+#endif
 }
 
 static void
 /* Restore the state saved on cg14_init */
 cg14_reset(struct cgfourteen_softc *sc)
 {
+#if 0
 	volatile uint32_t *clut;
 	volatile uint8_t  *xlut;
 	int i;
@@ -646,6 +641,9 @@
 		clut[i] = sc->sc_saveclut.cm_chip[i];
 		xlut[i] = sc->sc_savexlut[i];
 	}
+#else
+	cg14_set_depth(sc, 8);
+#endif
 }
 
 /* Enable/disable video display; power down monitor if DPMS-capable */
@@ -932,10 +930,12 @@
 						bus_space_write_1(sc->sc_bustag,
 						    sc->sc_regh,
 						    CG14_CURSOR_CONTROL, 0);
+
 						cg14_set_depth(sc, 8);
 						cg14_init_cmap(sc);
 						vcons_redraw_screen(ms);
 					} else {
+
 						cg14_set_depth(sc, 32);
 					}
 				}
@@ -1038,6 +1038,7 @@
 
 	if (sc->sc_depth == depth)
 		return;
+
 	switch (depth) {
 		case 8:
 			bus_space_write_1(sc->sc_bustag, sc->sc_regh,

Reply via email to