there were a number of common IOCTLs that weren't documented. i read the code pretty thoroughly to make sure everything here is correct. there are some things i don't know, like what 'stride' is. currently it just mentions that it should be 1 for VGA. i read into the rasops code as far as i could, but it's much less straightforward than the vga code, so there are a few things undocumented there.
first is the diff of the outputs, so that the text is clearer. the patch comes after. 266a267,325 > WSDISPLAYIO_LDFONT (struct wsdisplay_font) > Loads a font specified by the wsdisplay_font structure. > > struct wsdisplay_font { > char name[WSFONT_NAME_SIZE]; > int index; > int firstchar, numchars; > int encoding; > u_int fontwidth, fontheight, stride; > int bitorder, byteorder; > void *cookie; > void *data; > }; > > The name field contains a human readable string used to identify > the font. For VGA fonts, data is loaded in to the slot given in > the index field, or into the next free slot if index is -1. RASOPS > ignores the index field. The firstchar field contains the index of > the first character in the font (always 0 for VGA.) The numchars > field contains the number of characters in the font (always 256 for > VGA.) The encoding field contains one of the following: > > WSDISPLAY_FONTENC_ISO > > WSDISPLAY_FONTENC_IBM > > WSDISPLAY_FONTENC_PCVT > > WSDISPLAY_FONTENC_ISO7 > > The fontwidth and fontheight fields specify the dimensions of a > character cell. fontwidth must be set to 8 for VGA, but can be > between 4 and 32 for RASOPS. The stride field must be 1 for VGA. > The bitorder and byteorder fields must be one of the following > values: > > WSDISPLAY_FONTORDER_KNOWN > indicates no need to convert > > WSDISPLAY_FONTORDER_L2R > default and only option for VGA > > WSDISPLAY_FONTORDER_R2L > > The data field contains the font character data to be loaded. The > cookie field is reserved for internal purposes. > > WSDISPLAYIO_LSFONT (struct wsdisplay_font) > Retrieves the data for a loaded font into the wsdisplay_font > structure. The font is chosen by the index field. For VGA it is an > index into an array. For RASOPS, it is the index into the list of > fonts matching the cell dimensions of the current primary font (in > ri->ri_font). For the argument structure, see WSDISPLAYIO_LDFONT. > > WSDISPLAYIO_USEFONT (struct wsdisplay_font) > Tells an open device to use the font specified in the name field. > An empty name selects the next matching font. For the argument > structure, see WSDISPLAYIO_LDFONT. For RASOPS, data must be null. > 301a361,401 > > WSDISPLAYIO_ADDSCREEN (struct wsdisplay_addscreendata) > Creates a new screen. > > struct wsdisplay_addscreendata { > int idx; /* screen index */ > char screentype[WSSCREEN_NAME_SIZE]; > char emul[WSEMUL_NAME_SIZE]; > }; > > The idx field is the index of the screen to be configured. The > screentype field is matched against builtin screen types. See > vga(4) for valid screen types. The emul field indicates the type of > emulation. Valid options are "sun", "vt100", "dumb" or "" to > select the default. > > WSDISPLAYIO_DELSCREEN (struct wsdisplay_delscreendata) > Deletes an existing screen. > > struct wsdisplay_delscreendata { > int idx; /* screen index */ > int flags; > }; > > The idx field indicates the index of the screen to be deleted. The > flags field is a logical OR of zero or more of the following: > > WSDISPLAY_DELSCR_FORCE > Force deletion of screen even if in use by a userspace > program. > > WSDISPLAY_DELSCR_QUIET > Don't report deletion to console. > > WSDISPLAYIO_GETSCREEN (struct wsdisplay_addscreendata) > Returns information on the screen indicated by idx or the current > screen if idx is -1. The screen and emulation types are returned > in the same structure (see WSDISPLAYIO_GETPARAM ). > > WSDISPLAYIO_SETSCREEN (u_int) > Switch to the screen with the given index. --- share/man/man4/wsdisplay.4 Tue Feb 17 07:36:33 2015 +++ share/man/man4/wsdisplay.4.new Thu Mar 26 03:47:23 2015 @@ -408,10 +408,99 @@ The display is in mapped (frame buffer) mode. Set the current mode of the display. For possible arguments, see .Dv WSDISPLAYIO_GMODE . -.\" WSDISPLAYIO_LDFONT -.\" WSDISPLAYIO_LSFONT -.\" WSDISPLAYIO_DELFONT -.\" WSDISPLAYIO_USEFONT +.It Dv WSDISPLAYIO_LDFONT Pq Li struct wsdisplay_font +Loads a font specified by the wsdisplay_font structure. +.Bd -literal -offset indent +struct wsdisplay_font { + char name[WSFONT_NAME_SIZE]; + int index; + int firstchar, numchars; + int encoding; + u_int fontwidth, fontheight, stride; + int bitorder, byteorder; + void *cookie; + void *data; +}; +.Ed +.Pp +The +.Va name +field contains a human readable string used to identify the font. +For VGA fonts, data is loaded in to the slot given in the +.Va index +field, +or into the next free slot if +.Va index +is -1. +RASOPS ignores the +.Va index +field. +The +.Va firstchar +field contains the index of the first character in the font (always 0 for VGA.) +The +.Va numchars +field contains the number of characters in the font (always 256 for VGA.) +The +.Va encoding +field contains one of the following: +.Bl -tag -width 4n +.It Dv WSDISPLAY_FONTENC_ISO +.It Dv WSDISPLAY_FONTENC_IBM +.It Dv WSDISPLAY_FONTENC_PCVT +.It Dv WSDISPLAY_FONTENC_ISO7 +.El +.Pp +The +.Va fontwidth +and +.Va fontheight +fields specify the dimensions of a character cell. +.Va fontwidth +must be set to 8 for VGA, but can be between 4 and 32 for RASOPS. +The +.Va stride +field must be 1 for VGA. +The +.Va bitorder +and +.Va byteorder +fields must be one of the following values: +.Bl -tag -width 4n +.It Dv WSDISPLAY_FONTORDER_KNOWN +indicates no need to convert +.It Dv WSDISPLAY_FONTORDER_L2R +default and only option for VGA +.It Dv WSDISPLAY_FONTORDER_R2L +.El +.Pp +The +.Va data +field contains the font character data to be loaded. +The +.Va cookie +field is reserved for internal purposes. +.It Dv WSDISPLAYIO_LSFONT Pq Li struct wsdisplay_font +Retrieves the data for a loaded font into the wsdisplay_font structure. +The font is chosen by the +.Va index +field. For VGA it is an index into an array. For RASOPS, it is the index +into the list of fonts matching the cell dimensions of the current primary +font (in ri->ri_font). +For the argument structure, see +.Dv WSDISPLAYIO_LDFONT. +.\" WSDISPLAYIO_DELFONT Pq Li struct wsdisplay_font +.It WSDISPLAYIO_USEFONT Pq Li struct wsdisplay_font +Tells an open device to use the font specified in the +.Va name +field. An empty +.Va name +selects the next matching font. +For the argument structure, see +.Dv WSDISPLAYIO_LDFONT. +For RASOPS, +.Va data +must be null. .It Dv WSDISPLAYIO_GBURNER Pq Li struct wsdisplay_burner Retrieves the state of the screen burner. The returned structure is as follows: @@ -453,10 +542,58 @@ If none of the activity source flags are set, the scre Sets the state of the screen burner. The argument structure, and its semantics, are the same as for .Dv WSDISPLAYIO_GBURNER . -.\" WSDISPLAYIO_ADDSCREEN -.\" WSDISPLAYIO_DELSCREEN -.\" WSDISPLAYIO_GETSCREEN -.\" WSDISPLAYIO_SETSCREEN +.It Dv WSDISPLAYIO_ADDSCREEN Pq Li struct wsdisplay_addscreendata +Creates a new screen. +.Bd -literal -offset indent +struct wsdisplay_addscreendata { + int idx; /* screen index */ + char screentype[WSSCREEN_NAME_SIZE]; + char emul[WSEMUL_NAME_SIZE]; +}; +.Ed +.Pp +The +.Va idx +field is the index of the screen to be configured. The +.Va screentype +field is matched against builtin screen types. See +.Xr vga 4 +for valid screen types. The +.Va emul +field indicates the type of emulation. +Valid options are "sun", "vt100", "dumb" or "" to select the default. +.It Dv WSDISPLAYIO_DELSCREEN Pq Li struct wsdisplay_delscreendata +Deletes an existing screen. +.Bd -literal -offset indent +struct wsdisplay_delscreendata { + int idx; /* screen index */ + int flags; +}; +.Ed +.Pp +The +.Va idx +field indicates the index of the screen to be deleted. The +.Va flags +field is a logical OR of zero or more of the following: +.Bl -tag -width 4n +.It Dv WSDISPLAY_DELSCR_FORCE +Force deletion of screen even if in use by a userspace program. +.It Dv WSDISPLAY_DELSCR_QUIET +Don't report deletion to console. +.El +.Pp +.It Dv WSDISPLAYIO_GETSCREEN Pq Li struct wsdisplay_addscreendata +Returns information on the screen indicated by +.Va idx +or the current screen if +.Va idx +is -1. +The screen and emulation types are returned in the same structure (see +.Dv WSDISPLAYIO_GETPARAM +). +.It Dv WSDISPLAYIO_SETSCREEN Pq Li u_int +Switch to the screen with the given index. .It Dv WSDISPLAYIO_WSMOUSED Pq Li struct wscons_event This call is used by the .Xr wsmoused 8