[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200517125754.8934-3-ardb@kernel.org>
Date: Sun, 17 May 2020 14:57:49 +0200
From: Ard Biesheuvel <ardb@...nel.org>
To: linux-efi@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Ard Biesheuvel <ardb@...nel.org>, linux-kernel@...r.kernel.org,
Arvind Sankar <nivedita@...m.mit.edu>,
Benjamin Thiel <b.thiel@...teo.de>,
Borislav Petkov <bp@...en8.de>, Dave Young <dyoung@...hat.com>,
Heinrich Schuchardt <xypron.glpk@....de>,
Javier Martinez Canillas <javierm@...hat.com>,
Jerry Snitselaar <jsnitsel@...hat.com>,
Lenny Szubowicz <lszubowi@...hat.com>,
linux-acpi@...r.kernel.org, Loic Yhuel <loic.yhuel@...il.com>,
Matthew Garrett <mjg59@...gle.com>,
Mike Lothian <mike@...eburn.co.uk>,
Punit Agrawal <punit1.agrawal@...hiba.co.jp>
Subject: [PATCH 2/7] efi/earlycon: Fix early printk for wider fonts
From: Dave Young <dyoung@...hat.com>
When I play with terminus fonts I noticed the efi early printk does
not work because the earlycon code assumes font width is 8.
Here add the code to adapt with larger fonts. Tested with all kinds
of kernel built-in fonts on my laptop. Also tested with a local draft
patch for 14x28 !bold terminus font.
Signed-off-by: Dave Young <dyoung@...hat.com>
Link: https://lore.kernel.org/r/20200412024927.GA6884@dhcp-128-65.nay.redhat.com
Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
---
drivers/firmware/efi/earlycon.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/firmware/efi/earlycon.c b/drivers/firmware/efi/earlycon.c
index 5d4f84781aa0..a52236e11e5f 100644
--- a/drivers/firmware/efi/earlycon.c
+++ b/drivers/firmware/efi/earlycon.c
@@ -114,14 +114,16 @@ static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h)
const u32 color_black = 0x00000000;
const u32 color_white = 0x00ffffff;
const u8 *src;
- u8 s8;
- int m;
+ int m, n, bytes;
+ u8 x;
- src = font->data + c * font->height;
- s8 = *(src + h);
+ bytes = BITS_TO_BYTES(font->width);
+ src = font->data + c * font->height * bytes + h * bytes;
- for (m = 0; m < 8; m++) {
- if ((s8 >> (7 - m)) & 1)
+ for (m = 0; m < font->width; m++) {
+ n = m % 8;
+ x = *(src + m / 8);
+ if ((x >> (7 - n)) & 1)
*dst = color_white;
else
*dst = color_black;
--
2.17.1
Powered by blists - more mailing lists