summaryrefslogtreecommitdiffstats
path: root/sys/dev/vt
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-09-03 13:17:44 +0000
committeremaste <emaste@FreeBSD.org>2014-09-03 13:17:44 +0000
commit0f27004de6381de336d3cdccbcff37737a334dc3 (patch)
tree869d25afb82c81e6972c9babe8f38797d7e496b8 /sys/dev/vt
parent580aa2cf11370985bd2ba0331e499a0b8373cdec (diff)
downloadFreeBSD-src-0f27004de6381de336d3cdccbcff37737a334dc3.zip
FreeBSD-src-0f27004de6381de336d3cdccbcff37737a334dc3.tar.gz
MFC vt(4) work from ray@:
r269188: [Rework vb_buffer and vb_rows assignment] r269192: Remove special handling of console window size. It's done in vt_upgrade() for all windows. r269193: Update comments. r269194: Revise font initialization handling. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/vt')
-rw-r--r--sys/dev/vt/vt_core.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 6f159ec..a2ffe62 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -166,8 +166,8 @@ static struct vt_window vt_conswindow = {
.vw_number = VT_CONSWINDOW,
.vw_flags = VWF_CONSOLE,
.vw_buf = {
- .vb_buffer = vt_constextbuf,
- .vb_rows = vt_constextbufrows,
+ .vb_buffer = &vt_constextbuf[0],
+ .vb_rows = &vt_constextbufrows[0],
.vb_history_size = VBF_DEFAULT_HISTORY_SIZE,
.vb_curroffset = 0,
.vb_roffset = 0,
@@ -996,7 +996,7 @@ vtterm_cnprobe(struct terminal *tm, struct consdev *cp)
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, struct vt_font *vf)
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, struct vt_font *vf)
/* 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, unsigned int window)
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);
+ }
}
}
@@ -2064,7 +2073,6 @@ void
vt_allocate(struct vt_driver *drv, void *softc)
{
struct vt_device *vd;
- struct winsize wsz;
if (!vty_enabled(VTY_VT))
return;
@@ -2112,6 +2120,7 @@ vt_allocate(struct vt_driver *drv, void *softc)
vd->vd_driver->vd_init(vd);
VT_UNLOCK(vd);
+ /* Update windows sizes and initialize last items. */
vt_upgrade(vd);
#ifdef DEV_SPLASH
@@ -2120,16 +2129,17 @@ vt_allocate(struct vt_driver *drv, void *softc)
#endif
if (vd->vd_flags & VDF_ASYNC) {
+ /* Allow to put chars now. */
terminal_mute(vd->vd_curwindow->vw_terminal, 0);
+ /* Rerun timer for screen updates. */
callout_schedule(&vd->vd_timer, hz / VT_TIMERFREQ);
}
+ /*
+ * Register as console. If it already registered, cnadd() will ignore
+ * it.
+ */
termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal);
-
- /* Update console window sizes to actual. */
- vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz);
- terminal_set_winsize_blank(vd->vd_windows[VT_CONSWINDOW]->vw_terminal,
- &wsz, 0, NULL);
}
void
OpenPOWER on IntegriCloud