Date: Sat, 14 May 2005 07:06:28 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 76961 for review Message-ID: <200505140706.j4E76SmV057450@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=76961 Change 76961 by marcel@marcel_nfs on 2005/05/14 07:05:31 o Add a 8x16 font and use it. Taken from syscons. o Add an image of beastie when he was 4.4BSD years old. Shown when the VGA is not a console. o Implement BITBLT_H4TOFB. Affected files ... .. //depot/projects/tty/sys/conf/files#27 edit .. //depot/projects/tty/sys/dev/vga/vga.c#12 edit .. //depot/projects/tty/sys/dev/vga/vga_logo.c#1 add .. //depot/projects/tty/sys/dev/vtc/vtc_con.c#6 edit .. //depot/projects/tty/sys/dev/vtc/vtc_font.c#1 add Differences ... ==== //depot/projects/tty/sys/conf/files#27 (text+ko) ==== @@ -919,10 +919,12 @@ dev/vga/vga_bus_isa.c optional vga isa dev/vga/vga_bus_pci.c optional vga pci dev/vga/vga_con.c optional vga +dev/vga/vga_logo.c optional vga dev/vge/if_vge.c optional vge dev/vkbd/vkbd.c optional vkbd dev/vtc/vtc_con.c optional vtc dev/vtc/vtc_core.c optional vtc +dev/vtc/vtc_font.c optional vtc dev/vx/if_vx.c optional vx dev/vx/if_vx_eisa.c optional vx eisa dev/vx/if_vx_pci.c optional vx pci ==== //depot/projects/tty/sys/dev/vga/vga.c#12 (text+ko) ==== @@ -38,6 +38,10 @@ #include <dev/ic/vga.h> #include <dev/vga/vga.h> +extern int vga_logo_height; +extern int vga_logo_width; +extern u_char vga_logo_image[]; + /* Convenience macros. */ #define MEM_READ(sc, ofs) \ bus_space_read_1(sc->vga_fb.bst, sc->vga_fb.bsh, ofs) @@ -280,8 +284,6 @@ REG_WRITE(sc, VGA_GC_DATA, 0x0f); REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_SET_RESET); REG_WRITE(sc, VGA_GC_DATA, c & 0x0f); - REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_DATA_ROTATE); - REG_WRITE(sc, VGA_GC_DATA, 0); dst >>= 3; while (height > 0) { for (w = 0; w < width; w += 8) { @@ -301,13 +303,11 @@ int w; REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_MODE); - REG_WRITE(sc, VGA_GC_DATA, 0); + REG_WRITE(sc, VGA_GC_DATA, 1); REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_ENABLE_SET_RESET); REG_WRITE(sc, VGA_GC_DATA, 0x0f); REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_SET_RESET); REG_WRITE(sc, VGA_GC_DATA, 0); - REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_DATA_ROTATE); - REG_WRITE(sc, VGA_GC_DATA, VGA_GC_DR_FS_OR); dst >>= 3; src >>= 3; while (height > 0) { @@ -335,8 +335,6 @@ REG_WRITE(sc, VGA_GC_DATA, 0x0f); REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_SET_RESET); REG_WRITE(sc, VGA_GC_DATA, fgclr); - REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_DATA_ROTATE); - REG_WRITE(sc, VGA_GC_DATA, 0); c = fgclr; dst >>= 3; while (height > 0) { @@ -370,6 +368,56 @@ return (0); } +static __inline int +vga_bitblt_h4tofb(struct vga_softc *sc, uint8_t *src, u_long dst, int width, + int height) +{ + u_long dstini; + int rotini, w; + uint8_t mask; + + REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_MODE); + REG_WRITE(sc, VGA_GC_DATA, 0); + REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_ENABLE_SET_RESET); + REG_WRITE(sc, VGA_GC_DATA, 0x0f); + + rotini = dst & 7; + dstini = dst >> 3; + + while (height > 0) { + dst = dstini; + mask = 1 << (7 - rotini); + for (w = 0; w < width; w += 2) { + REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_SET_RESET); + REG_WRITE(sc, VGA_GC_DATA, *src >> 4); + REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_BIT_MASK); + REG_WRITE(sc, VGA_GC_DATA, mask); + MEM_READ(sc, dst); + MEM_WRITE(sc, dst, 0); + mask >>= 1; + if (mask == 0) { + dst++; + mask = 0x80; + } + REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_SET_RESET); + REG_WRITE(sc, VGA_GC_DATA, *src & 0x0f); + REG_WRITE(sc, VGA_GC_ADDRESS, VGA_GC_BIT_MASK); + REG_WRITE(sc, VGA_GC_DATA, mask); + MEM_READ(sc, dst); + MEM_WRITE(sc, dst, 0); + mask >>= 1; + if (mask == 0) { + dst++; + mask = 0x80; + } + src++; + } + dstini += 80; + height--; + } + return (0); +} + int vga_vbitblt(struct vga_softc *sc, int op, uintptr_t src, uintptr_t dst, int width, int height, va_list ap) @@ -412,7 +460,9 @@ if (error) return (error); - /* TODO -- show beastie logo */ + vga_bitblt_h4tofb(sc, vga_logo_image, + 640 * (480 - vga_logo_height) / 2 + (640 - vga_logo_width) / 2, + vga_logo_width, vga_logo_height); return (0); } ==== //depot/projects/tty/sys/dev/vtc/vtc_con.c#6 (text+ko) ==== @@ -40,6 +40,7 @@ #include <dev/vtc/vtc_con.h> extern char vtc_device_name[]; /* XXX Should be in a header file. */ +extern u_char vtc_font_8x16[]; static cn_checkc_t vtc_cncheckc; static cn_getc_t vtc_cngetc; @@ -91,11 +92,9 @@ vtc_cnputc(struct consdev *cp, int c) { static int col = 0, row = 0; - static uint8_t bitmap[] = { 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, - 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, - 0x00, 0x00, 0x00, 0x00, 0x00 }; struct vtc_conout *vc = cp->cn_arg; int width = vc->vtc_con_width; + u_char *glyph; switch (c) { case 0x0a: @@ -103,8 +102,9 @@ row++; break; default: - vc->vtc_con_bitblt(vc, BITBLT_H1TOFB, (uintptr_t)bitmap, - width * row * 19 + col * 8, 8, 19, 0, 7); + glyph = vtc_font_8x16 + (c * 16); + vc->vtc_con_bitblt(vc, BITBLT_H1TOFB, (uintptr_t)glyph, + width * row * 16 + col * 8, 8, 16, 0, 7); col++; break; } @@ -112,12 +112,12 @@ col = 0; row++; } - if (row >= 24) { - vc->vtc_con_bitblt(vc, BITBLT_FBTOFB, width * 19, 0, width, - 23 * 19); - vc->vtc_con_bitblt(vc, BITBLT_CTOFB, 0, width * 23 * 19, width, - 19); - row = 23; + if (row >= 30) { + vc->vtc_con_bitblt(vc, BITBLT_FBTOFB, width * 16, 0, width, + 29 * 16); + vc->vtc_con_bitblt(vc, BITBLT_CTOFB, 0, width * 29 * 16, width, + 16); + row = 29; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505140706.j4E76SmV057450>