1.\" $OpenBSD: rasops.9,v 1.4 2003/04/20 20:04:17 jmc Exp $ 2.\" $NetBSD: rasops.9,v 1.4 2002/02/13 08:18:50 ross Exp $ 3.\" 4.\" Copyright (c) 2001 The NetBSD Foundation, Inc. 5.\" All rights reserved. 6.\" 7.\" This code is derived from software contributed to The NetBSD Foundation 8.\" by Gregory McGarry. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 3. All advertising materials mentioning features or use of this software 19.\" must display the following acknowledgement: 20.\" This product includes software developed by the NetBSD 21.\" Foundation, Inc. and its contributors. 22.\" 4. Neither the name of The NetBSD Foundation nor the names of its 23.\" contributors may be used to endorse or promote products derived 24.\" from this software without specific prior written permission. 25.\" 26.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 27.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 28.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 29.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 30.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36.\" POSSIBILITY OF SUCH DAMAGE. 37.\" 38.Dd October 7, 2001 39.Dt RASOPS 9 40.Os 41.Sh NAME 42.Nm rasops , 43.Nm rasops_init , 44.Nm rasops_reconfig 45.Nd raster display operations 46.Sh SYNOPSIS 47.Fd #include \*[Lt]dev/wscons/wsdisplayvar.h\*[Gt] 48.Fd #include \*[Lt]dev/rasops/rasops.h\*[Gt] 49.Ft int 50.Fn rasops_init "struct rasops_info *ri" "int wantrows" "int wantcols" 51.Ft int 52.Fn rasops_reconfig "struct rasops_info *ri" "int wantrows" "int wantcols" 53.Sh DESCRIPTION 54The 55.Nm 56subsystem is a set of raster operations for 57.Xr wscons 9 . 58.Pp 59The primary data type for using the raster operations is the 60.Em rasops_info 61structure in 62.Pa dev/rasops/rasops.h : 63.Bd -literal 64struct rasops_info { 65 66 /* 67 * These must be filled in by the caller 68 */ 69 int ri_depth; /* depth in bits */ 70 u_char *ri_bits; /* ptr to bits */ 71 int ri_width; /* width (pels) */ 72 int ri_height; /* height (pels) */ 73 int ri_stride; /* stride in bytes */ 74 75 /* 76 * These can optionally be left zeroed out. If you fill ri_font, 77 * but aren't using wsfont, set ri_wsfcookie to -1. 78 */ 79 struct wsdisplay_font *ri_font; 80 int ri_wsfcookie; /* wsfont cookie */ 81 void *ri_hw; /* driver private data */ 82 int ri_crow; /* cursor row */ 83 int ri_ccol; /* cursor column */ 84 int ri_flg; /* various operational flags */ 85 86 /* 87 * These are optional and will default if zero. Meaningless 88 * on depths other than 15, 16, 24 and 32 bits per pel. On 89 * 24 bit displays, ri_{r,g,b}num must be 8. 90 */ 91 u_char ri_rnum; /* number of bits for red */ 92 u_char ri_gnum; /* number of bits for green */ 93 u_char ri_bnum; /* number of bits for blue */ 94 u_char ri_rpos; /* which bit red starts at */ 95 u_char ri_gpos; /* which bit green starts at */ 96 u_char ri_bpos; /* which bit blue starts at */ 97 98 /* 99 * These are filled in by rasops_init() 100 */ 101 int ri_emuwidth; /* width we actually care about */ 102 int ri_emuheight; /* height we actually care about */ 103 int ri_emustride; /* bytes per row we actually care about */ 104 int ri_rows; /* number of rows (characters) */ 105 int ri_cols; /* number of columns (characters) */ 106 int ri_delta; /* row delta in bytes */ 107 int ri_pelbytes; /* bytes per pel (may be zero) */ 108 int ri_fontscale; /* fontheight * fontstride */ 109 int ri_xscale; /* fontwidth * pelbytes */ 110 int ri_yscale; /* fontheight * stride */ 111 u_char *ri_origbits; /* where screen bits actually start */ 112 int ri_xorigin; /* where ri_bits begins (x) */ 113 int ri_yorigin; /* where ri_bits begins (y) */ 114 int32_t ri_devcmap[16]; /* color -\*[Gt] framebuffer data */ 115 116 /* 117 * The emulops you need to use, and the screen caps for wscons 118 */ 119 struct wsdisplay_emulops ri_ops; 120 int ri_caps; 121 122 /* 123 * Callbacks so we can share some code 124 */ 125 void (*ri_do_cursor)(struct rasops_info *); 126 void (*ri_updatecursor)(struct rasops_info *); 127}; 128.Ed 129.Pp 130Valid values for the 131.Em ri_flg 132member are: 133.Pp 134.Bl -tag -offset indent -width RI_CURSORCLIP -compact 135.It RI_FULLCLEAR 136eraserows() hack to clear full screen 137.It RI_FORCEMONO 138monochrome output even if we can do color 139.It RI_BSWAP 140framebuffer endianness doesn't match CPU 141.It RI_CURSOR 142cursor is switched on 143.It RI_CLEAR 144clear display on startup 145.It RI_CENTER 146center onscreen output 147.It RI_CURSORCLIP 148cursor is currently clipped 149.It RI_CFGDONE 150.Fn rasops_reconfig 151completed successfully 152.El 153.Sh FUNCTIONS 154.Bl -tag -width compact 155.It Fn rasops_init "ri" "wantrows" "wantcols" 156Initialise a 157.Em rasops_info 158descriptor. 159The arguments 160.Fa wantrows 161and 162.Fa wantcols 163are the number of rows and columns we'd like. 164In terms of 165optimization, fonts that are a multiple of 8 pixels wide work the 166best. 167.It Fn rasops_reconfig "ri" "wantrows" "wantcols" 168Reconfigure a 169.Em rasops_info 170descriptor because parameters have changed in some way. 171The arguments 172.Fa wantrows 173and 174.Fa wantcols 175are the number of rows and columns we'd like. 176If calling 177.Fn rasops_reconfig 178to change the font and ri_wsfcookie \*[Ge] 0, you must call 179.Fn wsfont_unlock 180on it, and reset it to -1 (or a new, valid cookie). 181.El 182.Sh CODE REFERENCES 183This section describes places within the 184.Ox 185source tree where actual code implementing or utilising the rasops 186subsystem can be found. 187All pathnames are relative to 188.Pa /usr/src . 189.Pp 190The rasops subsystem is implemented within the directory 191.Pa sys/dev/rasops . 192The 193.Nm 194module itself is implemented within the file 195.Pa sys/dev/rasops/rasops.c . 196.Sh SEE ALSO 197.Xr intro 9 198.\" XXX These don't exist yet 199.\" .Xr wscons 9 , 200.\" .Xr wsdisplay 9 , 201.\" .Xr wsfont 9 202.Sh HISTORY 203The 204.Nm 205subsystem appeared in 206.Nx 1.5 207and 208.Ox 209first support appeared in 210.Ox 2.9 . 211.Sh AUTHORS 212The 213.Nm 214subsystem was written by 215.An Andrew Doran 216.Aq ad@NetBSD.org . 217