Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic -fix a debug message



details:   https://anonhg.NetBSD.org/src/rev/8a16054ec42e
branches:  trunk
changeset: 514528:8a16054ec42e
user:      drochner <drochner%NetBSD.org@localhost>
date:      Tue Sep 04 15:32:22 2001 +0000

description:
-fix a debug message
-unref font(s) if a screen is deleted, so they could be unloaded
 if dev/wsfont supported it
-add missing pieces to support screen types with font sizes != 8x16
 as system console - now
options VGA_CONSOLE_SCREENTYPE="\"80x50\""
options FONT_VT220L8x8
 gives you what you'd expect

diffstat:

 sys/dev/ic/vga.c |  35 +++++++++++++++++++++++++++--------
 1 files changed, 27 insertions(+), 8 deletions(-)

diffs (105 lines):

diff -r ef83a70a254e -r 8a16054ec42e sys/dev/ic/vga.c
--- a/sys/dev/ic/vga.c  Tue Sep 04 15:24:59 2001 +0000
+++ b/sys/dev/ic/vga.c  Tue Sep 04 15:32:22 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.37 2001/09/03 17:34:07 drochner Exp $ */
+/* $NetBSD: vga.c,v 1.38 2001/09/04 15:32:22 drochner Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -72,6 +72,10 @@
        0, 0
 };
 
+#ifdef VGA_CONSOLE_SCREENTYPE
+static struct egavga_font vga_consolefont;
+#endif
+
 struct vgascreen {
        struct pcdisplayscreen pcs;
 
@@ -379,7 +383,7 @@
 #ifdef VGAFONTDEBUG
                        if (scr != &vga_console_screen || vga_console_attached)
                                printf("vga_getfont: %s already present\n",
-                                      name ? name : <default>);
+                                      name ? name : "<default>");
 #endif
                        goto found;
                }
@@ -398,6 +402,11 @@
        if (wsfont_lock(cookie, &wf, WSDISPLAY_FONTORDER_L2R, 0) < 0)
                return (0);
 
+#ifdef VGA_CONSOLE_SCREENTYPE
+       if (scr == &vga_console_screen)
+               f = &vga_consolefont;
+       else
+#endif
        f = malloc(sizeof(struct egavga_font), M_DEVBUF, M_NOWAIT);
        if (!f) {
                wsfont_unlock(cookie);
@@ -428,10 +437,12 @@
 #ifdef VGAFONTDEBUG
        printf("vga_unreffont: usecount=%d\n", f->usecount);
 #endif
-       if (f->usecount == 0) {
-               /* XXX not for builtin font */
+       if (f->usecount == 0 && f != &vga_builtinfont) {
                TAILQ_REMOVE(&vc->vc_fontlist, f, next);
                wsfont_unlock(f->cookie);
+#ifdef VGA_CONSOLE_SCREENTYPE
+               if (f != &vga_consolefont)
+#endif
                free(f, M_DEVBUF);
        }
 }
@@ -652,8 +663,6 @@
               &vga_screenlist_mono : &vga_screenlist, VGA_CONSOLE_SCREENTYPE);
        if (!scr)
                panic("vga_cnattach: invalid screen type");
-       if (scr->fontheight != 16)
-               panic("vga_cnattach: console screen type w/o font");
        if (scr != vga_console_vc.currenttype) {
                vga_setscreentype(&vga_console_vc.hdl, scr);
                vga_console_vc.currenttype = scr;
@@ -662,6 +671,9 @@
        scr = vga_console_vc.currenttype;
 #endif
        vga_init_screen(&vga_console_vc, &vga_console_screen, scr, 1, &defattr);
+#ifdef VGA_CONSOLE_SCREENTYPE
+       vga_setfont(&vga_console_vc, &vga_console_screen);
+#endif
 
        vga_console_screen.pcs.active = 1;
        vga_console_vc.active = &vga_console_screen;
@@ -757,13 +769,15 @@
        struct vgascreen *scr;
 
        if (vc->nscreens == 1) {
+               struct vgascreen *scr1 = vc->screens.lh_first;
                /*
                 * When allocating the second screen, get backing store
                 * for the first one too.
                 * XXX We could be more clever and use video RAM.
                 */
-               vc->screens.lh_first->pcs.mem =
-                 malloc(type->ncols * type->nrows * 2, M_DEVBUF, M_WAITOK);
+               scr1->pcs.mem =
+                 malloc(scr1->pcs.type->ncols * scr1->pcs.type->nrows * 2,
+                        M_DEVBUF, M_WAITOK);
        }
 
        scr = malloc(sizeof(struct vgascreen), M_DEVBUF, M_WAITOK);
@@ -795,6 +809,11 @@
        struct vga_config *vc = vs->cfg;
 
        LIST_REMOVE(vs, next);
+       if (vs->fontset1)
+               egavga_unreffont(vc, vs->fontset1);
+       if (vs->fontset2)
+               egavga_unreffont(vc, vs->fontset2);
+
        if (vs != &vga_console_screen)
                free(vs, M_DEVBUF);
        else



Home | Main Index | Thread Index | Old Index