[coreboot-gerrit] Change in coreboot[master]: libpayload: video: Add support for font scaling with a factor

Paul Kocialkowski (Code Review) gerrit at coreboot.org
Sun Jul 23 15:13:50 CEST 2017


Paul Kocialkowski has uploaded this change for review. ( https://review.coreboot.org/20709


Change subject: libpayload: video: Add support for font scaling with a factor
......................................................................

libpayload: video: Add support for font scaling with a factor

This introduces support for font scaling with a factor provided via
Kconfig. In practice, the font itself is not scaled at any point in
memory and only the logic to determine whether a pixel should be filled
or not is changed.

Thus, it should not significantly impact either the access time or
memory use.

Change-Id: Idff210617c9ec08c6034aef107cfdb34c7cdf029
Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
---
M payloads/libpayload/Kconfig
M payloads/libpayload/drivers/video/font.c
2 files changed, 11 insertions(+), 3 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/20709/1

diff --git a/payloads/libpayload/Kconfig b/payloads/libpayload/Kconfig
index 63cc152..4b38bd2 100644
--- a/payloads/libpayload/Kconfig
+++ b/payloads/libpayload/Kconfig
@@ -321,6 +321,11 @@
 	  Say Y here if coreboot switched to a graphics mode and
 	  your payload wants to use it.
 
+config FONT_SCALE_FACTOR
+	int "Scale factor for the included font"
+	depends on GEODELX_VIDEO_CONSOLE || COREBOOT_VIDEO_CONSOLE
+	default 1
+
 config PC_KEYBOARD
 	bool "Allow input from a PC keyboard"
 	default y if ARCH_X86 # uses IO
diff --git a/payloads/libpayload/drivers/video/font.c b/payloads/libpayload/drivers/video/font.c
index 3e02b00..6dd6b74 100644
--- a/payloads/libpayload/drivers/video/font.c
+++ b/payloads/libpayload/drivers/video/font.c
@@ -33,6 +33,7 @@
 static unsigned char *font;
 static int width;
 static int height;
+static int scale;
 
 int font_width(void)
 {
@@ -47,13 +48,15 @@
 int font_glyph_filled(unsigned int ch, int x, int y)
 {
 	unsigned char *glyph = font + ((ch & 0xFF) * FONT_HEIGHT);
-	return glyph[y] & (1 << x);
+	return glyph[y/scale] & (1 << x/scale);
 }
 
 void font_init(void)
 {
-	width = FONT_WIDTH;
-	height = FONT_HEIGHT;
+	scale = CONFIG_LP_FONT_SCALE_FACTOR;
+
+	width = FONT_WIDTH * scale;
+	height = FONT_HEIGHT * scale;
 
 	font = font8x16;
 }

-- 
To view, visit https://review.coreboot.org/20709
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idff210617c9ec08c6034aef107cfdb34c7cdf029
Gerrit-Change-Number: 20709
Gerrit-PatchSet: 1
Gerrit-Owner: Paul Kocialkowski <contact at paulk.fr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170723/59b8fe74/attachment.html>


More information about the coreboot-gerrit mailing list