Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Jan 2021 22:52:20 GMT
From:      Toomas Soome <tsoome@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 58661b3ba9eb - main - loader: only use vidc_install_font() with vga controller
Message-ID:  <202101042252.104MqKTx041944@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by tsoome:

URL: https://cgit.FreeBSD.org/src/commit/?id=58661b3ba9ebe82f889cbc336afe618ad7f7940a

commit 58661b3ba9ebe82f889cbc336afe618ad7f7940a
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2021-01-04 22:43:39 +0000
Commit:     Toomas Soome <tsoome@FreeBSD.org>
CommitDate: 2021-01-04 22:49:18 +0000

    loader: only use vidc_install_font() with vga controller
    
    If the controller does not support VGA, we should not
    touch VGA registers.
---
 stand/i386/libi386/vbe.c        | 12 ++++++++++++
 stand/i386/libi386/vbe.h        |  1 +
 stand/i386/libi386/vidconsole.c |  4 ++++
 3 files changed, 17 insertions(+)

diff --git a/stand/i386/libi386/vbe.c b/stand/i386/libi386/vbe.c
index 7681eb633b85..232f13dab077 100644
--- a/stand/i386/libi386/vbe.c
+++ b/stand/i386/libi386/vbe.c
@@ -226,6 +226,18 @@ vga_set_grc(int reg, int i, int v)
 	vga_set_indexed(reg, VGA_GC_ADDRESS, VGA_GC_DATA, i, v);
 }
 
+/*
+ * Return true when this controller is VGA compatible.
+ */
+bool
+vbe_is_vga(void)
+{
+	if (vbe == NULL)
+		return (false);
+
+	return ((vbe->Capabilities & VBE_CAP_NONVGA) == 0);
+}
+
 /* Actually assuming mode 3. */
 void
 bios_set_text_mode(int mode)
diff --git a/stand/i386/libi386/vbe.h b/stand/i386/libi386/vbe.h
index ff28b960df9c..79574349baee 100644
--- a/stand/i386/libi386/vbe.h
+++ b/stand/i386/libi386/vbe.h
@@ -152,6 +152,7 @@ int vga_get_grc(int, int);
 void vga_set_grc(int, int, int);
 
 /* high-level VBE helpers, from vbe.c */
+bool vbe_is_vga(void);
 void bios_set_text_mode(int);
 int biosvbe_palette_format(int *);
 void vbe_init(void);
diff --git a/stand/i386/libi386/vidconsole.c b/stand/i386/libi386/vidconsole.c
index c0da698d2d96..e373bc638ee4 100644
--- a/stand/i386/libi386/vidconsole.c
+++ b/stand/i386/libi386/vidconsole.c
@@ -780,6 +780,10 @@ vidc_install_font(void)
 	int bpc, f_offset;
 	teken_attr_t a = { 0 };
 
+	/* We can only program VGA registers. */
+	if (!vbe_is_vga())
+		return;
+
 	if (gfx_state.tg_fb_type != FB_TEXT)
 		return;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101042252.104MqKTx041944>