From 1c0b603673a3132a1554905dbcfe95c8fadb501e Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sun, 23 Jul 2017 15:36:43 +0300 Subject: libpayload: video: Introduce helpers for font access This introduces helpers for accessing the included font, instead of using hardcoded values provided by the font's header itself. It will allow painlessly adding support for font scaling in a subsequent change. It should not introduce any functionality change. Change-Id: I0277984ec01f49dc51bfc8237ef806f13e3547e2 Signed-off-by: Paul Kocialkowski Reviewed-on: https://review.coreboot.org/20708 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- payloads/libpayload/drivers/video/geodelx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'payloads/libpayload/drivers/video/geodelx.c') diff --git a/payloads/libpayload/drivers/video/geodelx.c b/payloads/libpayload/drivers/video/geodelx.c index ede997cb26..46fa833ec1 100644 --- a/payloads/libpayload/drivers/video/geodelx.c +++ b/payloads/libpayload/drivers/video/geodelx.c @@ -31,7 +31,7 @@ #include #include #include -#include "font8x16.h" +#include "font.h" /* This is the video mode that we're going to use for our VGA screen */ @@ -206,10 +206,10 @@ static void geodelx_set_palette(int entry, unsigned int color) static void geodelx_scroll_up(void) { unsigned char *dst = FB; - unsigned char *src = FB + FONT_HEIGHT * vga_mode.hactive; + unsigned char *src = FB + font_height * vga_mode.hactive; int y; - for(y = 0; y < vga_mode.vactive - FONT_HEIGHT; y++) { + for(y = 0; y < vga_mode.vactive - font_height; y++) { memcpy(dst, src, vga_mode.hactive); dst += vga_mode.hactive; @@ -236,24 +236,22 @@ static void geodelx_clear(void) static void geodelx_putc(u8 row, u8 col, unsigned int ch) { unsigned char *dst; - unsigned char *glyph = font8x16 + ((ch & 0xFF) * FONT_HEIGHT); unsigned char bg = (ch >> 12) & 0xF; unsigned char fg = (ch >> 8) & 0xF; int x, y; - dst = FB + ((row * FONT_HEIGHT) * vga_mode.hactive); - dst += (col * FONT_WIDTH); + dst = FB + ((row * font_height) * vga_mode.hactive); + dst += (col * font_width); - for(y = 0; y < FONT_HEIGHT; y++) { + for(y = 0; y < font_height; y++) { - for(x = FONT_WIDTH - 1; x >= 0; x--) - dst[FONT_WIDTH - x] = (*glyph & (1 << x)) ? + for(x = font_width - 1; x >= 0; x--) + dst[font_width - x] = font_glyph_filled(ch, x, y) ? fg : bg; dst += vga_mode.hactive; - glyph++; } } @@ -270,6 +268,8 @@ static int geodelx_init(void) dcaddr = pci_read_resource(dev, 2); vgaddr = pci_read_resource(dev, 3); + font_init(); + init_video_mode(); /* Set up the palette */ -- cgit v1.2.3