Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/sun don't claim alpha font support unless we have en...



details:   https://anonhg.NetBSD.org/src/rev/c9bc8005a17f
branches:  trunk
changeset: 782676:c9bc8005a17f
user:      macallan <macallan%NetBSD.org@localhost>
date:      Tue Nov 13 20:47:58 2012 +0000

description:
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

diffstat:

 sys/dev/sun/cgsix.c |  23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diffs (82 lines):

diff -r ed3c8885b3d7 -r c9bc8005a17f sys/dev/sun/cgsix.c
--- a/sys/dev/sun/cgsix.c       Tue Nov 13 20:29:03 2012 +0000
+++ b/sys/dev/sun/cgsix.c       Tue Nov 13 20:47:58 2012 +0000
@@ -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 @@
        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 @@
                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 @@
                        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 @@
 {
        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 */



Home | Main Index | Thread Index | Old Index