Lines Matching refs:vd

303 vt_schedule_flush(struct vt_device *vd, int ms)  in vt_schedule_flush()  argument
310 callout_schedule(&vd->vd_timer, hz / (1000 / ms)); in vt_schedule_flush()
316 struct vt_device *vd = vw->vw_device; in vt_resume_flush_timer() local
318 if (vd->vd_curwindow != vw) in vt_resume_flush_timer()
321 if (!(vd->vd_flags & VDF_ASYNC) || in vt_resume_flush_timer()
322 !atomic_cmpset_int(&vd->vd_timer_armed, 0, 1)) in vt_resume_flush_timer()
325 vt_schedule_flush(vd, ms); in vt_resume_flush_timer()
329 vt_suspend_flush_timer(struct vt_device *vd) in vt_suspend_flush_timer() argument
336 VT_LOCK_ASSERT(vd, MA_OWNED); in vt_suspend_flush_timer()
338 if (!(vd->vd_flags & VDF_ASYNC) || in vt_suspend_flush_timer()
339 !atomic_cmpset_int(&vd->vd_timer_armed, 1, 0)) in vt_suspend_flush_timer()
342 callout_stop(&vd->vd_timer); in vt_suspend_flush_timer()
499 struct vt_device *vd; in vt_proc_window_switch() local
507 vd = vw->vw_device; in vt_proc_window_switch()
508 curvw = vd->vd_curwindow; in vt_proc_window_switch()
537 VT_LOCK(vd); in vt_proc_window_switch()
539 VT_UNLOCK(vd); in vt_proc_window_switch()
542 VT_UNLOCK(vd); in vt_proc_window_switch()
568 struct vt_device *vd = vw->vw_device; in vt_window_switch() local
569 struct vt_window *curvw = vd->vd_curwindow; in vt_window_switch()
591 vd->vd_curwindow = vw; in vt_window_switch()
592 vd->vd_flags |= VDF_INVALID; in vt_window_switch()
593 if (vd->vd_driver->vd_postswitch) in vt_window_switch()
594 vd->vd_driver->vd_postswitch(vd); in vt_window_switch()
599 VT_LOCK(vd); in vt_window_switch()
607 vd->vd_driver->vd_postswitch) in vt_window_switch()
608 vd->vd_driver->vd_postswitch(vd); in vt_window_switch()
610 VT_UNLOCK(vd); in vt_window_switch()
615 VT_UNLOCK(vd); in vt_window_switch()
619 vt_suspend_flush_timer(vd); in vt_window_switch()
621 vd->vd_curwindow = vw; in vt_window_switch()
622 vd->vd_flags |= VDF_INVALID; in vt_window_switch()
623 cv_broadcast(&vd->vd_winswitch); in vt_window_switch()
624 VT_UNLOCK(vd); in vt_window_switch()
626 if (vd->vd_driver->vd_postswitch) in vt_window_switch()
627 vd->vd_driver->vd_postswitch(vd); in vt_window_switch()
633 if ((kbd = vd->vd_keyboard) != NULL) { in vt_window_switch()
648 vt_termsize(struct vt_device *vd, struct vt_font *vf, term_pos_t *size) in vt_termsize() argument
651 size->tp_row = vd->vd_height; in vt_termsize()
654 size->tp_col = vd->vd_width; in vt_termsize()
664 vt_termrect(struct vt_device *vd, struct vt_font *vf, term_rect_t *rect) in vt_termrect() argument
671 rect->tr_end.tp_row = vd->vd_height; in vt_termrect()
672 rect->tr_end.tp_col = vd->vd_width; in vt_termrect()
686 vt_winsize(struct vt_device *vd, struct vt_font *vf, struct winsize *size) in vt_winsize() argument
689 size->ws_ypixel = vd->vd_height; in vt_winsize()
693 size->ws_col = size->ws_xpixel = vd->vd_width; in vt_winsize()
705 struct vt_device *vd; in vt_compute_drawable_area() local
709 vd = vw->vw_device; in vt_compute_drawable_area()
716 vw->vw_draw_area.tr_end.tp_col = vd->vd_width; in vt_compute_drawable_area()
717 vw->vw_draw_area.tr_end.tp_row = vd->vd_height; in vt_compute_drawable_area()
728 height = vd->vd_height; in vt_compute_drawable_area()
731 vw->vw_draw_area.tr_begin.tp_col = (vd->vd_width % vf->vf_width) / 2; in vt_compute_drawable_area()
736 rounddown(vd->vd_width, vf->vf_width); in vt_compute_drawable_area()
759 vt_machine_kbdevent(struct vt_device *vd, int c) in vt_machine_kbdevent() argument
772 vd->vd_kbstate &= ~ALKED; in vt_machine_kbdevent()
822 struct vt_device *vd; in vt_scrollmode_kbdevent() local
825 vd = vw->vw_device; in vt_scrollmode_kbdevent()
834 vw = vd->vd_windows[c - F_SCR]; in vt_scrollmode_kbdevent()
838 VT_LOCK(vd); in vt_scrollmode_kbdevent()
856 vt_termsize(vd, vw->vw_font, &size); in vt_scrollmode_kbdevent()
866 vt_termsize(vd, vw->vw_font, &size); in vt_scrollmode_kbdevent()
872 VT_UNLOCK(vd); in vt_scrollmode_kbdevent()
876 vt_processkey(keyboard_t *kbd, struct vt_device *vd, int c) in vt_processkey() argument
878 struct vt_window *vw = vd->vd_curwindow; in vt_processkey()
890 vd->vd_kbstate &= ~ALKED; in vt_processkey()
900 vd->vd_kbstate |= ALKED; in vt_processkey()
909 if (vt_machine_kbdevent(vd, c)) in vt_processkey()
922 vw = vd->vd_windows[c - F_SCR]; in vt_processkey()
931 vw = vd->vd_windows[c]; in vt_processkey()
937 vw = vd->vd_windows[c]; in vt_processkey()
942 VT_LOCK(vd); in vt_processkey()
953 VT_UNLOCK(vd); in vt_processkey()
1002 if (vd->vd_kbstate & ALKED) { in vt_processkey()
1010 kdb_alt_break(c, &vd->vd_altbrk); in vt_processkey()
1022 struct vt_device *vd = arg; in vt_kbdevent() local
1030 vd->vd_keyboard = NULL; in vt_kbdevent()
1031 kbd_release(kbd, (void *)vd); in vt_kbdevent()
1039 vt_processkey(kbd, vd, c); in vt_kbdevent()
1045 vt_allocate_keyboard(struct vt_device *vd) in vt_allocate_keyboard() argument
1057 if (vd->vd_curwindow == &vt_conswindow) { in vt_allocate_keyboard()
1058 grabbed = vd->vd_curwindow->vw_grabbed; in vt_allocate_keyboard()
1060 vtterm_cnungrab_noswitch(vd, vd->vd_curwindow); in vt_allocate_keyboard()
1063 idx0 = kbd_allocate("kbdmux", -1, vd, vt_kbdevent, vd); in vt_allocate_keyboard()
1085 idx0 = kbd_allocate("*", -1, vd, vt_kbdevent, vd); in vt_allocate_keyboard()
1092 vd->vd_keyboard = k0; in vt_allocate_keyboard()
1094 vd->vd_keyboard->kb_index); in vt_allocate_keyboard()
1096 if (vd->vd_curwindow == &vt_conswindow) { in vt_allocate_keyboard()
1098 vtterm_cngrab_noswitch(vd, vd->vd_curwindow); in vt_allocate_keyboard()
1129 struct vt_device *vd = vw->vw_device; in vtterm_bell() local
1131 vtterm_devctl(vt_enable_bell, vd->vd_flags & VDF_QUIET_BELL, in vtterm_bell()
1137 if (vd->vd_flags & VDF_QUIET_BELL) in vtterm_bell()
1160 struct vt_device *vd = vw->vw_device; in vtterm_beep() local
1171 vtterm_devctl(vt_enable_bell, vd->vd_flags & VDF_QUIET_BELL, in vtterm_beep()
1277 vt_is_cursor_in_area(const struct vt_device *vd, const term_rect_t *area) in vt_is_cursor_in_area() argument
1285 mx = vd->vd_mx_drawn + vd->vd_curwindow->vw_draw_area.tr_begin.tp_col; in vt_is_cursor_in_area()
1286 my = vd->vd_my_drawn + vd->vd_curwindow->vw_draw_area.tr_begin.tp_row; in vt_is_cursor_in_area()
1289 mx + vd->vd_mcursor->width <= area->tr_begin.tp_col || in vt_is_cursor_in_area()
1291 my + vd->vd_mcursor->height <= area->tr_begin.tp_row) in vt_is_cursor_in_area()
1297 vt_mark_mouse_position_as_dirty(struct vt_device *vd, int locked) in vt_mark_mouse_position_as_dirty() argument
1304 vw = vd->vd_curwindow; in vt_mark_mouse_position_as_dirty()
1307 x = vd->vd_mx_drawn; in vt_mark_mouse_position_as_dirty()
1308 y = vd->vd_my_drawn; in vt_mark_mouse_position_as_dirty()
1314 ((x + vd->vd_mcursor->width) / vf->vf_width) + 1; in vt_mark_mouse_position_as_dirty()
1316 ((y + vd->vd_mcursor->height) / vf->vf_height) + 1; in vt_mark_mouse_position_as_dirty()
1332 if (vd->vd_driver->vd_invalidate_text) in vt_mark_mouse_position_as_dirty()
1333 vd->vd_driver->vd_invalidate_text(vd, &area); in vt_mark_mouse_position_as_dirty()
1341 vt_set_border(struct vt_device *vd, const term_rect_t *area, in vt_set_border() argument
1344 vd_drawrect_t *drawrect = vd->vd_driver->vd_drawrect; in vt_set_border()
1351 drawrect(vd, 0, 0, vd->vd_width - 1, in vt_set_border()
1356 drawrect(vd, 0, area->tr_begin.tp_row, in vt_set_border()
1360 if (area->tr_end.tp_col < vd->vd_width) in vt_set_border()
1361 drawrect(vd, area->tr_end.tp_col, area->tr_begin.tp_row, in vt_set_border()
1362 vd->vd_width - 1, area->tr_end.tp_row - 1, 1, c); in vt_set_border()
1365 if (area->tr_end.tp_row < vd->vd_height) in vt_set_border()
1366 drawrect(vd, 0, area->tr_end.tp_row, vd->vd_width - 1, in vt_set_border()
1367 vd->vd_height - 1, 1, c); in vt_set_border()
1371 vt_flush_to_buffer(struct vt_device *vd, in vt_flush_to_buffer() argument
1391 if (vd->vd_drawn && (vd->vd_drawn[z] == c) && in vt_flush_to_buffer()
1392 vd->vd_drawnfg && (vd->vd_drawnfg[z] == fg) && in vt_flush_to_buffer()
1393 vd->vd_drawnbg && (vd->vd_drawnbg[z] == bg)) { in vt_flush_to_buffer()
1394 vd->vd_pos_to_flush[z] = false; in vt_flush_to_buffer()
1398 vd->vd_pos_to_flush[z] = true; in vt_flush_to_buffer()
1400 if (vd->vd_drawn) in vt_flush_to_buffer()
1401 vd->vd_drawn[z] = c; in vt_flush_to_buffer()
1402 if (vd->vd_drawnfg) in vt_flush_to_buffer()
1403 vd->vd_drawnfg[z] = fg; in vt_flush_to_buffer()
1404 if (vd->vd_drawnbg) in vt_flush_to_buffer()
1405 vd->vd_drawnbg[z] = bg; in vt_flush_to_buffer()
1411 vt_bitblt_buffer(struct vt_device *vd, const struct vt_window *vw, in vt_bitblt_buffer() argument
1435 if (!vd->vd_pos_to_flush[z]) in vt_bitblt_buffer()
1438 c = vd->vd_drawn[z]; in vt_bitblt_buffer()
1439 fg = vd->vd_drawnfg[z]; in vt_bitblt_buffer()
1440 bg = vd->vd_drawnbg[z]; in vt_bitblt_buffer()
1443 vd->vd_driver->vd_bitblt_bmp(vd, vw, in vt_bitblt_buffer()
1450 if (!vd->vd_mshown) in vt_bitblt_buffer()
1460 if (vt_is_cursor_in_area(vd, &drawn_area)) { in vt_bitblt_buffer()
1461 vd->vd_driver->vd_bitblt_bmp(vd, vw, in vt_bitblt_buffer()
1462 vd->vd_mcursor->map, vd->vd_mcursor->mask, in vt_bitblt_buffer()
1463 vd->vd_mcursor->width, vd->vd_mcursor->height, in vt_bitblt_buffer()
1464 vd->vd_mx_drawn + vw->vw_draw_area.tr_begin.tp_col, in vt_bitblt_buffer()
1465 vd->vd_my_drawn + vw->vw_draw_area.tr_begin.tp_row, in vt_bitblt_buffer()
1466 vd->vd_mcursor_fg, vd->vd_mcursor_bg); in vt_bitblt_buffer()
1472 vt_draw_decorations(struct vt_device *vd) in vt_draw_decorations() argument
1477 vw = vd->vd_curwindow; in vt_draw_decorations()
1480 vt_set_border(vd, &vw->vw_draw_area, a->ta_bgcolor); in vt_draw_decorations()
1483 vtterm_draw_cpu_logos(vd); in vt_draw_decorations()
1487 vt_flush(struct vt_device *vd) in vt_flush() argument
1500 vw = vd->vd_curwindow; in vt_flush()
1504 if (vd->vd_flags & VDF_SPLASH || vw->vw_flags & VWF_BUSY) in vt_flush()
1508 if (((vd->vd_flags & VDF_TEXTMODE) == 0) && (vf == NULL)) in vt_flush()
1511 VT_FLUSH_LOCK(vd); in vt_flush()
1517 cursor_was_shown = vd->vd_mshown; in vt_flush()
1518 cursor_moved = (vd->vd_mx != vd->vd_mx_drawn || in vt_flush()
1519 vd->vd_my != vd->vd_my_drawn); in vt_flush()
1522 if ((vd->vd_flags & VDF_MOUSECURSOR) && /* Mouse support enabled. */ in vt_flush()
1525 vd->vd_mshown = 1; in vt_flush()
1527 vd->vd_mshown = 0; in vt_flush()
1534 if (cursor_was_shown != vd->vd_mshown || in vt_flush()
1535 (vd->vd_mshown && cursor_moved)) in vt_flush()
1536 vt_mark_mouse_position_as_dirty(vd, true); in vt_flush()
1543 vd->vd_mx_drawn = vd->vd_mx; in vt_flush()
1544 vd->vd_my_drawn = vd->vd_my; in vt_flush()
1550 if (vd->vd_mshown && cursor_moved) in vt_flush()
1551 vt_mark_mouse_position_as_dirty(vd, true); in vt_flush()
1558 if (vd->vd_flags & (VDF_INVALID | VDF_SUSPENDED)) { in vt_flush()
1560 vd->vd_flags &= ~VDF_INVALID; in vt_flush()
1562 vt_termrect(vd, vf, &tarea); in vt_flush()
1563 if (vd->vd_driver->vd_invalidate_text) in vt_flush()
1564 vd->vd_driver->vd_invalidate_text(vd, &tarea); in vt_flush()
1568 if (vd->vd_driver->vd_bitblt_after_vtbuf_unlock) { in vt_flush()
1577 vt_flush_to_buffer(vd, vw, &tarea); in vt_flush()
1579 vt_bitblt_buffer(vd, vw, &tarea); in vt_flush()
1582 vt_draw_decorations(vd); in vt_flush()
1595 vd->vd_driver->vd_bitblt_text(vd, vw, &tarea); in vt_flush()
1598 vt_draw_decorations(vd); in vt_flush()
1604 VT_FLUSH_UNLOCK(vd); in vt_flush()
1612 VT_FLUSH_UNLOCK(vd); in vt_flush()
1620 struct vt_device *vd; in vt_timer() local
1623 vd = arg; in vt_timer()
1625 changed = vt_flush(vd); in vt_timer()
1629 vt_schedule_flush(vd, 0); in vt_timer()
1631 vd->vd_timer_armed = 0; in vt_timer()
1661 struct vt_device *vd = vw->vw_device; in vtterm_done() local
1665 if (vd->vd_curwindow != vw) { in vtterm_done()
1666 vd->vd_curwindow = vw; in vtterm_done()
1667 vd->vd_flags |= VDF_INVALID; in vtterm_done()
1668 if (vd->vd_driver->vd_postswitch) in vtterm_done()
1669 vd->vd_driver->vd_postswitch(vd); in vtterm_done()
1671 vd->vd_flags &= ~VDF_SPLASH; in vtterm_done()
1672 vt_flush(vd); in vtterm_done()
1677 vt_flush(vd); in vtterm_done()
1679 } else if (!(vd->vd_flags & VDF_ASYNC)) { in vtterm_done()
1680 vt_flush(vd); in vtterm_done()
1686 vtterm_splash(struct vt_device *vd) in vtterm_splash() argument
1695 if ((vd->vd_flags & VDF_TEXTMODE) != 0 || (boothowto & RB_MUTE) == 0) in vtterm_splash()
1701 if (vd->vd_driver->vd_bitblt_bmp == NULL) in vtterm_splash()
1703 } else if (vd->vd_driver->vd_bitblt_argb == NULL) in vtterm_splash()
1707 if (vd->vd_driver->vd_blank == NULL) in vtterm_splash()
1709 vd->vd_driver->vd_blank(vd, TC_BLACK); in vtterm_splash()
1713 top = (vd->vd_height - vt_logo_height) / 2; in vtterm_splash()
1714 left = (vd->vd_width - vt_logo_width) / 2; in vtterm_splash()
1715 vd->vd_driver->vd_bitblt_bmp(vd, in vtterm_splash()
1716 vd->vd_curwindow, vt_logo_image, NULL, vt_logo_width, in vtterm_splash()
1723 top = (vd->vd_height - si->si_height) / 2; in vtterm_splash()
1724 left = (vd->vd_width - si->si_width) / 2; in vtterm_splash()
1725 vd->vd_driver->vd_bitblt_argb(vd, vd->vd_curwindow, in vtterm_splash()
1729 vd->vd_flags |= VDF_SPLASH; in vtterm_splash()
1871 struct vt_device *vd = vw->vw_device; in vtterm_cnprobe() local
1878 if (vd->vd_flags & VDF_INITIALIZED) in vtterm_cnprobe()
1886 if (vtd->vd_probe(vd) == CN_DEAD) in vtterm_cnprobe()
1894 vd->vd_flags |= VDF_DEAD; in vtterm_cnprobe()
1896 vd->vd_driver = vtdbest; in vtterm_cnprobe()
1897 cp->cn_pri = vd->vd_driver->vd_init(vd); in vtterm_cnprobe()
1902 vd->vd_flags |= VDF_DEAD; in vtterm_cnprobe()
1908 vd->vd_unit = atomic_fetchadd_int(&vt_unit, 1); in vtterm_cnprobe()
1909 vd->vd_windows[VT_CONSWINDOW] = vw; in vtterm_cnprobe()
1915 if ((vd->vd_flags & VDF_TEXTMODE) == 0) { in vtterm_cnprobe()
1925 if (vd->vd_width != 0 && vd->vd_height != 0) in vtterm_cnprobe()
1926 vt_termsize(vd, vw->vw_font, &vw->vw_buf.vb_scr_size); in vtterm_cnprobe()
1931 vt_winsize(vd, vw->vw_font, &wsz); in vtterm_cnprobe()
1938 vtterm_splash(vd); in vtterm_cnprobe()
1940 vd->vd_flags |= VDF_INITIALIZED; in vtterm_cnprobe()
1948 struct vt_device *vd = vw->vw_device; in vtterm_cngetc() local
1956 if (vd->vd_flags & VDF_SPLASH) { in vtterm_cngetc()
1958 vd->vd_flags &= ~VDF_SPLASH; in vtterm_cngetc()
1960 vd->vd_flags |= VDF_INVALID; in vtterm_cngetc()
1961 vt_flush(vd); in vtterm_cngetc()
1965 if ((kbd = vd->vd_keyboard) == NULL) in vtterm_cngetc()
1981 vt_flush(vd); in vtterm_cngetc()
2020 vt_flush(vd); in vtterm_cngetc()
2040 vtterm_cngrab_noswitch(struct vt_device *vd, struct vt_window *vw) in vtterm_cngrab_noswitch() argument
2047 if ((kbd = vd->vd_keyboard) == NULL) in vtterm_cngrab_noswitch()
2066 vtterm_cnungrab_noswitch(struct vt_device *vd, struct vt_window *vw) in vtterm_cnungrab_noswitch() argument
2073 if ((kbd = vd->vd_keyboard) == NULL) in vtterm_cnungrab_noswitch()
2087 struct vt_device *vd; in vtterm_cngrab() local
2091 vd = vw->vw_device; in vtterm_cngrab()
2094 if (vd->vd_grabwindow == NULL) in vtterm_cngrab()
2095 vd->vd_grabwindow = vd->vd_curwindow; in vtterm_cngrab()
2100 vtterm_cngrab_noswitch(vd, vw); in vtterm_cngrab()
2106 struct vt_device *vd; in vtterm_cnungrab() local
2110 vd = vw->vw_device; in vtterm_cnungrab()
2112 MPASS(vd->vd_grabwindow != NULL); in vtterm_cnungrab()
2113 if (vtterm_cnungrab_noswitch(vd, vw) != 0) in vtterm_cnungrab()
2124 grabwindow = vd->vd_grabwindow; in vtterm_cnungrab()
2125 vd->vd_grabwindow = NULL; in vtterm_cnungrab()
2135 struct vt_device *vd = vw->vw_device; in vtterm_opened() local
2137 VT_LOCK(vd); in vtterm_opened()
2138 vd->vd_flags &= ~VDF_SPLASH; in vtterm_opened()
2145 VT_UNLOCK(vd); in vtterm_opened()
2151 struct vt_device *vd = vw->vw_device; in vt_change_font() local
2169 VT_LOCK(vd); in vt_change_font()
2172 VT_UNLOCK(vd); in vt_change_font()
2176 VT_UNLOCK(vd); in vt_change_font()
2178 vt_termsize(vd, vf, &size); in vt_change_font()
2179 vt_winsize(vd, vf, &wsz); in vt_change_font()
2189 VT_LOCK(vd); in vt_change_font()
2204 vd->vd_mx = min(vd->vd_mx, in vt_change_font()
2207 vd->vd_my = min(vd->vd_my, in vt_change_font()
2212 if (vd->vd_curwindow == vw) { in vt_change_font()
2213 vd->vd_flags |= VDF_INVALID; in vt_change_font()
2217 VT_UNLOCK(vd); in vt_change_font()
2310 vt_mouse_terminput_button(struct vt_device *vd, int button) in vt_mouse_terminput_button() argument
2317 vw = vd->vd_curwindow; in vt_mouse_terminput_button()
2321 x = vd->vd_mx / vf->vf_width; in vt_mouse_terminput_button()
2322 y = vd->vd_my / vf->vf_height; in vt_mouse_terminput_button()
2336 vt_mouse_terminput(struct vt_device *vd, int type, int x, int y, int event, in vt_mouse_terminput() argument
2345 vt_mouse_terminput_button(vd, 0); in vt_mouse_terminput()
2347 vt_mouse_terminput_button(vd, 1); in vt_mouse_terminput()
2349 vt_mouse_terminput_button(vd, 2); in vt_mouse_terminput()
2352 vt_mouse_terminput_button(vd, 3); in vt_mouse_terminput()
2359 sc_mouse_input_button(vd, 64); in vt_mouse_terminput()
2362 sc_mouse_input_button(vd, 65); in vt_mouse_terminput()
2389 struct vt_device *vd; in vt_mouse_event() local
2395 vd = main_vd; in vt_mouse_event()
2396 vw = vd->vd_curwindow; in vt_mouse_event()
2416 vt_mouse_terminput(vd, type, x, y, event, cnt); in vt_mouse_event()
2422 x += vd->vd_mx; in vt_mouse_event()
2423 y += vd->vd_my; in vt_mouse_event()
2425 vt_termsize(vd, vf, &size); in vt_mouse_event()
2433 vd->vd_mx = x; in vt_mouse_event()
2434 vd->vd_my = y; in vt_mouse_event()
2435 if (vd->vd_mstate & (MOUSE_BUTTON1DOWN | VT_MOUSE_EXTENDBUTTON)) in vt_mouse_event()
2437 vd->vd_mx / vf->vf_width, in vt_mouse_event()
2438 vd->vd_my / vf->vf_height); in vt_mouse_event()
2480 if (!(vd->vd_mstate & MOUSE_BUTTON1DOWN)) in vt_mouse_event()
2496 vd->vd_mstate |= event; in vt_mouse_event()
2498 vd->vd_mstate &= ~event; in vt_mouse_event()
2500 if (vtbuf_set_mark(&vw->vw_buf, mark, vd->vd_mx / vf->vf_width, in vt_mouse_event()
2501 vd->vd_my / vf->vf_height) == 1) { in vt_mouse_event()
2525 if (len > VD_PASTEBUFSZ(vd)) { in vt_mouse_event()
2526 VD_PASTEBUF(vd) = realloc(VD_PASTEBUF(vd), len, M_VT, in vt_mouse_event()
2529 VD_PASTEBUFSZ(vd) = len; in vt_mouse_event()
2532 vtbuf_extract_marked(&vw->vw_buf, VD_PASTEBUF(vd), len, mark); in vt_mouse_event()
2534 VD_PASTEBUFLEN(vd) = len; in vt_mouse_event()
2543 struct vt_device *vd; in vt_mouse_state() local
2546 vd = main_vd; in vt_mouse_state()
2547 vw = vd->vd_curwindow; in vt_mouse_state()
2559 vt_mark_mouse_position_as_dirty(vd, false); in vt_mouse_state()
2569 struct vt_device *vd = vw->vw_device; in vtterm_mmap() local
2571 if (vd->vd_driver->vd_fb_mmap) in vtterm_mmap()
2572 return (vd->vd_driver->vd_fb_mmap(vd, offset, paddr, nprot, in vtterm_mmap()
2583 struct vt_device *vd = vw->vw_device; in vtterm_ioctl() local
2662 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2678 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2680 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2703 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2705 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2715 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2717 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2740 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2742 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2756 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2758 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2781 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2783 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2799 if (vd->vd_driver->vd_fb_ioctl) in vtterm_ioctl()
2800 return (vd->vd_driver->vd_fb_ioctl(vd, cmd, data, td)); in vtterm_ioctl()
2820 VT_LOCK(vd); in vtterm_ioctl()
2821 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2822 vd->vd_flags |= VDF_INVALID; in vtterm_ioctl()
2825 VT_UNLOCK(vd); in vtterm_ioctl()
2833 vd->vd_flags |= VDF_QUIET_BELL; in vtterm_ioctl()
2835 vd->vd_flags &= ~VDF_QUIET_BELL; in vtterm_ioctl()
2842 if (vw == vd->vd_curwindow) { in vtterm_ioctl()
2844 if ((kbd = vd->vd_keyboard) != NULL) in vtterm_ioctl()
2849 vi->m_num = vd->vd_curwindow->vw_number + 1; in vtterm_ioctl()
2870 if (vd->vd_flags & VDF_MOUSECURSOR) { in vtterm_ioctl()
2871 vd->vd_flags &= ~VDF_MOUSECURSOR; in vtterm_ioctl()
2878 if (!(vd->vd_flags & VDF_MOUSECURSOR)) { in vtterm_ioctl()
2879 vd->vd_flags |= VDF_MOUSECURSOR; in vtterm_ioctl()
2880 vd->vd_mx = vd->vd_width / 2; in vtterm_ioctl()
2881 vd->vd_my = vd->vd_height / 2; in vtterm_ioctl()
2894 if (vd->vd_flags & VDF_TEXTMODE) in vtterm_ioctl()
2963 if (vd->vd_keyboard == NULL || in vtterm_ioctl()
2964 vd->vd_keyboard->kb_index != *(int *)data) { in vtterm_ioctl()
2971 (void *)vd, vt_kbdevent, vd); in vtterm_ioctl()
2973 if ((kbd = vd->vd_keyboard) != NULL) { in vtterm_ioctl()
2974 vt_save_kbd_state(vd->vd_curwindow, kbd); in vtterm_ioctl()
2975 kbd_release(kbd, (void *)vd); in vtterm_ioctl()
2977 kbd = vd->vd_keyboard = kbd_get_keyboard(i); in vtterm_ioctl()
2979 vt_update_kbd_mode(vd->vd_curwindow, kbd); in vtterm_ioctl()
2980 vt_update_kbd_state(vd->vd_curwindow, kbd); in vtterm_ioctl()
2990 if ((kbd = vd->vd_keyboard) != NULL) { in vtterm_ioctl()
2991 vt_save_kbd_state(vd->vd_curwindow, kbd); in vtterm_ioctl()
2992 error = kbd_release(kbd, (void *)vd); in vtterm_ioctl()
2994 vd->vd_keyboard = NULL; in vtterm_ioctl()
3006 return (vt_proc_window_switch(vd->vd_windows[win])); in vtterm_ioctl()
3009 *(int *)data = vd->vd_curwindow->vw_number + 1; in vtterm_ioctl()
3024 VT_LOCK(vd); in vtterm_ioctl()
3026 vw = vd->vd_windows[i]; in vtterm_ioctl()
3031 VT_UNLOCK(vd); in vtterm_ioctl()
3035 VT_UNLOCK(vd); in vtterm_ioctl()
3046 vw = vd->vd_windows[idx - 1]; in vtterm_ioctl()
3048 VT_LOCK(vd); in vtterm_ioctl()
3049 while (vd->vd_curwindow != vw && error == 0) in vtterm_ioctl()
3050 error = cv_wait_sig(&vd->vd_winswitch, &vd->vd_lock); in vtterm_ioctl()
3051 VT_UNLOCK(vd); in vtterm_ioctl()
3114 if ((vw != vd->vd_curwindow) || (vw->vw_smode.mode != in vtterm_ioctl()
3154 vt_allocate_window(struct vt_device *vd, unsigned int window) in vt_allocate_window() argument
3162 vw->vw_device = vd; in vt_allocate_window()
3166 if ((vd->vd_flags & VDF_TEXTMODE) == 0) { in vt_allocate_window()
3171 vt_termsize(vd, vw->vw_font, &size); in vt_allocate_window()
3172 vt_winsize(vd, vw->vw_font, &wsz); in vt_allocate_window()
3178 vd->vd_windows[window] = vw; in vt_allocate_window()
3185 vt_upgrade(struct vt_device *vd) in vt_upgrade() argument
3197 vw = vd->vd_windows[i]; in vt_upgrade()
3200 vw = vt_allocate_window(vd, i); in vt_upgrade()
3217 VT_LOCK(vd); in vt_upgrade()
3218 if (vd->vd_curwindow == NULL) in vt_upgrade()
3219 vd->vd_curwindow = vd->vd_windows[VT_CONSWINDOW]; in vt_upgrade()
3222 if (!(vd->vd_flags & VDF_ASYNC)) { in vt_upgrade()
3224 vt_allocate_keyboard(vd); in vt_upgrade()
3227 callout_init_mtx(&vd->vd_timer, &vd->vd_lock, 0); in vt_upgrade()
3237 atomic_add_acq_int(&vd->vd_timer_armed, 1); in vt_upgrade()
3238 vd->vd_flags |= VDF_ASYNC; in vt_upgrade()
3239 callout_reset(&vd->vd_timer, hz / VT_TIMERFREQ, vt_timer, vd); in vt_upgrade()
3243 VT_UNLOCK(vd); in vt_upgrade()
3246 vt_resize(vd); in vt_upgrade()
3251 vd, EVENTHANDLER_PRI_ANY); in vt_upgrade()
3252 EVENTHANDLER_REGISTER(power_resume, vt_resume_handler, vd, in vt_upgrade()
3258 vt_resize(struct vt_device *vd) in vt_resize() argument
3264 vw = vd->vd_windows[i]; in vt_resize()
3265 VT_LOCK(vd); in vt_resize()
3267 if (!(vd->vd_flags & VDF_TEXTMODE) && vw->vw_font == NULL) in vt_resize()
3269 VT_UNLOCK(vd); in vt_resize()
3282 struct vt_device *vd; in vt_replace_backend() local
3284 vd = main_vd; in vt_replace_backend()
3286 if (vd->vd_flags & VDF_ASYNC) { in vt_replace_backend()
3288 VT_LOCK(vd); in vt_replace_backend()
3289 vt_suspend_flush_timer(vd); in vt_replace_backend()
3290 VT_UNLOCK(vd); in vt_replace_backend()
3295 terminal_mute(vd->vd_curwindow->vw_terminal, 1); in vt_replace_backend()
3302 VT_LOCK(vd); in vt_replace_backend()
3303 vd->vd_flags &= ~VDF_TEXTMODE; in vt_replace_backend()
3311 vd->vd_prev_driver = vd->vd_driver; in vt_replace_backend()
3312 vd->vd_prev_softc = vd->vd_softc; in vt_replace_backend()
3313 vd->vd_driver = drv; in vt_replace_backend()
3314 vd->vd_softc = softc; in vt_replace_backend()
3316 vd->vd_driver->vd_init(vd); in vt_replace_backend()
3317 } else if (vd->vd_prev_driver != NULL && vd->vd_prev_softc != NULL) { in vt_replace_backend()
3325 old_drv = vd->vd_driver; in vt_replace_backend()
3326 old_softc = vd->vd_softc; in vt_replace_backend()
3328 vd->vd_driver = vd->vd_prev_driver; in vt_replace_backend()
3329 vd->vd_softc = vd->vd_prev_softc; in vt_replace_backend()
3330 vd->vd_prev_driver = NULL; in vt_replace_backend()
3331 vd->vd_prev_softc = NULL; in vt_replace_backend()
3333 vd->vd_flags |= VDF_DOWNGRADE; in vt_replace_backend()
3335 vd->vd_driver->vd_init(vd); in vt_replace_backend()
3338 old_drv->vd_fini(vd, old_softc); in vt_replace_backend()
3340 vd->vd_flags &= ~VDF_DOWNGRADE; in vt_replace_backend()
3343 VT_UNLOCK(vd); in vt_replace_backend()
3346 vt_upgrade(vd); in vt_replace_backend()
3352 if (vd->vd_driver->vd_postswitch) in vt_replace_backend()
3353 vd->vd_driver->vd_postswitch(vd); in vt_replace_backend()
3356 if (vd->vd_flags & VDF_SPLASH) in vt_replace_backend()
3357 vtterm_splash(vd); in vt_replace_backend()
3360 if (vd->vd_flags & VDF_ASYNC) { in vt_replace_backend()
3362 terminal_mute(vd->vd_curwindow->vw_terminal, 0); in vt_replace_backend()
3364 vt_resume_flush_timer(vd->vd_curwindow, 0); in vt_replace_backend()
3371 termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal); in vt_replace_backend()
3377 struct vt_device *vd; in vt_suspend_handler() local
3379 vd = priv; in vt_suspend_handler()
3380 vd->vd_flags |= VDF_SUSPENDED; in vt_suspend_handler()
3381 if (vd->vd_driver != NULL && vd->vd_driver->vd_suspend != NULL) in vt_suspend_handler()
3382 vd->vd_driver->vd_suspend(vd); in vt_suspend_handler()
3388 struct vt_device *vd; in vt_resume_handler() local
3390 vd = priv; in vt_resume_handler()
3391 if (vd->vd_driver != NULL && vd->vd_driver->vd_resume != NULL) in vt_resume_handler()
3392 vd->vd_driver->vd_resume(vd); in vt_resume_handler()
3393 vd->vd_flags &= ~VDF_SUSPENDED; in vt_resume_handler()
3447 vt_suspend(struct vt_device *vd) in vt_suspend() argument
3454 vd->vd_savedwindow = vd->vd_curwindow; in vt_suspend()
3456 vt_proc_window_switch(vd->vd_windows[VT_CONSWINDOW]); in vt_suspend()
3460 VT_LOCK(vd); in vt_suspend()
3461 while (vd->vd_curwindow != vd->vd_windows[VT_CONSWINDOW] && error == 0) in vt_suspend()
3462 error = cv_wait_sig(&vd->vd_winswitch, &vd->vd_lock); in vt_suspend()
3463 VT_UNLOCK(vd); in vt_suspend()
3467 vt_resume(struct vt_device *vd) in vt_resume() argument
3473 vt_proc_window_switch(vd->vd_savedwindow); in vt_resume()
3474 vd->vd_savedwindow = NULL; in vt_resume()