don't claim alpha font support unless we have enough off-screen memory to

cache a useful number of glyphs
this should probably be CPU speed dependent, most UltraSPARCs can likely
render anti-aliased fonts fast enough on the fly
This commit is contained in:
macallan 2012-11-13 20:47:58 +00:00
parent 9622d8acf1
commit 880c7720a7
1 changed files with 15 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cgsix.c,v 1.59 2012/07/18 02:31:46 macallan Exp $ */
/* $NetBSD: cgsix.c,v 1.60 2012/11/13 20:47:58 macallan Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.59 2012/07/18 02:31:46 macallan Exp $");
__KERNEL_RCSID(0, "$NetBSD: cgsix.c,v 1.60 2012/11/13 20:47:58 macallan Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -598,7 +598,7 @@ cg6attach(struct cgsix_softc *sc, const char *name, int isconsole)
sc->sc_width = fb->fb_type.fb_width;
sc->sc_stride = fb->fb_type.fb_width;
sc->sc_height = fb->fb_type.fb_height;
printf("%s: framebuffer size: %d MB\n", device_xname(sc->sc_dev),
sc->sc_ramsize >> 20);
@ -634,14 +634,15 @@ cg6attach(struct cgsix_softc *sc, const char *name, int isconsole)
SCREEN_VISIBLE(&cg6_console_screen);
sc->vd.active = &cg6_console_screen;
wsdisplay_cnattach(&cgsix_defaultscreen, ri, 0, 0, defattr);
glyphcache_init(&sc->sc_gc, sc->sc_height + 5,
if (ri->ri_flg & RI_ENABLE_ALPHA) {
glyphcache_init(&sc->sc_gc, sc->sc_height + 5,
(sc->sc_ramsize / sc->sc_stride) -
sc->sc_height - 5,
sc->sc_width,
ri->ri_font->fontwidth,
ri->ri_font->fontheight,
defattr);
}
vcons_replay_msgbuf(&cg6_console_screen);
} else {
/*
@ -653,13 +654,15 @@ cg6attach(struct cgsix_softc *sc, const char *name, int isconsole)
vcons_init_screen(&sc->vd, &cg6_console_screen, 1,
&defattr);
}
glyphcache_init(&sc->sc_gc, sc->sc_height + 5,
if (ri->ri_flg & RI_ENABLE_ALPHA) {
glyphcache_init(&sc->sc_gc, sc->sc_height + 5,
(sc->sc_ramsize / sc->sc_stride) -
sc->sc_height - 5,
sc->sc_width,
ri->ri_font->fontwidth,
ri->ri_font->fontheight,
defattr);
}
}
cg6_setup_palette(sc);
@ -1280,13 +1283,17 @@ cgsix_init_screen(void *cookie, struct vcons_screen *scr,
{
struct cgsix_softc *sc = cookie;
struct rasops_info *ri = &scr->scr_ri;
int av;
ri->ri_depth = 8;
ri->ri_width = sc->sc_width;
ri->ri_height = sc->sc_height;
ri->ri_stride = sc->sc_stride;
ri->ri_flg = RI_CENTER | RI_ENABLE_ALPHA | RI_8BIT_IS_RGB;
av = sc->sc_ramsize - (sc->sc_height * sc->sc_stride);
ri->ri_flg = RI_CENTER | RI_8BIT_IS_RGB;
if (av > (128 * 1024)) {
ri->ri_flg |= RI_ENABLE_ALPHA;
}
ri->ri_bits = sc->sc_fb.fb_pixels;
/* We need unaccelerated initial screen clear on old revisions */