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;