From owner-svn-src-head@FreeBSD.ORG Mon Aug 25 19:52:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0992C9C5; Mon, 25 Aug 2014 19:52:14 +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 E8DAD3552; Mon, 25 Aug 2014 19:52:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7PJqDsu000558; Mon, 25 Aug 2014 19:52:13 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7PJqDVZ000557; Mon, 25 Aug 2014 19:52:13 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408251952.s7PJqDVZ000557@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Mon, 25 Aug 2014 19:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270618 - 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.18-1 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, 25 Aug 2014 19:52:14 -0000 Author: dumbbell Date: Mon Aug 25 19:52:13 2014 New Revision: 270618 URL: http://svnweb.freebsd.org/changeset/base/270618 Log: vt(4): Intialize drawable area rectangle each time a font is loaded This also fixes a problem where early in boot, the area was zero, leading to nothing displayed for a few seconds. MFC after: 1 week Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Aug 25 19:45:46 2014 (r270617) +++ head/sys/dev/vt/vt_core.c Mon Aug 25 19:52:13 2014 (r270618) @@ -415,6 +415,31 @@ vt_winsize(struct vt_device *vd, struct } } +static inline void +vt_compute_drawable_area(struct vt_window *vw) +{ + struct vt_device *vd; + struct vt_font *vf; + + if (vw->vw_font == NULL) + return; + + vd = vw->vw_device; + vf = vw->vw_font; + + /* + * Compute the drawable area, so that the text is centered on + * the screen. + */ + + vw->vw_draw_area.tr_begin.tp_col = (vd->vd_width % vf->vf_width) / 2; + vw->vw_draw_area.tr_begin.tp_row = (vd->vd_height % vf->vf_height) / 2; + vw->vw_draw_area.tr_end.tp_col = vw->vw_draw_area.tr_begin.tp_col + + vd->vd_width / vf->vf_width * vf->vf_width; + vw->vw_draw_area.tr_end.tp_row = vw->vw_draw_area.tr_begin.tp_row + + vd->vd_height / vf->vf_height * vf->vf_height; +} + static void vt_scroll(struct vt_window *vw, int offset, int whence) { @@ -1067,8 +1092,10 @@ 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) == 0) + if ((vd->vd_flags & VDF_TEXTMODE) == 0) { vw->vw_font = vtfont_ref(&vt_font_default); + vt_compute_drawable_area(vw); + } vtbuf_init_early(&vw->vw_buf); vt_winsize(vd, vw->vw_font, &wsz); @@ -1258,17 +1285,6 @@ vt_change_font(struct vt_window *vw, str vt_termsize(vd, vf, &size); vt_winsize(vd, vf, &wsz); - /* - * Compute the drawable area, so that the text is centered on - * the screen. - */ - vw->vw_draw_area.tr_begin.tp_col = (vd->vd_width % vf->vf_width) / 2; - vw->vw_draw_area.tr_begin.tp_row = (vd->vd_height % vf->vf_height) / 2; - vw->vw_draw_area.tr_end.tp_col = vw->vw_draw_area.tr_begin.tp_col + - vd->vd_width / vf->vf_width * vf->vf_width; - vw->vw_draw_area.tr_end.tp_row = vw->vw_draw_area.tr_begin.tp_row + - vd->vd_height / vf->vf_height * vf->vf_height; - /* Grow the screen buffer and terminal. */ terminal_mute(tm, 1); vtbuf_grow(&vw->vw_buf, &size, vw->vw_buf.vb_history_size); @@ -1284,6 +1300,7 @@ vt_change_font(struct vt_window *vw, str */ vtfont_unref(vw->vw_font); vw->vw_font = vtfont_ref(vf); + vt_compute_drawable_area(vw); } /* Force a full redraw the next timer tick. */ @@ -2071,8 +2088,10 @@ vt_allocate_window(struct vt_device *vd, vw->vw_number = window; vw->vw_kbdmode = K_XLATE; - if ((vd->vd_flags & VDF_TEXTMODE) == 0) + if ((vd->vd_flags & VDF_TEXTMODE) == 0) { vw->vw_font = vtfont_ref(&vt_font_default); + vt_compute_drawable_area(vw); + } vt_termsize(vd, vw->vw_font, &size); vt_winsize(vd, vw->vw_font, &wsz); @@ -2146,8 +2165,10 @@ vt_resize(struct vt_device *vd) vw = vd->vd_windows[i]; VT_LOCK(vd); /* Assign default font to window, if not textmode. */ - if (!(vd->vd_flags & VDF_TEXTMODE) && vw->vw_font == NULL) + if (!(vd->vd_flags & VDF_TEXTMODE) && vw->vw_font == NULL) { vw->vw_font = vtfont_ref(&vt_font_default); + vt_compute_drawable_area(vw); + } VT_UNLOCK(vd); /* Resize terminal windows */ while (vt_change_font(vw, vw->vw_font) == EBUSY) {