loader: only use vidc_install_font() with vga controller

If the controller does not support VGA, we should not
touch VGA registers.
This commit is contained in:
Toomas Soome 2021-01-05 00:43:39 +02:00
parent 8c1dda1171
commit 58661b3ba9
3 changed files with 17 additions and 0 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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;