From owner-svn-src-head@FreeBSD.ORG Mon Apr 7 22:49:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11008FF1; Mon, 7 Apr 2014 22:49:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 E6044DF5; Mon, 7 Apr 2014 22:49:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s37MnfXQ089027; Mon, 7 Apr 2014 22:49:41 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s37MnflZ089026; Mon, 7 Apr 2014 22:49:41 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201404072249.s37MnflZ089026@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 7 Apr 2014 22:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264244 - head/sys/dev/vt 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.17 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: Mon, 07 Apr 2014 22:49:42 -0000 Author: ray Date: Mon Apr 7 22:49:41 2014 New Revision: 264244 URL: http://svnweb.freebsd.org/changeset/base/264244 Log: Fix panic on load new driver while vt(4) is in VGA textmode. o Mute terminal while vt(4) driver change in progress. o Reset VDF_TEXTMODE before init new driver. o Assign default font, if new driver is not in TEXTMODE. o Do not update screen while driver changing. Resolved by: adrian Reported by: tyler MFC after: 7 days Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Apr 7 22:40:29 2014 (r264243) +++ head/sys/dev/vt/vt_core.c Mon Apr 7 22:49:41 2014 (r264244) @@ -705,8 +705,8 @@ vt_bitblt_char(struct vt_device *vd, str static void vt_flush(struct vt_device *vd) { - struct vt_window *vw = vd->vd_curwindow; - struct vt_font *vf = vw->vw_font; + struct vt_window *vw; + struct vt_font *vf; struct vt_bufmask tmask; unsigned int row, col; term_rect_t tarea; @@ -717,6 +717,11 @@ vt_flush(struct vt_device *vd) int bpl, h, w; #endif + vw = vd->vd_curwindow; + if (vw == NULL) return; + vf = vw->vw_font; + if ((vf == NULL) && !(vd->vd_flags & VDF_TEXTMODE)) return; + if (vd->vd_flags & VDF_SPLASH || vw->vw_flags & VWF_BUSY) return; @@ -794,6 +799,7 @@ vt_timer(void *arg) vd = arg; /* Update screen if required. */ vt_flush(vd); + /* Schedule for next update. */ callout_schedule(&vd->vd_timer, hz / VT_TIMERFREQ); } @@ -1882,6 +1888,10 @@ vt_upgrade(struct vt_device *vd) vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT); } terminal_maketty(vw->vw_terminal, "v%r", VT_UNIT(vw)); + + /* Assign default font to window, if not textmode. */ + if (!(vd->vd_flags & VDF_TEXTMODE) && vw->vw_font == NULL) + vw->vw_font = vtfont_ref(&vt_font_default); } if (vd->vd_curwindow == NULL) vd->vd_curwindow = vd->vd_windows[VT_CONSWINDOW]; @@ -1933,9 +1943,21 @@ vt_allocate(struct vt_driver *drv, void if (drv->vd_maskbitbltchr == NULL) drv->vd_maskbitbltchr = drv->vd_bitbltchr; - /* Stop vt_flush periodic task. */ - if (vd->vd_curwindow != NULL) + if (vd->vd_flags & VDF_ASYNC) { + /* Stop vt_flush periodic task. */ callout_drain(&vd->vd_timer); + /* + * Mute current terminal until we done. vt_change_font (called + * from vt_resize) will unmute it. + */ + terminal_mute(vd->vd_curwindow->vw_terminal, 1); + } + + /* + * Reset VDF_TEXTMODE flag, driver who require that flag (vt_vga) will + * set it. + */ + vd->vd_flags &= ~VDF_TEXTMODE; vd->vd_driver = drv; vd->vd_softc = softc; @@ -1951,7 +1973,7 @@ vt_allocate(struct vt_driver *drv, void vtterm_splash(vd); #endif - if (vd->vd_curwindow != NULL) + if (vd->vd_flags & VDF_ASYNC) callout_schedule(&vd->vd_timer, hz / VT_TIMERFREQ); termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal);