diff --git a/sys/dev/sbus/p9100.c b/sys/dev/sbus/p9100.c index d3ec72608fce..5deeefa46951 100644 --- a/sys/dev/sbus/p9100.c +++ b/sys/dev/sbus/p9100.c @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $ */ +/* $NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $ */ /*- * Copyright (c) 1998, 2005, 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.54 2010/03/01 05:42:08 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.55 2010/05/04 05:10:25 macallan Exp $"); #include #include @@ -1085,6 +1085,7 @@ static void p9100_putchar(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; + struct wsdisplay_font *font = PICK_FONT(ri, c); struct vcons_screen *scr = ri->ri_hw; struct p9100_softc *sc = scr->scr_cookie; @@ -1092,10 +1093,10 @@ p9100_putchar(void *cookie, int row, int col, u_int c, long attr) uint8_t *data; int x, y, wi, he; - wi = ri->ri_font->fontwidth; - he = ri->ri_font->fontheight; + wi = font->fontwidth; + he = font->fontheight; - if (!CHAR_IN_FONT(c, ri->ri_font)) + if (!CHAR_IN_FONT(c, font)) return; bg = (u_char)ri->ri_devcmap[(attr >> 16) & 0xff]; @@ -1106,15 +1107,15 @@ p9100_putchar(void *cookie, int row, int col, u_int c, long attr) if (c == 0x20) { p9100_rectfill(sc, x, y, wi, he, bg); } else { - uc = c-ri->ri_font->firstchar; - data = (uint8_t *)ri->ri_font->data + uc * + uc = c - font->firstchar; + data = (uint8_t *)font->data + uc * ri->ri_fontscale; p9100_setup_mono(sc, x, y, wi, 1, fg, bg); for (i = 0; i < he; i++) { - p9100_feed_line(sc, ri->ri_font->stride, + p9100_feed_line(sc, font->stride, data); - data += ri->ri_font->stride; + data += font->stride; } } } diff --git a/sys/dev/sbus/tcx.c b/sys/dev/sbus/tcx.c index e1d68f09bd03..8fc743a1de4f 100644 --- a/sys/dev/sbus/tcx.c +++ b/sys/dev/sbus/tcx.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.42 2009/09/17 16:39:48 tsutsui Exp $ */ +/* $NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $ */ /* * Copyright (c) 1996, 1998, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.42 2009/09/17 16:39:48 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.43 2010/05/04 05:10:25 macallan Exp $"); /* * define for cg8 emulation on S24 (24-bit version of tcx) for the SS5; @@ -931,6 +931,7 @@ static void tcx_putchar(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; + struct wsdisplay_font *font = PICK_FONT(ri, c); struct vcons_screen *scr = ri->ri_hw; struct tcx_softc *sc = scr->scr_cookie; uint64_t bg, fg, temp, mask; @@ -939,18 +940,17 @@ tcx_putchar(void *cookie, int row, int col, u_int c, long attr) uint8_t *cdata; uint16_t *wdata; - addr = ri->ri_xorigin + - col * ri->ri_font->fontwidth + - (ri->ri_yorigin + row * ri->ri_font->fontheight) * ri->ri_width; + addr = ri->ri_xorigin + col * font->fontwidth + + (ri->ri_yorigin + row * font->fontheight) * ri->ri_width; /* check if the character is crossing a 32 pixel boundary */ if ((addr & 0xffffe0) == - ((addr + ri->ri_font->fontwidth - 1) & 0xffffe0)) { + ((addr + font->fontwidth - 1) & 0xffffe0)) { /* phew, not split */ shift = addr & 0x1f; addr &= 0xffffe0; - fmask = 0xffffffff >> (32 - ri->ri_font->fontwidth); - fmask = fmask << (32 - ri->ri_font->fontwidth - shift); + fmask = 0xffffffff >> (32 - font->fontwidth); + fmask = fmask << (32 - font->fontwidth - shift); mask = fmask; bg = 0x3000000000000000LL | ((uint64_t)ri->ri_devcmap[(attr >> 16) & 0xff] & @@ -959,12 +959,12 @@ tcx_putchar(void *cookie, int row, int col, u_int c, long attr) temp = 0x3000000000000000LL | ((uint64_t)ri->ri_devcmap[(attr >> 24) & 0xff] & 0xff) << 32; - uc = c - ri->ri_font->firstchar; - cdata = (uint8_t *)ri->ri_font->data + uc * ri->ri_fontscale; + uc = c - font->firstchar; + cdata = (uint8_t *)font->data + uc * ri->ri_fontscale; - if (ri->ri_font->fontwidth < 9) { + if (font->fontwidth < 9) { /* byte by byte */ - for (i = 0; i < ri->ri_font->fontheight; i++) { + for (i = 0; i < font->fontheight; i++) { sc->sc_rstip[addr] = bg; if (*cdata != 0) { if (shift > 24) { @@ -979,10 +979,10 @@ tcx_putchar(void *cookie, int row, int col, u_int c, long attr) cdata++; addr += ri->ri_width; } - } else if (ri->ri_font->fontwidth < 17) { + } else if (font->fontwidth < 17) { /* short by short */ wdata = (uint16_t *)cdata; - for (i = 0; i < ri->ri_font->fontheight; i++) { + for (i = 0; i < font->fontheight; i++) { sc->sc_rstip[addr] = bg; if (*wdata != 0) { if (shift > 16) { @@ -1007,7 +1007,7 @@ tcx_putchar(void *cookie, int row, int col, u_int c, long attr) addr &= 0xffffe0; mask = 0xffffffff >> shift; maskr = (uint64_t)(0xffffffffUL << - (32 - (ri->ri_font->fontwidth + shift - 32))); + (32 - (font->fontwidth + shift - 32))); bg = 0x3000000000000000LL | ((uint64_t)ri->ri_devcmap[(attr >> 16) & 0xff] & 0xff) << 32; @@ -1017,12 +1017,12 @@ tcx_putchar(void *cookie, int row, int col, u_int c, long attr) ((uint64_t)ri->ri_devcmap[(attr >> 24) & 0xff] & 0xff) << 32; - uc = c - ri->ri_font->firstchar; - cdata = (uint8_t *)ri->ri_font->data + uc * ri->ri_fontscale; + uc = c - font->firstchar; + cdata = (uint8_t *)font->data + uc * ri->ri_fontscale; - if (ri->ri_font->fontwidth < 9) { + if (font->fontwidth < 9) { /* byte by byte */ - for (i = 0; i < ri->ri_font->fontheight; i++) { + for (i = 0; i < font->fontheight; i++) { sc->sc_rstip[addr] = bg; sc->sc_rstip[addr + 32] = bgr; bork = *cdata; @@ -1035,10 +1035,10 @@ tcx_putchar(void *cookie, int row, int col, u_int c, long attr) cdata++; addr += ri->ri_width; } - } else if (ri->ri_font->fontwidth < 17) { + } else if (font->fontwidth < 17) { /* short by short */ wdata = (uint16_t *)cdata; - for (i = 0; i < ri->ri_font->fontheight; i++) { + for (i = 0; i < font->fontheight; i++) { sc->sc_rstip[addr] = bg; sc->sc_rstip[addr + 32] = bgr; bork = *wdata; diff --git a/sys/dev/sbus/zx.c b/sys/dev/sbus/zx.c index 9c4c7e067110..19e32a986269 100644 --- a/sys/dev/sbus/zx.c +++ b/sys/dev/sbus/zx.c @@ -1,4 +1,4 @@ -/* $NetBSD: zx.c,v 1.35 2010/01/05 05:04:38 macallan Exp $ */ +/* $NetBSD: zx.c,v 1.36 2010/05/04 05:10:25 macallan Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.35 2010/01/05 05:04:38 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: zx.c,v 1.36 2010/05/04 05:10:25 macallan Exp $"); #include #include @@ -993,9 +993,9 @@ static void zx_putchar(void *cookie, int row, int col, u_int uc, long attr) { struct rasops_info *ri = cookie; + struct wsdisplay_font *font = PICK_FONT(ri, uc); struct vcons_screen *scr = ri->ri_hw; struct zx_softc *sc = scr->scr_cookie; - struct wsdisplay_font *font; volatile uint32_t *dp; uint8_t *fb; int fs, i, ul; @@ -1007,15 +1007,13 @@ zx_putchar(void *cookie, int row, int col, u_int uc, long attr) if (uc == ' ') { int x, y; - x = ri->ri_xorigin + ri->ri_font->fontwidth * col; - y = ri->ri_yorigin + ri->ri_font->fontheight * row; - zx_fillrect(sc, x, y, ri->ri_font->fontwidth, - ri->ri_font->fontheight, bg, ZX_STD_ROP); + x = ri->ri_xorigin + font->fontwidth * col; + y = ri->ri_yorigin + font->fontheight * row; + zx_fillrect(sc, x, y, font->fontwidth, + font->fontheight, bg, ZX_STD_ROP); return; } - font = ri->ri_font; - dp = (volatile uint32_t *)sc->sc_pixels + ((row * font->fontheight + ri->ri_yorigin) << 11) + (col * font->fontwidth + ri->ri_xorigin); diff --git a/sys/dev/sun/cgsix.c b/sys/dev/sun/cgsix.c index ea4aceea0891..e1df00343e2d 100644 --- a/sys/dev/sun/cgsix.c +++ b/sys/dev/sun/cgsix.c @@ -1,4 +1,4 @@ -/* $NetBSD: cgsix.c,v 1.46 2009/09/19 07:07:43 tsutsui Exp $ */ +/* $NetBSD: cgsix.c,v 1.47 2010/05/04 05:11:06 macallan Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.46 2009/09/19 07:07:43 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.47 2010/05/04 05:11:06 macallan Exp $"); #include #include @@ -1345,6 +1345,7 @@ void cgsix_putchar(void *cookie, int row, int col, u_int c, long attr) { struct rasops_info *ri = cookie; + struct wsdisplay_font *font = PICK_FONT(ri, c); struct vcons_screen *scr = ri->ri_hw; struct cgsix_softc *sc = scr->scr_cookie; int inv; @@ -1359,10 +1360,10 @@ cgsix_putchar(void *cookie, int row, int col, u_int c, long attr) int x, y, wi, he; volatile struct cg6_fbc *fbc = sc->sc_fbc; - wi = ri->ri_font->fontwidth; - he = ri->ri_font->fontheight; + wi = font->fontwidth; + he = font->fontheight; - if (!CHAR_IN_FONT(c, ri->ri_font)) + if (!CHAR_IN_FONT(c, font)) return; inv = ((attr >> 8) & WSATTR_REVERSE); if (inv) { @@ -1383,15 +1384,15 @@ cgsix_putchar(void *cookie, int row, int col, u_int c, long attr) if (c == 0x20) { cgsix_rectfill(sc, x, y, wi, he, bg); } else { - uc = c-ri->ri_font->firstchar; - data = (uint8_t *)ri->ri_font->data + uc * + uc = c - font->firstchar; + data = (uint8_t *)font->data + uc * ri->ri_fontscale; cgsix_setup_mono(sc, x, y, wi, 1, fg, bg); for (i = 0; i < he; i++) { - cgsix_feed_line(sc, ri->ri_font->stride, + cgsix_feed_line(sc, font->stride, data); - data += ri->ri_font->stride; + data += font->stride; } /* put the chip back to normal */ fbc->fbc_incy = 0;