aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fb/vesa.c
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2017-04-02 08:39:32 +0000
committerBruce Evans <bde@FreeBSD.org>2017-04-02 08:39:32 +0000
commit3a98d83edbc054f9b6981a4a9c2ebddd51cc0b96 (patch)
tree0e0d8fc8bd718f179dd3d50f7ee32908f9635dc9 /sys/dev/fb/vesa.c
parent0aecedaa83e19848a280b2a3fe572fafeff09bc4 (diff)
Notes
Diffstat (limited to 'sys/dev/fb/vesa.c')
-rw-r--r--sys/dev/fb/vesa.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/fb/vesa.c b/sys/dev/fb/vesa.c
index d1439ece8316..0698220de78b 100644
--- a/sys/dev/fb/vesa.c
+++ b/sys/dev/fb/vesa.c
@@ -1322,6 +1322,16 @@ vesa_set_mode(video_adapter_t *adp, int mode)
#if VESA_DEBUG > 0
printf("VESA: about to set a VESA mode...\n");
#endif
+ /*
+ * The mode change should reset the palette format to 6 bits, so
+ * we must reset V_ADP_DAC8. Some BIOSes do an incomplete reset
+ * if we call them with an 8-bit palette, so reset directly.
+ */
+ if (adp->va_flags & V_ADP_DAC8) {
+ vesa_bios_set_dac(6);
+ adp->va_flags &= ~V_ADP_DAC8;
+ }
+
/* don't use the linear frame buffer for text modes. XXX */
if (!(info.vi_flags & V_INFO_GRAPHICS))
info.vi_flags &= ~V_INFO_LINEAR;
@@ -1331,9 +1341,6 @@ vesa_set_mode(video_adapter_t *adp, int mode)
if (vesa_bios_set_mode(mode | 0x8000))
return (1);
- /* Palette format is reset by the above VBE function call. */
- adp->va_flags &= ~V_ADP_DAC8;
-
if ((vesa_adp_info->v_flags & V_DAC8) != 0 &&
(info.vi_flags & V_INFO_GRAPHICS) != 0 &&
vesa_bios_set_dac(8) > 6)
@@ -1928,7 +1935,6 @@ vesa_load(void)
static int
vesa_unload(void)
{
- u_char palette[256*3];
int error;
/* if the adapter is currently in a VESA mode, don't unload */
@@ -1942,10 +1948,8 @@ vesa_unload(void)
if ((error = vesa_unload_ioctl()) == 0) {
if (vesa_adp != NULL) {
if ((vesa_adp->va_flags & V_ADP_DAC8) != 0) {
- vesa_bios_save_palette(0, 256, palette, 8);
vesa_bios_set_dac(6);
vesa_adp->va_flags &= ~V_ADP_DAC8;
- vesa_bios_load_palette(0, 256, palette, 6);
}
vesa_adp->va_flags &= ~V_ADP_VESA;
vidsw[vesa_adp->va_index] = prevvidsw;