aboutsummaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2017-04-19 14:49:18 +0000
committerBruce Evans <bde@FreeBSD.org>2017-04-19 14:49:18 +0000
commit7b8306bcd2c6947c55858fc3dbaa51b42d4f4b43 (patch)
treece57ceef420cf7ba46d25010e7e3c1999bef82f1 /sys/dev
parente9f3f88adff208aaa716ee2cc63c30c1ac72e5eb (diff)
downloadsrc-7b8306bcd2c6947c55858fc3dbaa51b42d4f4b43.tar.gz
src-7b8306bcd2c6947c55858fc3dbaa51b42d4f4b43.zip
When we don't use the parameter table in the BIOS, also don't use most
of our tweaked modes based on it. In practice, this means limiting the tweaked modes to at most 80x50 based on 80x25, so there are no 90-column, 80x30 or 80x60 modes. This happens when the the initial mode is is not in the parameter table. We always detected this case, but assumed that the (necessarily nonstandard) parameters of the initial mode could be tweaked just as blindly as the probably-standard parameters of initial modes in the table. On 1 laptop system with near-VGA where the initial mode is nonstandard, this is because the hardware apparently doesn't support 9-bit mode, but otherwise has standard timing. The initial mode has 8-bit mode CRTC horizontal parameters similar to those in syscons' 90-column modes and in EGA modes. Tweaking these values for the 90-column modes has little effect except to print the extra 10 columns off the screen. Tweaking from 80x25 to 80x30 requires changing from 400 scan lines to 480. This can probably be made to work, but syscons blindly applies values based on standard timing. This gives blank output. Tweaking from 80x25 to 80x50 doesn't change the CRTC timing and works.
Notes
Notes: svn path=/head/; revision=317142
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fb/vga.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/sys/dev/fb/vga.c b/sys/dev/fb/vga.c
index 537552a8a844..f9ef2abf3935 100644
--- a/sys/dev/fb/vga.c
+++ b/sys/dev/fb/vga.c
@@ -939,7 +939,7 @@ probe_adapters(void)
#if !defined(VGA_NO_BIOS) && !defined(VGA_NO_MODE_CHANGE)
u_char *mp;
#endif
- int i;
+ int height, i, width;
/* do this test only once */
if (vga_init_done)
@@ -1134,15 +1134,34 @@ probe_adapters(void)
case COMP_DIFFERENT:
default:
/*
- * Don't use the parameter table in BIOS. It doesn't
- * look familiar to us. Video mode switching is allowed
- * only if the new mode is the same as or based on
- * the initial mode.
+ * Don't use the parameter table in the BIOS, since
+ * even the BIOS doesn't use it for the initial mode.
+ * Restrict the tweaked modes to (in practice) 80x50
+ * from 80x25 with 400 scan lines, since the only safe
+ * tweak is changing the characters from 8x16 to 8x8.
*/
video_mode_ptr = NULL;
bzero(mode_map, sizeof(mode_map));
mode_map[adp->va_initial_mode] = adpstate.regs;
rows_offset = 1;
+
+ width = height = -1;
+ for (i = 0; i < nitems(bios_vmode); ++i) {
+ if (bios_vmode[i].vi_mode == adp->va_initial_mode) {
+ width = bios_vmode[i].vi_width;
+ height = bios_vmode[i].vi_height;
+ break;
+ }
+ }
+ for (i = 0; i < nitems(bios_vmode); ++i) {
+ if (bios_vmode[i].vi_mode != adp->va_initial_mode &&
+ map_mode_num(bios_vmode[i].vi_mode) ==
+ adp->va_initial_mode &&
+ (bios_vmode[i].vi_width != width ||
+ bios_vmode[i].vi_height != 2 * height)) {
+ bios_vmode[i].vi_mode = NA;
+ }
+ }
break;
}
}