Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/vt/vt_core.c
Show First 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
SET_DECLARE(vt_drv_set, struct vt_driver); | SET_DECLARE(vt_drv_set, struct vt_driver); | ||||
#define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_MAX_HEIGHT)) | #define _VTDEFH MAX(100, PIXEL_HEIGHT(VT_FB_MAX_HEIGHT)) | ||||
#define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_MAX_WIDTH)) | #define _VTDEFW MAX(200, PIXEL_WIDTH(VT_FB_MAX_WIDTH)) | ||||
struct terminal vt_consterm; | struct terminal vt_consterm; | ||||
static struct vt_window vt_conswindow; | static struct vt_window vt_conswindow; | ||||
#ifndef SC_NO_CONSDRAWN | |||||
static term_char_t vt_consdrawn[PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * PIXEL_WIDTH(VT_FB_MAX_WIDTH)]; | |||||
static term_color_t vt_consdrawnfg[PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * PIXEL_WIDTH(VT_FB_MAX_WIDTH)]; | |||||
static term_color_t vt_consdrawnbg[PIXEL_HEIGHT(VT_FB_MAX_HEIGHT) * PIXEL_WIDTH(VT_FB_MAX_WIDTH)]; | |||||
#endif | |||||
struct vt_device vt_consdev = { | struct vt_device vt_consdev = { | ||||
.vd_driver = NULL, | .vd_driver = NULL, | ||||
.vd_softc = NULL, | .vd_softc = NULL, | ||||
.vd_prev_driver = NULL, | .vd_prev_driver = NULL, | ||||
.vd_prev_softc = NULL, | .vd_prev_softc = NULL, | ||||
.vd_flags = VDF_INVALID, | .vd_flags = VDF_INVALID, | ||||
.vd_windows = { [VT_CONSWINDOW] = &vt_conswindow, }, | .vd_windows = { [VT_CONSWINDOW] = &vt_conswindow, }, | ||||
.vd_curwindow = &vt_conswindow, | .vd_curwindow = &vt_conswindow, | ||||
.vd_kbstate = 0, | .vd_kbstate = 0, | ||||
#ifndef SC_NO_CUTPASTE | #ifndef SC_NO_CUTPASTE | ||||
.vd_pastebuf = { | .vd_pastebuf = { | ||||
.vpb_buf = NULL, | .vpb_buf = NULL, | ||||
.vpb_bufsz = 0, | .vpb_bufsz = 0, | ||||
.vpb_len = 0 | .vpb_len = 0 | ||||
}, | }, | ||||
.vd_mcursor = &vt_default_mouse_pointer, | .vd_mcursor = &vt_default_mouse_pointer, | ||||
.vd_mcursor_fg = TC_WHITE, | .vd_mcursor_fg = TC_WHITE, | ||||
.vd_mcursor_bg = TC_BLACK, | .vd_mcursor_bg = TC_BLACK, | ||||
#endif | #endif | ||||
#ifndef SC_NO_CONSDRAWN | |||||
.vd_drawn = vt_consdrawn, | |||||
.vd_drawnfg = vt_consdrawnfg, | |||||
.vd_drawnbg = vt_consdrawnbg, | |||||
#endif | |||||
}; | }; | ||||
static term_char_t vt_constextbuf[(_VTDEFW) * (VBF_DEFAULT_HISTORY_SIZE)]; | static term_char_t vt_constextbuf[(_VTDEFW) * (VBF_DEFAULT_HISTORY_SIZE)]; | ||||
static term_char_t *vt_constextbufrows[VBF_DEFAULT_HISTORY_SIZE]; | static term_char_t *vt_constextbufrows[VBF_DEFAULT_HISTORY_SIZE]; | ||||
static struct vt_window vt_conswindow = { | static struct vt_window vt_conswindow = { | ||||
.vw_number = VT_CONSWINDOW, | .vw_number = VT_CONSWINDOW, | ||||
.vw_flags = VWF_CONSOLE, | .vw_flags = VWF_CONSOLE, | ||||
.vw_buf = { | .vw_buf = { | ||||
.vb_buffer = &vt_constextbuf[0], | .vb_buffer = &vt_constextbuf[0], | ||||
▲ Show 20 Lines • Show All 955 Lines • ▼ Show 20 Lines | if (vf != NULL) { | ||||
area.tr_begin.tp_col = x; | area.tr_begin.tp_col = x; | ||||
area.tr_begin.tp_row = y; | area.tr_begin.tp_row = y; | ||||
area.tr_end.tp_col = x + 2; | area.tr_end.tp_col = x + 2; | ||||
area.tr_end.tp_row = y + 2; | area.tr_end.tp_row = y + 2; | ||||
} | } | ||||
if (!locked) | if (!locked) | ||||
vtbuf_lock(&vw->vw_buf); | vtbuf_lock(&vw->vw_buf); | ||||
if (vd->vd_driver->vd_invalidate_text) | |||||
vd->vd_driver->vd_invalidate_text(vd, &area); | |||||
vtbuf_dirty(&vw->vw_buf, &area); | vtbuf_dirty(&vw->vw_buf, &area); | ||||
if (!locked) | if (!locked) | ||||
vtbuf_unlock(&vw->vw_buf); | vtbuf_unlock(&vw->vw_buf); | ||||
} | } | ||||
#endif | #endif | ||||
static void | static void | ||||
vt_set_border(struct vt_device *vd, const term_rect_t *area, | vt_set_border(struct vt_device *vd, const term_rect_t *area, | ||||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | #ifndef SC_NO_CUTPASTE | ||||
* mark the new position as dirty. | * mark the new position as dirty. | ||||
*/ | */ | ||||
if (vd->vd_mshown && cursor_moved) | if (vd->vd_mshown && cursor_moved) | ||||
vt_mark_mouse_position_as_dirty(vd, true); | vt_mark_mouse_position_as_dirty(vd, true); | ||||
#endif | #endif | ||||
vtbuf_undirty(&vw->vw_buf, &tarea); | vtbuf_undirty(&vw->vw_buf, &tarea); | ||||
/* Force a full redraw when the screen contents are invalid. */ | /* Force a full redraw when the screen contents might be invalid. */ | ||||
if (vd->vd_flags & VDF_INVALID) { | if (vd->vd_flags & (VDF_INVALID | VDF_SUSPENDED)) { | ||||
vd->vd_flags &= ~VDF_INVALID; | vd->vd_flags &= ~VDF_INVALID; | ||||
vt_set_border(vd, &vw->vw_draw_area, TC_BLACK); | vt_set_border(vd, &vw->vw_draw_area, TC_BLACK); | ||||
vt_termrect(vd, vf, &tarea); | vt_termrect(vd, vf, &tarea); | ||||
if (vd->vd_driver->vd_invalidate_text) | |||||
vd->vd_driver->vd_invalidate_text(vd, &tarea); | |||||
if (vt_draw_logo_cpus) | if (vt_draw_logo_cpus) | ||||
vtterm_draw_cpu_logos(vd); | vtterm_draw_cpu_logos(vd); | ||||
} | } | ||||
if (tarea.tr_begin.tp_col < tarea.tr_end.tp_col) { | if (tarea.tr_begin.tp_col < tarea.tr_end.tp_col) { | ||||
vd->vd_driver->vd_bitblt_text(vd, vw, &tarea); | vd->vd_driver->vd_bitblt_text(vd, vw, &tarea); | ||||
vtbuf_unlock(&vw->vw_buf); | vtbuf_unlock(&vw->vw_buf); | ||||
return (1); | return (1); | ||||
▲ Show 20 Lines • Show All 1,522 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static void | static void | ||||
vt_suspend_handler(void *priv) | vt_suspend_handler(void *priv) | ||||
{ | { | ||||
struct vt_device *vd; | struct vt_device *vd; | ||||
vd = priv; | vd = priv; | ||||
vd->vd_flags |= VDF_SUSPENDED; | |||||
if (vd->vd_driver != NULL && vd->vd_driver->vd_suspend != NULL) | if (vd->vd_driver != NULL && vd->vd_driver->vd_suspend != NULL) | ||||
vd->vd_driver->vd_suspend(vd); | vd->vd_driver->vd_suspend(vd); | ||||
} | } | ||||
static void | static void | ||||
vt_resume_handler(void *priv) | vt_resume_handler(void *priv) | ||||
{ | { | ||||
struct vt_device *vd; | struct vt_device *vd; | ||||
vd = priv; | vd = priv; | ||||
if (vd->vd_driver != NULL && vd->vd_driver->vd_resume != NULL) | if (vd->vd_driver != NULL && vd->vd_driver->vd_resume != NULL) | ||||
vd->vd_driver->vd_resume(vd); | vd->vd_driver->vd_resume(vd); | ||||
vd->vd_flags &= ~VDF_SUSPENDED; | |||||
} | } | ||||
void | void | ||||
vt_allocate(const struct vt_driver *drv, void *softc) | vt_allocate(const struct vt_driver *drv, void *softc) | ||||
{ | { | ||||
if (!vty_enabled(VTY_VT)) | if (!vty_enabled(VTY_VT)) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |