Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci use rasops_get_cmap()
details: https://anonhg.NetBSD.org/src/rev/fca495661f1d
branches: trunk
changeset: 778891:fca495661f1d
user: macallan <macallan%NetBSD.org@localhost>
date: Thu Apr 19 06:58:55 2012 +0000
description:
use rasops_get_cmap()
diffstat:
sys/dev/pci/r128fb.c | 54 ++++++++++++---------------------------------------
1 files changed, 13 insertions(+), 41 deletions(-)
diffs (96 lines):
diff -r ce3e7731ed67 -r fca495661f1d sys/dev/pci/r128fb.c
--- a/sys/dev/pci/r128fb.c Thu Apr 19 06:57:39 2012 +0000
+++ b/sys/dev/pci/r128fb.c Thu Apr 19 06:58:55 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: r128fb.c,v 1.32 2012/03/13 18:40:33 elad Exp $ */
+/* $NetBSD: r128fb.c,v 1.33 2012/04/19 06:58:55 macallan Exp $ */
/*
* Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.32 2012/03/13 18:40:33 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.33 2012/04/19 06:58:55 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -103,8 +103,6 @@
CFATTACH_DECL_NEW(r128fb, sizeof(struct r128fb_softc),
r128fb_match, r128fb_attach, NULL, NULL);
-extern const u_char rasops_cmap[768];
-
static int r128fb_ioctl(void *, void *, u_long, void *, int,
struct lwp *);
static paddr_t r128fb_mmap(void *, void *, off_t, int);
@@ -206,7 +204,7 @@
bool is_console;
int i, j;
uint32_t reg, flags;
- uint8_t tmp;
+ uint8_t cmap[768];
sc->sc_pc = pa->pa_pc;
sc->sc_pcitag = pa->pa_tag;
@@ -275,42 +273,6 @@
ri = &sc->sc_console_screen.scr_ri;
- j = 0;
- if (sc->sc_depth == 8) {
- /* generate an r3g3b2 colour map */
- for (i = 0; i < 256; i++) {
- tmp = i & 0xe0;
- /*
- * replicate bits so 0xe0 maps to a red value of 0xff
- * in order to make white look actually white
- */
- tmp |= (tmp >> 3) | (tmp >> 6);
- sc->sc_cmap_red[i] = tmp;
-
- tmp = (i & 0x1c) << 3;
- tmp |= (tmp >> 3) | (tmp >> 6);
- sc->sc_cmap_green[i] = tmp;
-
- tmp = (i & 0x03) << 6;
- tmp |= tmp >> 2;
- tmp |= tmp >> 4;
- sc->sc_cmap_blue[i] = tmp;
-
- r128fb_putpalreg(sc, i, sc->sc_cmap_red[i],
- sc->sc_cmap_green[i],
- sc->sc_cmap_blue[i]);
- }
- } else {
- /* steal rasops' ANSI cmap */
- for (i = 0; i < 256; i++) {
- sc->sc_cmap_red[i] = i;
- sc->sc_cmap_green[i] = i;
- sc->sc_cmap_blue[i] = i;
- r128fb_putpalreg(sc, i, i, i, i);
- j += 3;
- }
- }
-
sc->sc_gc.gc_bitblt = r128fb_bitblt;
sc->sc_gc.gc_blitcookie = sc;
sc->sc_gc.gc_rop = R128_ROP3_S;
@@ -348,6 +310,16 @@
defattr);
}
+ j = 0;
+ rasops_get_cmap(ri, cmap, sizeof(cmap));
+ for (i = 0; i < 256; i++) {
+ sc->sc_cmap_red[i] = cmap[j];
+ sc->sc_cmap_green[i] = cmap[j + 1];
+ sc->sc_cmap_blue[i] = cmap[j + 2];
+ r128fb_putpalreg(sc, i, cmap[j], cmap[j + 1], cmap[j + 2]);
+ j += 3;
+ }
+
/* no suspend/resume support yet */
pmf_device_register(sc->sc_dev, NULL, NULL);
Home |
Main Index |
Thread Index |
Old Index