1 .\" $NetBSD: wsdisplay.9,v 1.21 2008/04/30 13:10:59 martin Exp $
3 .\" Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Gregory McGarry.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nm wsdisplay_switchtoconsole ,
36 .Nm wsdisplay_cnattach ,
37 .Nm wsdisplaydevprint ,
38 .Nm wsemuldisplaydevprint
39 .Nd wscons display support
41 .In dev/wscons/wsconsio.h
42 .In dev/wscons/wsdisplayvar.h
43 .In dev/wscons/wsemulvar.h
44 .In dev/wscons/wsemul_vt100var.h
46 .Fn wsdisplay_switchtoconsole ""
48 .Fn wsdisplay_cnattach "const struct wsscreen_descr *type" "void *cookie" \
49 "int ccol" "int crow" "long defattr"
51 .Fn wsemul_xxx_cnattach "const struct wsscreen_descr *type" "void *cookie" \
52 "int ccol" "int crow" "long defattr"
54 .Fn wsdisplaydevprint "void *aux" "const char *pnp"
56 .Fn wsemuldisplaydevprint "void * aux" "const char *pnp"
60 module is a component of the
62 framework to provide machine-independent display support.
63 Most of the support is provided by the
65 device driver, which must be a child of the hardware device driver.
67 The wscons display interface is complicated by the fact that there are
68 two different interfaces.
69 The first interface corresponds to the simple bit-mapped display which
70 doesn't provide terminal-emulation and console facilities.
71 The second interface provides machine-independent terminal emulation
72 for displays that can support glass-tty terminal emulations.
73 These are character-oriented displays, with row and column numbers
74 starting at zero in the upper left hand corner of the screen.
75 Display drivers which cannot emulate terminals use the first interface.
76 In most cases, the low-level hardware driver can use the
78 interface to provide enough support to allow glass-tty terminal
80 If the display is not the console, terminal emulation does not make
81 sense and the display operates using the bit-mapped interface.
83 The wscons framework allows concurrent displays to be active.
84 It also provides support for multiple screens for each display and
85 therefore allows a virtual terminal on each screen.
86 Multiple terminal emulations and fonts can be active at the same
87 time allowing different emulations and fonts for each screen.
89 Font manipulation facilities for the terminal emulation interface are
94 Display drivers providing support for wscons displays will make use
95 of the following data types:
96 .Bl -tag -width compact
97 .It Fa struct wsdisplay_accessops
98 A structure used to specify the display access functions invoked by
99 userland program which require direct device access, such as X11.
100 All displays must provide this structure and pass it to the
103 It has the following members:
105 int (*ioctl)(void *v, void *vs, u_long cmd,
106 void *data, int flag, struct lwp *l);
107 paddr_t (*mmap)(void *v, void *vs, off_t off, int prot);
108 int (*alloc_screen)(void *,
109 const struct wsscreen_descr *, void **,
110 int *, int *, long *);
111 void (*free_screen)(void *, void *);
112 int (*show_screen)(void *, void *, int,
114 int (*load_font)(void *, void *,
115 struct wsdisplay_font *);
116 void (*pollc)(void *, int);
117 void (*scroll)(void *, void *, int);
122 member defines the function to be called to perform display-specific
126 member defines the function for mapping a part of the display device
127 into user address space.
130 member defines a function for allocating a new screen which can be
131 used as a virtual terminal.
134 member defines a function for de-allocating a screen.
137 member defines a function for mapping a screen onto the physical
139 This function is used for switching between screens.
142 member defines a function for loading a new font into the display.
145 member defines a function for polling the console.
148 member defines a function for scrolling the contents of the display.
152 cookie provided by the display driver associated with these
153 functions, which is passed to them when they are invoked.
161 points to the virtual screen on which these operations were executed.
162 .It Fa struct wsdisplaydev_attach_args
163 A structure used to attach the
165 child device for the simple bit-mapped interface.
166 It has the following members:
168 const struct wsdisplay_accessops *accessops;
171 If the full terminal-emulation interface is to be used, then
172 .Em struct wsemuldisplaydev_attach_args
173 should be used instead.
174 .It Fa struct wsemuldisplaydev_attach_args
175 A structure used to attach the
177 child device for the full terminal emulation interface.
178 It has the following members:
181 const struct wsscreen_list *scrdata;
182 const struct wsdisplay_accessops *accessops;
185 If the simple bit-mapped interface is to be used, then
186 .Em struct wsdisplaydev_attach_args
187 should be used instead.
188 .It Fa struct wsdisplay_emulops
189 A structure used to specify the display emulation functions.
190 All displays intending to provide terminal emulation must provide
191 this structure and pass it to the
194 It has the following members:
196 void (*cursor)(void *c, int on, int row, int col);
197 int (*mapchar)(void *, int, unsigned int *);
198 void (*putchar)(void *c, int row, int col,
199 u_int uc, long attr);
200 void (*copycols)(void *c, int row, int srccol,
201 int dstcol, int ncols);
202 void (*erasecols)(void *c, int row, int startcol,
204 void (*copyrows)(void *c, int srcrow, int dstrow,
206 void (*eraserows)(void *c, int row, int nrows, long);
207 int (*allocattr)(void *c, int fg, int bg, int flags,
209 void (*replaceattr)(void *c, long oldattr,
215 member defines a function for painting (or unpainting, depending on the
217 parameter) the cursor at the specified position.
220 member defines a function for changing the character mapped at a given
221 position in the character table.
224 member defines a function for writing a character on the screen, given
225 its position and attribute.
228 member defines a function for copying a set of columns within the same
232 member defines a function for clearing a set of columns in a line,
233 filling the space with the given attribute.
236 member defines a function for copying a set of complete rows.
239 member defines a function for clearing a set of complete rows,
240 filling the space with the given attribute.
243 member defines a function for converting an attribute specification
244 given by its foreground color, background color and flags, to the
245 internal representation used by the underlying graphics driver.
248 member defines a function for replacing an attribute by another one
249 across the whole visible part of the screen; this function is optional.
253 cookie provided by the display driver associated with these
254 functions, which is passed to them when they are invoked.
255 .It Fa struct wsscreen_descr
256 A structure passed to wscons by the display driver to describe a
258 All displays which can operate as a console must provide this structure
262 It contains the following members:
266 const struct wsdisplay_emulops *textops;
267 int fontwidth, fontheight;
273 member is a set of flags describing the screen capabilities.
274 It can contain the following flags:
276 .Bl -tag -offset indent -width WSSCREEN_UNDERLINE -compact
277 .It WSSCREEN_WSCOLORS
278 minimal color capability
282 can highlight (however)
285 .It WSSCREEN_UNDERLINE
288 .It Fa struct wsscreen_list
289 A structure passed to wscons by the display driver to tell about its
291 It contains the following members:
294 const struct wsscreen_descr **screens;
296 .It Fa struct wscons_syncops
297 A structure passed to wscons by the display driver describing the
298 interface for external screen switching/process synchronization.
299 This structure is optional and only required by displays operating
300 with terminal emulation and intending to support multiple screens.
301 It contains the following members:
303 int (*detach)(void *, int, void (*)(), void *);
304 int (*attach)(void *, int, void (*)(), void *);
305 int (*check)(void *);
306 void (*destroy)(void *);
310 .Bl -tag -width compact
311 .It Fn wsdisplay_switchtoconsole ""
312 Switch the console display to its first screen.
313 .It Fn wsdisplay_cnattach "type" "cookie" "ccol" "crow" "defattr"
314 Attach this display as the console input by specifying the number of
321 specifies the default attribute (color) for the console.
322 .It Fn wsemul_xxx_cnattach "type" "cookie" "ccol" "crow" "defattr"
323 Attach this display as the console with terminal emulation described
326 and specifying the number of columns
332 specifies the default attribute (color) for the console.
333 Different terminal emulations can be active at the same time on one display.
334 .It Fn wsdisplaydevprint "aux" "pnp"
335 The default wsdisplay printing routine used by
339 .It Fn wsemuldisplaydevprint "aux" "pnp"
340 The default wsemul printing routine used by
345 .Sh AUTOCONFIGURATION
346 Display drivers which want to use the wsdisplay module must be a
349 device and provide an attachment interface.
352 device, the display driver must allocate and populate a
353 .Fa wsdisplaydev_attach_args
354 structure with the supported operations and callbacks and call
356 to perform the attach (see
359 Display drivers which want to use the wscons terminal emulation
360 module must be a parent to the
363 .Fa wsemuldisplaydev_attach_args
364 structure instead of the standard
365 .Fa wsdisplaydev_attach_args
368 to perform the attach.
369 If the display is not the console the attachment is the same
370 as wsdisplaydev_attach_args.
372 If the display belongs to the system console, it must describe the
373 default screen by invoking
374 .Fn wsdisplay_cnattach
375 at console attach time.
377 All display manipulation is performed by the wscons interface by using
378 the callbacks defined in the
379 .Em wsdisplay_accessops
383 function is called by the wscons interface to perform display-specific
384 ioctl operations (see
390 function specifies the specific command to perform using the data
392 Valid commands are listed in
393 .Pa sys/dev/wscons/wsconsio.h
396 Operations for terminal emulation are performed using the callbacks
398 .Em wsdisplay_emulops
401 This section describes places within the
403 source tree where actual code implementing or using the
404 machine-independent wscons subsystem can be found.
405 All pathnames are relative to
408 The wscons subsystem is implemented within the directory
412 module itself is implemented within the file
413 .Pa sys/dev/wscons/wsdisplay.c .
414 The terminal emulation support
415 is implemented within the files
416 .Pa sys/dev/wscons/wsemul_* .
418 operations are listed in
419 .Pa sys/dev/wscons/wsconsio.h .