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