From owner-svn-src-all@FreeBSD.ORG Mon Jul 28 14:41:23 2014 Return-Path: Delivered-To: svn-src-all@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 018CDC39; Mon, 28 Jul 2014 14:41:23 +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 C9732228F; Mon, 28 Jul 2014 14:41:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s6SEfMSE098062; Mon, 28 Jul 2014 14:41:22 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s6SEfMPg098061; Mon, 28 Jul 2014 14:41:22 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201407281441.s6SEfMPg098061@svn.freebsd.org> From: Aleksandr Rybalko Date: Mon, 28 Jul 2014 14:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269194 - 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-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jul 2014 14:41:23 -0000 Author: ray Date: Mon Jul 28 14:41:22 2014 New Revision: 269194 URL: http://svnweb.freebsd.org/changeset/base/269194 Log: Revise font initialization handling. MFC after: 1 week 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 Jul 28 14:37:59 2014 (r269193) +++ head/sys/dev/vt/vt_core.c Mon Jul 28 14:41:22 2014 (r269194) @@ -996,7 +996,7 @@ vtterm_cnprobe(struct terminal *tm, stru sprintf(cp->cn_name, "ttyv%r", VT_UNIT(vw)); /* Attach default font if not in TEXTMODE. */ - if (!(vd->vd_flags & VDF_TEXTMODE)) + if ((vd->vd_flags & VDF_TEXTMODE) == 0) vw->vw_font = vtfont_ref(&vt_font_default); vtbuf_init_early(&vw->vw_buf); @@ -1147,7 +1147,7 @@ vt_change_font(struct vt_window *vw, str VT_UNLOCK(vd); return (EBUSY); } - if (vw->vw_font == NULL) { + if (vd->vd_flags & VDF_TEXTMODE) { /* Our device doesn't need fonts. */ VT_UNLOCK(vd); return (ENOTTY); @@ -1169,8 +1169,14 @@ vt_change_font(struct vt_window *vw, str /* Actually apply the font to the current window. */ VT_LOCK(vd); - vtfont_unref(vw->vw_font); - vw->vw_font = vtfont_ref(vf); + if (vw->vw_font != vf) { + /* + * In case vt_change_font called to update size we don't need + * to update font link. + */ + vtfont_unref(vw->vw_font); + vw->vw_font = vtfont_ref(vf); + } /* Force a full redraw the next timer tick. */ if (vd->vd_curwindow == vw) @@ -1978,7 +1984,7 @@ vt_allocate_window(struct vt_device *vd, vw->vw_number = window; vw->vw_kbdmode = K_XLATE; - if (!(vd->vd_flags & VDF_TEXTMODE)) + if ((vd->vd_flags & VDF_TEXTMODE) == 0) vw->vw_font = vtfont_ref(&vt_font_default); vt_termsize(vd, vw->vw_font, &size); @@ -2056,7 +2062,10 @@ vt_resize(struct vt_device *vd) vw->vw_font = vtfont_ref(&vt_font_default); VT_UNLOCK(vd); /* Resize terminal windows */ - vt_change_font(vw, vw->vw_font); + while (vt_change_font(vw, vw->vw_font) == EBUSY) { + DPRINTF(100, "%s: vt_change_font() is busy, " + "window %d\n", __func__, i); + } } }