Index: sys/dev/vt/vt_core.c =================================================================== --- sys/dev/vt/vt_core.c +++ sys/dev/vt/vt_core.c @@ -248,7 +248,8 @@ vt_resume_flush_timer(struct vt_device *vd, int ms) { - if (!atomic_cmpset_int(&vd->vd_timer_armed, 0, 1)) + if (!(vd->vd_flags & VDF_ASYNC) || + !atomic_cmpset_int(&vd->vd_timer_armed, 0, 1)) return; vt_schedule_flush(vd, ms); @@ -258,7 +259,8 @@ vt_suspend_flush_timer(struct vt_device *vd) { - if (!atomic_cmpset_int(&vd->vd_timer_armed, 1, 0)) + if (!(vd->vd_flags & VDF_ASYNC) || + !atomic_cmpset_int(&vd->vd_timer_armed, 1, 0)) return; callout_drain(&vd->vd_timer); @@ -435,9 +437,11 @@ if (diff < -size.tp_row || diff > size.tp_row) { vw->vw_device->vd_flags |= VDF_INVALID; + vt_resume_flush_timer(vw->vw_device, 0); return; } vw->vw_device->vd_flags |= VDF_INVALID; /*XXX*/ + vt_resume_flush_timer(vw->vw_device, 0); } static int @@ -750,6 +754,7 @@ struct vt_window *vw = tm->tm_softc; vtbuf_cursor_position(&vw->vw_buf, p); + vt_resume_flush_timer(vw->vw_device, 0); } static void @@ -758,6 +763,7 @@ struct vt_window *vw = tm->tm_softc; vtbuf_putchar(&vw->vw_buf, p, c); + vt_resume_flush_timer(vw->vw_device, 0); } static void @@ -766,6 +772,7 @@ struct vt_window *vw = tm->tm_softc; vtbuf_fill_locked(&vw->vw_buf, r, c); + vt_resume_flush_timer(vw->vw_device, 0); } static void @@ -775,6 +782,7 @@ struct vt_window *vw = tm->tm_softc; vtbuf_copy(&vw->vw_buf, r, p); + vt_resume_flush_timer(vw->vw_device, 0); } static void @@ -785,6 +793,7 @@ switch (cmd) { case TP_SHOWCURSOR: vtbuf_cursor_visibility(&vw->vw_buf, arg); + vt_resume_flush_timer(vw->vw_device, 0); break; case TP_MOUSE: vw->vw_mouse_level = arg; @@ -887,7 +896,7 @@ } #endif -static void +static int vt_flush(struct vt_device *vd) { struct vt_window *vw; @@ -901,14 +910,14 @@ vw = vd->vd_curwindow; if (vw == NULL) - return; + return (0); if (vd->vd_flags & VDF_SPLASH || vw->vw_flags & VWF_BUSY) - return; + return (0); vf = vw->vw_font; if (((vd->vd_flags & VDF_TEXTMODE) == 0) && (vf == NULL)) - return; + return (0); #ifndef SC_NO_CUTPASTE cursor_was_shown = vd->vd_mshown; @@ -962,20 +971,27 @@ if (tarea.tr_begin.tp_col < tarea.tr_end.tp_col) { vd->vd_driver->vd_bitblt_text(vd, vw, &tarea); + return (1); } + + return (0); } static void vt_timer(void *arg) { struct vt_device *vd; + int changed; vd = arg; /* Update screen if required. */ - vt_flush(vd); + changed = vt_flush(vd); /* Schedule for next update. */ - vt_schedule_flush(vd, 0); + if (changed) + vt_schedule_flush(vd, 0); + else + vd->vd_timer_armed = 0; } static void @@ -1286,6 +1302,7 @@ if (vd->vd_curwindow == vw) { vt_set_border(vw, vf, TC_BLACK); vd->vd_flags |= VDF_INVALID; + vt_resume_flush_timer(vw->vw_device, 0); } vw->vw_flags &= ~VWF_BUSY; VT_UNLOCK(vd); @@ -1488,7 +1505,7 @@ vd->vd_my = y; if ((vd->vd_mstate & MOUSE_BUTTON1DOWN) && (vtbuf_set_mark(&vw->vw_buf, VTB_MARK_MOVE, - vd->vd_mx / vf->vf_width, + vd->vd_mx / vf->vf_width, vd->vd_my / vf->vf_height) == 1)) { /* @@ -1497,6 +1514,8 @@ */ vd->vd_markedwin = vw; } + + vt_resume_flush_timer(vw->vw_device, 0); return; /* Done */ case MOUSE_BUTTON_EVENT: /* Buttons */ @@ -1581,6 +1600,7 @@ * window with selection. */ vd->vd_markedwin = vw; + vt_resume_flush_timer(vw->vw_device, 0); } } @@ -1604,6 +1624,7 @@ /* Mark mouse position as dirty. */ vt_mark_mouse_position_as_dirty(vd); + vt_resume_flush_timer(vw->vw_device, 0); } #endif