Module Name:    src
Committed By:   macallan
Date:           Tue Nov 13 20:47:58 UTC 2012

Modified Files:
        src/sys/dev/sun: cgsix.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/sun/cgsix.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/sun/cgsix.c
diff -u src/sys/dev/sun/cgsix.c:1.59 src/sys/dev/sun/cgsix.c:1.60
--- src/sys/dev/sun/cgsix.c:1.59	Wed Jul 18 02:31:46 2012
+++ src/sys/dev/sun/cgsix.c	Tue Nov 13 20:47:58 2012
@@ -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 
 	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 
 		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 
 			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 v
 {
 	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 */

Reply via email to