From owner-svn-src-head@freebsd.org Wed Apr 19 14:49:20 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B4A5D45217; Wed, 19 Apr 2017 14:49:20 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11E6485B; Wed, 19 Apr 2017 14:49:20 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3JEnJTw039275; Wed, 19 Apr 2017 14:49:19 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3JEnJl1039274; Wed, 19 Apr 2017 14:49:19 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201704191449.v3JEnJl1039274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Wed, 19 Apr 2017 14:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317142 - head/sys/dev/fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Apr 2017 14:49:20 -0000 Author: bde Date: Wed Apr 19 14:49:18 2017 New Revision: 317142 URL: https://svnweb.freebsd.org/changeset/base/317142 Log: 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. Modified: head/sys/dev/fb/vga.c Modified: head/sys/dev/fb/vga.c ============================================================================== --- head/sys/dev/fb/vga.c Wed Apr 19 14:43:51 2017 (r317141) +++ head/sys/dev/fb/vga.c Wed Apr 19 14:49:18 2017 (r317142) @@ -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; } }