VCONS(9) | Kernel Developer's Manual | VCONS(9) |
int
vcons_init(struct vcons_data *vd, void *cookie, struct wsscreen_descr *desc, struct wsdisplay_accessops *accops);
int
vcons_init_screen(struct vcons_data *vd, struct vcons_screen *scr, int exists, long *defattr);
void
vcons_redraw_screen(struct vcons_screen *scr);
The vcons_init() function initializes the framework, it needs to be called for each driver that's going to use vcons.
vcons_init_screen() adds a virtual screen to a display.
vcons_redraw_screen() redraws a screen. A driver should call it when returning to terminal emulation mode, for instance when X exits.
struct vcons_data contains all information needed to manage virtual consoles on a display, usually it will be a member of the driver's softc.
struct vcons_screen describes a virtual screen.
A driver should however provide its own ioctl() and mmap() implementations. Both will receive a pointer to the driver's struct vcons_data as first parameter.
After initialization the driver needs to provide a callback function that will be called whenever a screen is added. Its purpose is to set up the struct rasops_info describing the screen. After that the drawing methods in struct rasops_info will be replaced with wrappers which call the original drawing functions (which may or may not be provided by the driver) only when the respective screen is visible. To add a virtual screen the driver one should call vcons_init_screen() which will call the callback function described above, allocate storage for characters and attributes based on whatever the callback set up in struct rasops_info, and add the screen to a list kept in struct vcons_data.
The callback needs to have this form:
void init_screen(void *cookie, struct vcons_screen *scr, int existing, long *defattr)
and should be stored in the init_screen member found in struct vcons_data. The arguments are:
When attaching a wsdisplay(9) the accesscookie member of the struct wsemuldisplaydev_attach_args passed to config_found() needs to be a pointer to the driver's struct vcons_data.
The following members of struct vcons_screen may be of interest to drivers:
February 12, 2006 | NetBSD 6.1 |