summaryrefslogtreecommitdiff
path: root/payloads/libpayload/drivers/video/geodelx.c
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2017-07-23 15:36:43 +0300
committerMartin Roth <martinroth@google.com>2017-08-03 20:34:59 +0000
commit1c0b603673a3132a1554905dbcfe95c8fadb501e (patch)
treeb5da8d8bdcd72cf02f4440ef75ad9b5d0d8562a7 /payloads/libpayload/drivers/video/geodelx.c
parent5a752f7b8f66d66d65eb1ba2396930f5d0ef6450 (diff)
downloadcoreboot-1c0b603673a3132a1554905dbcfe95c8fadb501e.tar.xz
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 <contact@paulk.fr> Reviewed-on: https://review.coreboot.org/20708 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'payloads/libpayload/drivers/video/geodelx.c')
-rw-r--r--payloads/libpayload/drivers/video/geodelx.c20
1 files changed, 10 insertions, 10 deletions
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 <pci.h>
#include <video_console.h>
#include <arch/msr.h>
-#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 */