Module Name: src Committed By: macallan Date: Thu Apr 19 06:58:55 UTC 2012
Modified Files: src/sys/dev/pci: r128fb.c Log Message: use rasops_get_cmap() To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/r128fb.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/dev/pci/r128fb.c diff -u src/sys/dev/pci/r128fb.c:1.32 src/sys/dev/pci/r128fb.c:1.33 --- src/sys/dev/pci/r128fb.c:1.32 Tue Mar 13 18:40:33 2012 +++ src/sys/dev/pci/r128fb.c Thu Apr 19 06:58:55 2012 @@ -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 @@ static void r128fb_attach(device_t, devi 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 @@ r128fb_attach(device_t parent, device_t 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 @@ r128fb_attach(device_t parent, device_t 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 @@ r128fb_attach(device_t parent, device_t 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);