[PATCH 3/3] tty/vt: Fix unreadable kernel messages on vgacon

Zsolt Kajtar posted 3 patches 1 month ago
There is a newer version of this series
[PATCH 3/3] tty/vt: Fix unreadable kernel messages on vgacon
Posted by Zsolt Kajtar 1 month ago
When a 512 glyph font is loaded on vgacon and the bold attributes are in
effect then the kernel console output (printk) becomes unreadable. It is
because the brightness bit (used for bold) is at the same place where
the 8th bit of the glyph index is. This patch adds the missing masking
to ensure the output will be displayed using the lower half of the font.

Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>
---
 drivers/tty/vt/vt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index d54f4d24e..4c8c87f21 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3356,7 +3356,8 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
 				continue;
 		}
 		vc_uniscr_putc(vc, c);
-		scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
+		scr_writew(((vc->vc_attr << 8) & ~vc->vc_hi_font_mask) | c,
+			   (unsigned short *)vc->vc_pos);
 		notify_write(vc, c);
 		cnt++;
 		if (vc->state.x == vc->vc_cols - 1) {
-- 
2.30.2
Re: [PATCH 3/3] tty/vt: Fix unreadable kernel messages on vgacon
Posted by Jiri Slaby 1 month ago
On 29. 08. 25, 21:49, Zsolt Kajtar wrote:
> When a 512 glyph font is loaded on vgacon and the bold attributes are in
> effect then the kernel console output (printk) becomes unreadable. It is
> because the brightness bit (used for bold) is at the same place where
> the 8th bit of the glyph index is. This patch adds the missing masking
> to ensure the output will be displayed using the lower half of the font.
> 
> Signed-off-by: Zsolt Kajtar <soci@c64.rulez.org>

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

I assume you checked all writes to the gfx mem?

> ---
>   drivers/tty/vt/vt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index d54f4d24e..4c8c87f21 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -3356,7 +3356,8 @@ static void vt_console_print(struct console *co, const char *b, unsigned count)
>   				continue;
>   		}
>   		vc_uniscr_putc(vc, c);
> -		scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
> +		scr_writew(((vc->vc_attr << 8) & ~vc->vc_hi_font_mask) | c,
> +			   (unsigned short *)vc->vc_pos);
>   		notify_write(vc, c);
>   		cnt++;
>   		if (vc->state.x == vc->vc_cols - 1) {


-- 
js
suse labs