Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci cache glyphs in video memory when using anti-ali...
details: https://anonhg.NetBSD.org/src/rev/6c71625e4c72
branches: trunk
changeset: 777367:6c71625e4c72
user: macallan <macallan%NetBSD.org@localhost>
date: Thu Feb 16 17:33:28 2012 +0000
description:
cache glyphs in video memory when using anti-aliased fonts on r128fb and
radeonfb
diffstat:
sys/dev/pci/files.pci | 8 ++++----
sys/dev/pci/r128fb.c | 39 +++++++++++++++++++++++++++++++++++----
sys/dev/pci/radeonfb.c | 41 ++++++++++++++++++++++++++++++-----------
sys/dev/pci/radeonfbvar.h | 4 +++-
4 files changed, 72 insertions(+), 20 deletions(-)
diffs (truncated from 347 to 300 lines):
diff -r c86e4b139419 -r 6c71625e4c72 sys/dev/pci/files.pci
--- a/sys/dev/pci/files.pci Thu Feb 16 17:29:21 2012 +0000
+++ b/sys/dev/pci/files.pci Thu Feb 16 17:33:28 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.pci,v 1.354 2012/01/24 01:58:40 rkujawa Exp $
+# $NetBSD: files.pci,v 1.355 2012/02/16 17:33:28 macallan Exp $
#
# Config file and device description for machine-independent PCI code.
# Included by ports that need it. Requires that the SCSI files be
@@ -837,7 +837,7 @@
# ATI Radeon framebuffer console driver
# (Note: to enable the BIOS parser, add options RADEON_BIOS_INIT to the config)
-device radeonfb: wsemuldisplaydev, videomode, rasops8, rasops32, vcons, splash, i2cbus, i2c_bitbang, ddc_read_edid, edid, drm
+device radeonfb: wsemuldisplaydev, videomode, rasops8, rasops32, vcons, splash, i2cbus, i2c_bitbang, ddc_read_edid, edid, drm, glyphcache
attach radeonfb at pci
file dev/pci/radeonfb.c radeonfb
file dev/pci/radeonfb_i2c.c radeonfb
@@ -980,7 +980,7 @@
file dev/pci/ichsmb.c ichsmb
# ATI Rage 128 framebuffer console driver
-device r128fb: wsemuldisplaydev, rasops8, rasops32, vcons, videomode, i2cbus, i2c_bitbang
+device r128fb: wsemuldisplaydev, rasops8, rasops32, vcons, videomode, i2cbus, i2c_bitbang, glyphcache
attach r128fb at pci
file dev/pci/r128fb.c r128fb
defflag opt_r128fb.h R128FB_DEBUG
@@ -1041,7 +1041,7 @@
include "dev/pci/hdaudio/files.hdaudio"
# Permedia 2 / Sun PGX32 / Raptor
-device pm2fb: wsemuldisplaydev, rasops8, vcons, videomode, i2cbus, i2c_bitbang
+device pm2fb: wsemuldisplaydev, rasops8, rasops32, vcons, videomode, i2cbus, i2c_bitbang, ddc_read_edid, edid
attach pm2fb at pci
file dev/pci/pm2fb.c pm2fb
defflag opt_pm2fb.h PM2FB_DEBUG
diff -r c86e4b139419 -r 6c71625e4c72 sys/dev/pci/r128fb.c
--- a/sys/dev/pci/r128fb.c Thu Feb 16 17:29:21 2012 +0000
+++ b/sys/dev/pci/r128fb.c Thu Feb 16 17:33:28 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: r128fb.c,v 1.28 2012/01/30 19:41:22 drochner Exp $ */
+/* $NetBSD: r128fb.c,v 1.29 2012/02/16 17:33:28 macallan Exp $ */
/*
* Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.28 2012/01/30 19:41:22 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: r128fb.c,v 1.29 2012/02/16 17:33:28 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -55,6 +55,7 @@
#include <dev/rasops/rasops.h>
#include <dev/wscons/wsdisplay_vconsvar.h>
#include <dev/pci/wsdisplay_pci.h>
+#include <dev/wscons/wsdisplay_glyphcachevar.h>
#include <dev/i2c/i2cvar.h>
@@ -93,6 +94,7 @@
u_char sc_cmap_blue[256];
/* engine stuff */
uint32_t sc_master_cntl;
+ glyphcache sc_gc;
};
static int r128fb_match(device_t, cfdata_t, void *);
@@ -118,7 +120,7 @@
static void r128fb_flush_engine(struct r128fb_softc *);
static void r128fb_rectfill(struct r128fb_softc *, int, int, int, int,
uint32_t);
-static void r128fb_bitblt(struct r128fb_softc *, int, int, int, int, int,
+static void r128fb_bitblt(void *, int, int, int, int, int,
int, int);
static void r128fb_cursor(void *, int, int, int);
@@ -309,6 +311,9 @@
}
}
+ sc->sc_gc.gc_bitblt = r128fb_bitblt;
+ sc->sc_gc.gc_blitcookie = sc;
+ sc->sc_gc.gc_rop = R128_ROP3_S;
if (is_console) {
vcons_init_screen(&sc->vd, &sc->sc_console_screen, 1,
&defattr);
@@ -320,6 +325,12 @@
sc->sc_defaultscreen_descr.capabilities = ri->ri_caps;
sc->sc_defaultscreen_descr.nrows = ri->ri_rows;
sc->sc_defaultscreen_descr.ncols = ri->ri_cols;
+ glyphcache_init(&sc->sc_gc, sc->sc_height,
+ sc->sc_width,
+ (0x800000 / sc->sc_stride) - sc->sc_height,
+ ri->ri_font->fontwidth,
+ ri->ri_font->fontheight,
+ defattr);
wsdisplay_cnattach(&sc->sc_defaultscreen_descr, ri, 0, 0,
defattr);
vcons_replay_msgbuf(&sc->sc_console_screen);
@@ -329,6 +340,12 @@
* until someone actually allocates a screen for us
*/
(*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr);
+ glyphcache_init(&sc->sc_gc, sc->sc_height,
+ sc->sc_width,
+ (0x800000 / sc->sc_stride) - sc->sc_height,
+ ri->ri_font->fontwidth,
+ ri->ri_font->fontheight,
+ defattr);
}
/* no suspend/resume support yet */
@@ -411,6 +428,7 @@
if(new_mode == WSDISPLAYIO_MODE_EMUL) {
r128fb_init(sc);
r128fb_restore_palette(sc);
+ glyphcache_wipe(&sc->sc_gc);
r128fb_rectfill(sc, 0, 0, sc->sc_width,
sc->sc_height, ms->scr_ri.ri_devcmap[
(ms->scr_defattr >> 16) & 0xff]);
@@ -549,6 +567,10 @@
ri->ri_ops.cursor = r128fb_cursor;
if (FONT_IS_ALPHA(ri->ri_font)) {
ri->ri_ops.putchar = r128fb_putchar_aa;
+ printf("before: %08x\n", (uint32_t)sc->sc_gc.gc_attr);
+ ri->ri_ops.allocattr(ri, WS_DEFAULT_FG, WS_DEFAULT_BG,
+ 0, &sc->sc_gc.gc_attr);
+ printf("after: %08x\n", (uint32_t)sc->sc_gc.gc_attr);
} else
ri->ri_ops.putchar = r128fb_putchar;
}
@@ -744,9 +766,10 @@
}
static void
-r128fb_bitblt(struct r128fb_softc *sc, int xs, int ys, int xd, int yd,
+r128fb_bitblt(void *cookie, int xs, int ys, int xd, int yd,
int wi, int he, int rop)
{
+ struct r128fb_softc *sc = cookie;
uint32_t dp_cntl = 0;
r128fb_wait(sc, 5);
@@ -925,6 +948,7 @@
int i, x, y, wi, he, r, g, b, aval;
int r1, g1, b1, r0, g0, b0, fgo, bgo;
uint8_t *data8;
+ int rv;
if (sc->sc_mode != WSDISPLAYIO_MODE_EMUL)
return;
@@ -943,6 +967,10 @@
return;
}
+ rv = glyphcache_try(&sc->sc_gc, c, x, y, attr);
+ if (rv == GC_OK)
+ return;
+
data8 = WSFONT_GLYPH(c, font);
r128fb_wait(sc, 5);
@@ -1014,6 +1042,9 @@
bus_space_write_stream_4(sc->sc_memt, sc->sc_regh,
R128_HOST_DATA0, latch);
}
+ if (rv == GC_ADD) {
+ glyphcache_add(&sc->sc_gc, c, x, y);
+ }
}
static void
diff -r c86e4b139419 -r 6c71625e4c72 sys/dev/pci/radeonfb.c
--- a/sys/dev/pci/radeonfb.c Thu Feb 16 17:29:21 2012 +0000
+++ b/sys/dev/pci/radeonfb.c Thu Feb 16 17:33:28 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeonfb.c,v 1.53 2012/01/30 19:41:23 drochner Exp $ */
+/* $NetBSD: radeonfb.c,v 1.54 2012/02/16 17:33:28 macallan Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.53 2012/01/30 19:41:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.54 2012/02/16 17:33:28 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -89,6 +89,7 @@
#include <dev/videomode/edidvar.h>
#include <dev/wscons/wsdisplay_vconsvar.h>
#include <dev/pci/wsdisplay_pci.h>
+#include <dev/wscons/wsdisplay_glyphcachevar.h>
#include <dev/pci/pcidevs.h>
#include <dev/pci/pcireg.h>
@@ -143,8 +144,8 @@
/* acceleration support */
static void radeonfb_rectfill(struct radeonfb_display *, int dstx, int dsty,
int width, int height, uint32_t color);
-static void radeonfb_bitblt(struct radeonfb_display *, int srcx, int srcy,
- int dstx, int dsty, int width, int height, int rop, uint32_t mask);
+static void radeonfb_bitblt(void *, int srcx, int srcy,
+ int dstx, int dsty, int width, int height, int rop);
/* hw cursor support */
static void radeonfb_cursor_cmap(struct radeonfb_display *);
@@ -862,6 +863,15 @@
dp->rd_splash.si_stride = ri->ri_stride;
dp->rd_splash.si_fillrect = NULL;
#endif
+ dp->rd_gc.gc_bitblt = radeonfb_bitblt;
+ dp->rd_gc.gc_rop = RADEON_ROP3_S;
+ dp->rd_gc.gc_blitcookie = dp;
+ glyphcache_init(&dp->rd_gc, dp->rd_virty + 4,
+ (0x800000 / dp->rd_stride) - (dp->rd_virty + 4),
+ dp->rd_virty,
+ ri->ri_font->fontwidth,
+ ri->ri_font->fontheight,
+ defattr);
if (dp->rd_console) {
radeonfb_modeswitch(dp);
@@ -1011,6 +1021,7 @@
if ((dp->rd_wsmode == WSDISPLAYIO_MODE_EMUL) &&
(dp->rd_vd.active)) {
radeonfb_engine_init(dp);
+ glyphcache_wipe(&dp->rd_gc);
radeonfb_init_palette(sc, dp == &sc->sc_displays[0] ? 0 : 1);
radeonfb_modeswitch(dp);
vcons_redraw_screen(dp->rd_vd.active);
@@ -2497,6 +2508,7 @@
int i, r, g, b, aval;
int rf, gf, bf, rb, gb, bb;
uint32_t pixel;
+ int rv;
if (dp->rd_wsmode != WSDISPLAYIO_MODE_EMUL)
return;
@@ -2517,6 +2529,10 @@
radeonfb_rectfill(dp, xd, yd, w, h, bg);
return;
}
+ rv = glyphcache_try(&dp->rd_gc, c, xd, yd, attr);
+ if (rv == GC_OK)
+ return;
+
data = WSFONT_GLYPH(c, font);
gmc = dp->rd_format << RADEON_GMC_DST_DATATYPE_SHIFT;
@@ -2575,6 +2591,8 @@
radeonfb_wait_fifo(sc, 20);
PUT32(sc, RADEON_HOST_DATA0, pixel);
}
+ if (rv == GC_ADD)
+ glyphcache_add(&dp->rd_gc, c, xd, yd);
}
/*
@@ -2628,7 +2646,7 @@
w = ri->ri_emuwidth;
h = ri->ri_font->fontheight * nrows;
radeonfb_bitblt(dp, x, ys, x, yd, w, h,
- RADEON_ROP3_S, 0xffffffff);
+ RADEON_ROP3_S);
}
}
@@ -2647,7 +2665,7 @@
w = ri->ri_font->fontwidth * ncols;
h = ri->ri_font->fontheight;
radeonfb_bitblt(dp, xs, y, xd, y, w, h,
- RADEON_ROP3_S, 0xffffffff);
+ RADEON_ROP3_S);
}
}
@@ -2688,7 +2706,7 @@
/* first turn off the old cursor */
if (ri->ri_flg & RI_CURSOR) {
radeonfb_bitblt(dp, x, y, x, y, wi, he,
- RADEON_ROP3_Dn, 0xffffffff);
+ RADEON_ROP3_Dn);
ri->ri_flg &= ~RI_CURSOR;
}
ri->ri_crow = row;
@@ -2698,7 +2716,7 @@
x = ri->ri_ccol * wi + ri->ri_xorigin;
y = ri->ri_crow * he + ri->ri_yorigin;
radeonfb_bitblt(dp, x, y, x, y, wi, he,
- RADEON_ROP3_Dn, 0xffffffff);
+ RADEON_ROP3_Dn);
ri->ri_flg |= RI_CURSOR;
}
} else {
Home |
Main Index |
Thread Index |
Old Index