vt.h revision 257988
178556Sobrien/*-
278556Sobrien * Copyright (c) 2009, 2013 The FreeBSD Foundation
378556Sobrien * All rights reserved.
478556Sobrien *
578556Sobrien * This software was developed by Ed Schouten under sponsorship from the
678556Sobrien * FreeBSD Foundation.
778556Sobrien *
878556Sobrien * Portions of this software were developed by Oleksandr Rybalko
978556Sobrien * under sponsorship from the FreeBSD Foundation.
1078556Sobrien *
1178556Sobrien * Redistribution and use in source and binary forms, with or without
1278556Sobrien * modification, are permitted provided that the following conditions
1378556Sobrien * are met:
1478556Sobrien * 1. Redistributions of source code must retain the above copyright
1578556Sobrien *    notice, this list of conditions and the following disclaimer.
1678556Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1778556Sobrien *    notice, this list of conditions and the following disclaimer in the
1878556Sobrien *    documentation and/or other materials provided with the distribution.
1978556Sobrien *
2078556Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2178556Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2278556Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2378556Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2478556Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2578556Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2678556Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2778556Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2878556Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2978556Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3078556Sobrien * SUCH DAMAGE.
3178556Sobrien *
3278556Sobrien * $FreeBSD: user/ed/newcons/sys/dev/vt/vt.h 257988 2013-11-11 13:25:49Z ray $
3378556Sobrien */
3478556Sobrien
3578556Sobrien#ifndef _DEV_VT_VT_H_
3678556Sobrien#define	_DEV_VT_VT_H_
3778556Sobrien
3878556Sobrien#include <sys/param.h>
3978556Sobrien#include <sys/_lock.h>
4078556Sobrien#include <sys/_mutex.h>
4178556Sobrien#include <sys/callout.h>
4278556Sobrien#include <sys/condvar.h>
4378556Sobrien#include <sys/consio.h>
4478556Sobrien#include <sys/kbio.h>
4578556Sobrien#include <sys/mouse.h>
4678556Sobrien#include <sys/terminal.h>
4778556Sobrien#include <sys/sysctl.h>
4878556Sobrien
4978556Sobrien#include "opt_syscons.h"
5078556Sobrien
5178556Sobrien#ifndef	VT_MAXWINDOWS
5278556Sobrien#ifdef	MAXCONS
5378556Sobrien#define	VT_MAXWINDOWS	MAXCONS
5478556Sobrien#else
5578556Sobrien#define	VT_MAXWINDOWS	12
5678556Sobrien#endif
5778556Sobrien#endif
5878556Sobrien
5978556Sobrien#define	VT_CONSWINDOW	0
6078556Sobrien
6178556Sobrien#if defined(SC_TWOBUTTON_MOUSE) || defined(VT_TWOBUTTON_MOUSE)
6278556Sobrien#define VT_MOUSE_PASTEBUTTON	MOUSE_BUTTON3DOWN	/* right button */
6378556Sobrien#define VT_MOUSE_EXTENDBUTTON	MOUSE_BUTTON2DOWN	/* not really used */
6478556Sobrien#else
6578556Sobrien#define VT_MOUSE_PASTEBUTTON	MOUSE_BUTTON2DOWN	/* middle button */
6678556Sobrien#define VT_MOUSE_EXTENDBUTTON	MOUSE_BUTTON3DOWN	/* right button */
6778556Sobrien#endif /* defined(SC_TWOBUTTON_MOUSE) || defined(VT_TWOBUTTON_MOUSE) */
6878556Sobrien
6978556Sobrien#define	SC_DRIVER_NAME	"vt"
7078556Sobrien#define	DPRINTF(_l, ...)	if (vt_debug > (_l)) printf( __VA_ARGS__ )
7178556Sobrien#define	ISSIGVALID(sig)	((sig) > 0 && (sig) < NSIG)
7278556Sobrien
7378556Sobrien#define	VT_SYSCTL_INT(_name, _default, _descr)				\
7478556Sobrienstatic int vt_##_name = _default;					\
7578556SobrienSYSCTL_INT(_kern_vt, OID_AUTO, _name, CTLFLAG_RW, &vt_##_name, _default,\
7678556Sobrien		_descr);						\
7778556SobrienTUNABLE_INT("kern.vt." #_name, &vt_##_name);
7878556Sobrien
7978556Sobrienstruct vt_driver;
8078556Sobrien
8178556Sobrienvoid vt_allocate(struct vt_driver *, void *);
8278556Sobrienvoid vt_resume(void);
8378556Sobrienvoid vt_suspend(void);
8478556Sobrien
8578556Sobrientypedef unsigned int 	vt_axis_t;
8678556Sobrien
8778556Sobrien/*
8878556Sobrien * List of locks
8978556Sobrien * (d)	locked by vd_lock
9078556Sobrien * (b)	locked by vb_lock
9178556Sobrien * (G)	locked by Giant
9278556Sobrien * (u)	unlocked, locked by higher levels
9378556Sobrien * (c)	const until freeing
9478556Sobrien * (?)	yet to be determined
9578556Sobrien */
9678556Sobrien
9778556Sobrien/*
9878556Sobrien * Per-device datastructure.
9978556Sobrien */
10078556Sobrien
10178556Sobrienstruct vt_device {
10278556Sobrien	struct vt_window	*vd_windows[VT_MAXWINDOWS]; /* (c) Windows. */
10378556Sobrien	struct vt_window	*vd_curwindow;	/* (d) Current window. */
10478556Sobrien	struct vt_window	*vd_savedwindow;/* (?) Saved for suspend. */
10578556Sobrien	const struct vt_driver	*vd_driver;	/* (c) Graphics driver. */
10678556Sobrien	void			*vd_softc;	/* (u) Driver data. */
10778556Sobrien	uint16_t		 vd_mx;		/* (?) Mouse X. */
10878556Sobrien	uint16_t		 vd_my;		/* (?) Mouse Y. */
10978556Sobrien	vt_axis_t		 vd_mdirtyx;	/* (?) Screen width. */
11078556Sobrien	vt_axis_t		 vd_mdirtyy;	/* (?) Screen height. */
11178556Sobrien	uint32_t		 vd_mstate;	/* (?) Mouse state. */
11278556Sobrien	term_pos_t		 vd_offset;	/* (?) Pixel offset. */
11378556Sobrien	vt_axis_t		 vd_width;	/* (?) Screen width. */
11478556Sobrien	vt_axis_t		 vd_height;	/* (?) Screen height. */
11578556Sobrien	struct mtx		 vd_lock;	/* Per-device lock. */
11678556Sobrien	struct cv		 vd_winswitch;	/* (d) Window switch notify. */
11778556Sobrien	struct callout		 vd_timer;	/* (d) Display timer. */
11878556Sobrien	int			 vd_flags;	/* (d) Device flags. */
11978556Sobrien#define	VDF_TEXTMODE	0x01	/* Do text mode rendering. */
12078556Sobrien#define	VDF_SPLASH	0x02	/* Splash screen active. */
12178556Sobrien#define	VDF_ASYNC	0x04	/* vt_timer() running. */
12278556Sobrien#define	VDF_INVALID	0x08	/* Entire screen should be re-rendered. */
12378556Sobrien#define	VDF_DEAD	0x10	/* Early probing found nothing. */
12478556Sobrien#define	VDF_INITIALIZED	0x20	/* vtterm_cnprobe already done. */
12578556Sobrien#define	VDF_MOUSECURSOR	0x40	/* Mouse cursor visible. */
12678556Sobrien	int			 vd_keyboard;	/* (G) Keyboard index. */
12778556Sobrien	unsigned int		 vd_unit;	/* (c) Device unit. */
12878556Sobrien};
12978556Sobrien
13078556Sobrien/*
13178556Sobrien * Per-window terminal screen buffer.
13278556Sobrien *
13378556Sobrien * Because redrawing is performed asynchronously, the buffer keeps track
13478556Sobrien * of a rectangle that needs to be redrawn (vb_dirtyrect).  Because this
13578556Sobrien * approach seemed to cause suboptimal performance (when the top left
13678556Sobrien * and the bottom right of the screen are modified), it also uses a set
13778556Sobrien * of bitmasks to keep track of the rows and columns (mod 64) that have
13878556Sobrien * been modified.
13978556Sobrien */
14078556Sobrien
14178556Sobrienstruct vt_bufmask {
14278556Sobrien	uint64_t		 vbm_row, vbm_col;
14378556Sobrien#define	VBM_DIRTY		UINT64_MAX
14478556Sobrien};
14578556Sobrien
14678556Sobrienstruct vt_buf {
14778556Sobrien	struct mtx		 vb_lock;	/* Buffer lock. */
14878556Sobrien	term_pos_t		 vb_scr_size;	/* (b) Screen dimensions. */
14978556Sobrien	int			 vb_flags;	/* (b) Flags. */
15078556Sobrien#define	VBF_CURSOR	0x1	/* Cursor visible. */
15178556Sobrien#define	VBF_STATIC	0x2	/* Buffer is statically allocated. */
15278556Sobrien#define	VBF_MTX_INIT	0x4	/* Mutex initialized. */
15378556Sobrien#define	VBF_SCROLL	0x8	/* scroll locked mode. */
15478556Sobrien#define	VBF_HISTORY_FULL 0x10	/* All rows filled. */
15578556Sobrien	int			 vb_history_size;
15678556Sobrien#define	VBF_DEFAULT_HISTORY_SIZE	500
15778556Sobrien	int			 vb_roffset;	/* (b) History rows offset. */
15878556Sobrien	int			 vb_curroffset;	/* (b) Saved rows offset. */
15978556Sobrien	term_pos_t		 vb_cursor;	/* (u) Cursor position. */
16078556Sobrien	term_pos_t		 vb_mark_start;	/* (b) Copy region start. */
16178556Sobrien	term_pos_t		 vb_mark_end;	/* (b) Copy region end. */
16278556Sobrien	term_rect_t		 vb_dirtyrect;	/* (b) Dirty rectangle. */
16378556Sobrien	struct vt_bufmask	 vb_dirtymask;	/* (b) Dirty bitmasks. */
16478556Sobrien	term_char_t		*vb_buffer;	/* (u) Data buffer. */
16578556Sobrien	term_char_t		**vb_rows;	/* (u) Array of rows */
16678556Sobrien};
16778556Sobrien
16878556Sobrienvoid vtbuf_copy(struct vt_buf *, const term_rect_t *, const term_pos_t *);
16978556Sobrienvoid vtbuf_fill_locked(struct vt_buf *, const term_rect_t *, term_char_t);
17078556Sobrienvoid vtbuf_init_early(struct vt_buf *);
17178556Sobrienvoid vtbuf_init(struct vt_buf *, const term_pos_t *);
17278556Sobrienvoid vtbuf_grow(struct vt_buf *, const term_pos_t *, int);
17378556Sobrienvoid vtbuf_putchar(struct vt_buf *, const term_pos_t *, term_char_t);
17478556Sobrienvoid vtbuf_cursor_position(struct vt_buf *, const term_pos_t *);
17578556Sobrienvoid vtbuf_mouse_cursor_position(struct vt_buf *vb, int col, int row);
17678556Sobrienvoid vtbuf_cursor_visibility(struct vt_buf *, int);
17778556Sobrienvoid vtbuf_undirty(struct vt_buf *, term_rect_t *, struct vt_bufmask *);
17878556Sobrienvoid vtbuf_sethistory_size(struct vt_buf *, int);
17978556Sobrienvoid vtbuf_set_mark(struct vt_buf *vb, int type, int col, int row);
18078556Sobrienint vtbuf_iscursor(struct vt_buf *vb, int row, int col);
18178556Sobrien
18278556Sobrien#define	VTB_MARK_END		1
18378556Sobrien#define	VTB_MARK_START		2
18478556Sobrien#define	VTB_MARK_WORD		3
18578556Sobrien#define	VTB_MARK_ROW		4
18678556Sobrien#define	VTB_MARK_EXTEND		5
18778556Sobrien
18878556Sobrien#define	VTBUF_SLCK_ENABLE(vb)	(vb)->vb_flags |= VBF_SCROLL
18978556Sobrien#define	VTBUF_SLCK_DISABLE(vb)	(vb)->vb_flags &= ~VBF_SCROLL
19078556Sobrien
19178556Sobrien#define	VTBUF_MAX_HEIGHT(vb) \
19278556Sobrien	((vb)->vb_history_size)
19378556Sobrien#define	VTBUF_GET_ROW(vb, r) \
19478556Sobrien	((vb)->vb_rows[((vb)->vb_roffset + (r)) % VTBUF_MAX_HEIGHT(vb)])
19578556Sobrien#define	VTBUF_GET_FIELD(vb, r, c) \
19678556Sobrien	((vb)->vb_rows[((vb)->vb_roffset + (r)) % VTBUF_MAX_HEIGHT(vb)][(c)])
19778556Sobrien#define	VTBUF_FIELD(vb, r, c) \
19878556Sobrien	((vb)->vb_rows[((vb)->vb_curroffset + (r)) % VTBUF_MAX_HEIGHT(vb)][(c)])
19978556Sobrien#define	VTBUF_ISCURSOR(vb, r, c) \
20078556Sobrien	vtbuf_iscursor((vb), (r), (c))
20178556Sobrien#define	VTBUF_DIRTYROW(mask, row) \
20278556Sobrien	((mask)->vbm_row & ((uint64_t)1 << ((row) % 64)))
20378556Sobrien#define	VTBUF_DIRTYCOL(mask, col) \
20478556Sobrien	((mask)->vbm_col & ((uint64_t)1 << ((col) % 64)))
20578556Sobrien#define	VTBUF_SPACE_CHAR	(' ' | TC_WHITE << 26 | TC_BLACK << 29)
20678556Sobrien
20778556Sobrien#define	VHS_SET	0
20878556Sobrien#define	VHS_CUR	1
20978556Sobrien#define	VHS_END	2
21078556Sobrienint vthistory_seek(struct vt_buf *, int offset, int whence);
21178556Sobrienvoid vthistory_addlines(struct vt_buf *vb, int offset);
21278556Sobrienvoid vthistory_getpos(const struct vt_buf *, unsigned int *offset);
21378556Sobrien
21478556Sobrien/*
21578556Sobrien * Per-window datastructure.
21678556Sobrien */
21778556Sobrien
21878556Sobrienstruct vt_window {
21978556Sobrien	struct vt_device	*vw_device;	/* (c) Device. */
22078556Sobrien	struct terminal		*vw_terminal;	/* (c) Terminal. */
22178556Sobrien	struct vt_buf		 vw_buf;	/* (u) Screen buffer. */
22278556Sobrien	struct vt_font		*vw_font;	/* (d) Graphical font. */
22378556Sobrien	unsigned int		 vw_number;	/* (c) Window number. */
22478556Sobrien	int			 vw_kbdmode;	/* (?) Keyboard mode. */
22578556Sobrien	char			*vw_kbdsq;	/* Escape sequence queue*/
22678556Sobrien	unsigned int		 vw_flags;	/* (d) Per-window flags. */
22778556Sobrien#define	VWF_BUSY	0x1	/* Busy reconfiguring device. */
22878556Sobrien#define	VWF_OPENED	0x2	/* TTY in use. */
22978556Sobrien#define	VWF_SCROLL	0x4	/* Keys influence scrollback. */
23078556Sobrien#define	VWF_CONSOLE	0x8	/* Kernel message console window. */
23178556Sobrien#define	VWF_VTYLOCK	0x10	/* Prevent window switch. */
23278556Sobrien#define	VWF_SWWAIT_REL	0x10000	/* Program wait for VT acquire is done. */
23378556Sobrien#define	VWF_SWWAIT_ACQ	0x20000	/* Program wait for VT release is done. */
23478556Sobrien	pid_t			 vw_pid;	/* Terminal holding process */
23578556Sobrien	struct proc		*vw_proc;
23678556Sobrien	struct vt_mode		 vw_smode;	/* switch mode */
23778556Sobrien	struct callout		 vw_proc_dead_timer;
23878556Sobrien	struct vt_window	*vw_switch_to;
23978556Sobrien};
24078556Sobrien
24178556Sobrien#define	VT_AUTO		0		/* switching is automatic */
24278556Sobrien#define	VT_PROCESS	1		/* switching controlled by prog */
24378556Sobrien#define	VT_KERNEL	255		/* switching controlled in kernel */
24478556Sobrien
24578556Sobrien#define	IS_VT_PROC_MODE(vw)	((vw)->vw_smode.mode == VT_PROCESS)
24678556Sobrien
24778556Sobrien/*
24878556Sobrien * Per-device driver routines.
24978556Sobrien *
25078556Sobrien * vd_bitbltchr is used when the driver operates in graphics mode, while
25178556Sobrien * vd_putchar is used when the driver operates in text mode
25278556Sobrien * (VDF_TEXTMODE).
25378556Sobrien */
25478556Sobrien
25578556Sobrientypedef int vd_init_t(struct vt_device *vd);
25678556Sobrientypedef void vd_postswitch_t(struct vt_device *vd);
25778556Sobrientypedef void vd_blank_t(struct vt_device *vd, term_color_t color);
25878556Sobrientypedef void vd_bitbltchr_t(struct vt_device *vd, const uint8_t *src,
25978556Sobrien    const uint8_t *mask, int bpl, vt_axis_t top, vt_axis_t left,
26078556Sobrien    unsigned int width, unsigned int height, term_color_t fg, term_color_t bg);
26178556Sobrientypedef void vd_putchar_t(struct vt_device *vd, term_char_t,
26278556Sobrien    vt_axis_t top, vt_axis_t left, term_color_t fg, term_color_t bg);
26378556Sobrien
26478556Sobrienstruct vt_driver {
26578556Sobrien	/* Console attachment. */
26678556Sobrien	vd_init_t	*vd_init;
26778556Sobrien
26878556Sobrien	/* Drawing. */
26978556Sobrien	vd_blank_t	*vd_blank;
27078556Sobrien	vd_bitbltchr_t	*vd_bitbltchr;
27178556Sobrien
27278556Sobrien	/* Text mode operation. */
27378556Sobrien	vd_putchar_t	*vd_putchar;
27478556Sobrien
27578556Sobrien	/* Update display setting on vt switch. */
27678556Sobrien	vd_postswitch_t	*vd_postswitch;
27778556Sobrien
27878556Sobrien	/* Priority to know which one can override */
27978556Sobrien	int		vd_priority;
28078556Sobrien#define	VD_PRIORITY_DUMB	10
28178556Sobrien#define	VD_PRIORITY_GENERIC	100
28278556Sobrien#define	VD_PRIORITY_SPECIFIC	1000
28378556Sobrien};
28478556Sobrien
28578556Sobrien/*
28678556Sobrien * Console device madness.
28778556Sobrien *
28878556Sobrien * Utility macro to make early vt(4) instances work.
28978556Sobrien */
29078556Sobrien
29178556Sobrienextern const struct terminal_class vt_termclass;
29278556Sobrienvoid vt_upgrade(struct vt_device *vd);
29378556Sobrien
29478556Sobrien#define	PIXEL_WIDTH(w)	((w) / 8)
29578556Sobrien#define	PIXEL_HEIGHT(h)	((h) / 16)
29678556Sobrien
29778556Sobrien#ifndef VT_FB_DEFAULT_WIDTH
29878556Sobrien#define	VT_FB_DEFAULT_WIDTH	640
29978556Sobrien#endif
30078556Sobrien#ifndef VT_FB_DEFAULT_HEIGHT
30178556Sobrien#define	VT_FB_DEFAULT_HEIGHT	480
30278556Sobrien#endif
30378556Sobrien
30478556Sobrien#define	VT_CONSDEV_DECLARE(driver, width, height, softc)		\
30578556Sobrienstatic struct terminal	driver ## _consterm;				\
30678556Sobrienstatic struct vt_window	driver ## _conswindow;				\
30778556Sobrienstatic struct vt_device	driver ## _consdev = {				\
30878556Sobrien	.vd_driver = &driver,						\
30978556Sobrien	.vd_softc = (softc),						\
31078556Sobrien	.vd_flags = VDF_INVALID,					\
31178556Sobrien	.vd_windows = { [VT_CONSWINDOW] =  &driver ## _conswindow, },	\
31278556Sobrien	.vd_curwindow = &driver ## _conswindow,				\
31378556Sobrien};									\
31478556Sobrienstatic term_char_t	driver ## _constextbuf[(width) * 		\
31578556Sobrien	    (VBF_DEFAULT_HISTORY_SIZE)];				\
31678556Sobrienstatic term_char_t	*driver ## _constextbufrows[			\
31778556Sobrien	    VBF_DEFAULT_HISTORY_SIZE];					\
31878556Sobrienstatic struct vt_window	driver ## _conswindow = {			\
31978556Sobrien	.vw_number = VT_CONSWINDOW,					\
32078556Sobrien	.vw_flags = VWF_CONSOLE,					\
32178556Sobrien	.vw_buf = {							\
32278556Sobrien		.vb_buffer = driver ## _constextbuf,			\
32378556Sobrien		.vb_rows = driver ## _constextbufrows,			\
32478556Sobrien		.vb_history_size = VBF_DEFAULT_HISTORY_SIZE,		\
32578556Sobrien		.vb_curroffset = 0,					\
32678556Sobrien		.vb_roffset = 0,					\
32778556Sobrien		.vb_flags = VBF_STATIC,					\
32878556Sobrien		.vb_mark_start = {					\
32978556Sobrien			.tp_row = 0,					\
33078556Sobrien			.tp_col = 0,					\
33178556Sobrien		},							\
33278556Sobrien		.vb_mark_end = {					\
33378556Sobrien			.tp_row = 0,					\
33478556Sobrien			.tp_col = 0,					\
33578556Sobrien		},							\
33678556Sobrien		.vb_scr_size = {					\
33778556Sobrien			.tp_row = height,				\
33878556Sobrien			.tp_col = width,				\
33978556Sobrien		},							\
34078556Sobrien	},								\
34178556Sobrien	.vw_device = &driver ## _consdev,				\
34278556Sobrien	.vw_terminal = &driver ## _consterm,				\
34378556Sobrien	.vw_kbdmode = K_XLATE,						\
34478556Sobrien};									\
34578556SobrienTERMINAL_DECLARE_EARLY(driver ## _consterm, vt_termclass,		\
34678556Sobrien    &driver ## _conswindow);						\
34778556SobrienSYSINIT(vt_early_cons, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY,		\
34878556Sobrien    vt_upgrade, &driver ## _consdev)
34978556Sobrien
35078556Sobrien/*
35178556Sobrien * Fonts.
35278556Sobrien *
35378556Sobrien * Remapping tables are used to map Unicode points to glyphs.  They need
35478556Sobrien * to be sorted, because vtfont_lookup() performs a binary search.  Each
35578556Sobrien * font has two remapping tables, for normal and bold.  When a character
35678556Sobrien * is not present in bold, it uses a normal glyph.  When no glyph is
35778556Sobrien * available, it uses glyph 0, which is normally equal to U+FFFD.
35878556Sobrien */
35978556Sobrien
36078556Sobrienstruct vt_font_map {
36178556Sobrien	uint32_t		 vfm_src;
36278556Sobrien	uint16_t		 vfm_dst;
36378556Sobrien	uint16_t		 vfm_len;
36478556Sobrien};
36578556Sobrien
36678556Sobrienstruct vt_font {
36778556Sobrien	struct vt_font_map	*vf_bold;
36878556Sobrien	struct vt_font_map	*vf_normal;
36978556Sobrien	uint8_t			*vf_bytes;
37078556Sobrien	unsigned int		 vf_height, vf_width,
37178556Sobrien				 vf_normal_length, vf_bold_length;
37278556Sobrien	unsigned int		 vf_refcount;
37378556Sobrien};
37478556Sobrien
37578556Sobrienstruct mouse_cursor {
37678556Sobrien	uint8_t map[64 * 64 / 8];
37778556Sobrien	uint8_t mask[64 * 64 / 8];
37878556Sobrien	uint8_t w;
37978556Sobrien	uint8_t h;
38078556Sobrien};
38178556Sobrien
38278556Sobrienconst uint8_t	*vtfont_lookup(const struct vt_font *vf, term_char_t c);
38378556Sobrienstruct vt_font	*vtfont_ref(struct vt_font *vf);
38478556Sobrienvoid		 vtfont_unref(struct vt_font *vf);
38578556Sobrienint		 vtfont_load(vfnt_t *f, struct vt_font **ret);
38678556Sobrien
38778556Sobrien/* Sysmouse. */
38878556Sobrienvoid sysmouse_process_event(mouse_info_t *mi);
38978556Sobrienvoid vt_mouse_event(int type, int x, int y, int event, int cnt);
39078556Sobrien
39178556Sobrien#endif /* !_DEV_VT_VT_H_ */
39278556Sobrien