1.\" $OpenBSD: rasops.9,v 1.15 2014/01/20 05:07:49 schwarze 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.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" POSSIBILITY OF SUCH DAMAGE. 30.\" 31.Dd $Mdocdate: January 20 2014 $ 32.Dt RASOPS 9 33.Os 34.Sh NAME 35.Nm rasops , 36.Nm rasops_init , 37.Nm rasops_reconfig 38.Nd raster display operations 39.Sh SYNOPSIS 40.In dev/wscons/wsdisplayvar.h 41.In dev/rasops/rasops.h 42.Ft int 43.Fn rasops_init "struct rasops_info *ri" "int wantrows" "int wantcols" 44.Ft int 45.Fn rasops_reconfig "struct rasops_info *ri" "int wantrows" "int wantcols" 46.Sh DESCRIPTION 47The 48.Nm 49subsystem is a set of raster operations for 50.Xr wscons 4 . 51.Pp 52The primary data type for using the raster operations is the 53.Em rasops_info 54structure in 55.Pa dev/rasops/rasops.h : 56.Bd -literal 57struct rasops_info { 58 59 /* 60 * These must be filled in by the caller 61 */ 62 int ri_depth; /* depth in bits */ 63 u_char *ri_bits; /* ptr to bits */ 64 int ri_width; /* width (pels) */ 65 int ri_height; /* height (pels) */ 66 int ri_stride; /* stride in bytes */ 67 68 /* 69 * These can optionally be left zeroed out. If you fill ri_font, 70 * but aren't using wsfont, set ri_wsfcookie to -1. 71 */ 72 struct wsdisplay_font *ri_font; 73 int ri_wsfcookie; /* wsfont cookie */ 74 void *ri_hw; /* driver private data */ 75 int ri_crow; /* cursor row */ 76 int ri_ccol; /* cursor column */ 77 int ri_flg; /* various operational flags */ 78 79 /* 80 * These are optional and will default if zero. Meaningless 81 * on depths other than 15, 16, 24 and 32 bits per pel. On 82 * 24 bit displays, ri_{r,g,b}num must be 8. 83 */ 84 u_char ri_rnum; /* number of bits for red */ 85 u_char ri_gnum; /* number of bits for green */ 86 u_char ri_bnum; /* number of bits for blue */ 87 u_char ri_rpos; /* which bit red starts at */ 88 u_char ri_gpos; /* which bit green starts at */ 89 u_char ri_bpos; /* which bit blue starts at */ 90 91 /* 92 * These are filled in by rasops_init() 93 */ 94 int ri_emuwidth; /* width we actually care about */ 95 int ri_emuheight; /* height we actually care about */ 96 int ri_emustride; /* bytes per row we actually care about */ 97 int ri_rows; /* number of rows (characters) */ 98 int ri_cols; /* number of columns (characters) */ 99 int ri_delta; /* row delta in bytes */ 100 int ri_pelbytes; /* bytes per pel (may be zero) */ 101 int ri_fontscale; /* fontheight * fontstride */ 102 int ri_xscale; /* fontwidth * pelbytes */ 103 int ri_yscale; /* fontheight * stride */ 104 u_char *ri_origbits; /* where screen bits actually start */ 105 int ri_xorigin; /* where ri_bits begins (x) */ 106 int ri_yorigin; /* where ri_bits begins (y) */ 107 int32_t ri_devcmap[16]; /* color -\*[Gt] framebuffer data */ 108 109 /* 110 * The emulops you need to use, and the screen caps for wscons 111 */ 112 struct wsdisplay_emulops ri_ops; 113 int ri_caps; 114 115 /* 116 * Callbacks so we can share some code 117 */ 118 void (*ri_do_cursor)(struct rasops_info *); 119 void (*ri_updatecursor)(struct rasops_info *); 120 121#if NRASOPS_ROTATION > 0 122 /* Used to intercept putchar to permit display rotation */ 123 struct wsdisplay_emulops ri_real_ops; 124#endif 125}; 126.Ed 127.Pp 128The value of the 129.Em ri_flg 130member is formed by OR'ing the following values: 131.Pp 132.Bl -tag -offset indent -width RI_CURSORCLIP -compact 133.It RI_FULLCLEAR 134Force eraserows() to clear the whole screen instead of only text lines, 135when invoked with an 136.Em nrows 137parameter equal to the number of text lines. 138.It RI_FORCEMONO 139Do not output coloured text, even if the display supports it. 140.It RI_BSWAP 141Specifies that the frame buffer endianness is different from the CPU's. 142.It RI_CURSOR 143Set when the text cursor is enabled. 144.It RI_CLEAR 145Clear the display upon initialization. 146.It RI_CENTER 147Center the text area. 148.\" Only honoured if option RASOPS_CLIPPING which we don't use. 149.\" .It RI_CURSORCLIP 150.\" Cursor is currently clipped 151.It RI_ROTATE_CW 152Rotate the text display quarter clockwise. 153.It RI_CFGDONE 154.Fn rasops_reconfig 155completed successfully 156.It RI_VCONS 157Support the use of multiple screens. 158.It RI_WRONLY 159Do not read back pixels from the frame buffer memory when performing 160screen-to-screen copy operations. 161This flag is ignored unless 162.Dv RI_VCONS 163is set. 164.El 165.Sh FUNCTIONS 166.Bl -tag -width compact 167.It Fn rasops_init "ri" "wantrows" "wantcols" 168Initialise a 169.Em rasops_info 170descriptor. 171The arguments 172.Fa wantrows 173and 174.Fa wantcols 175are the number of rows and columns we'd like. 176In terms of 177optimization, fonts that are a multiple of 8 pixels wide work the 178best. 179.It Fn rasops_reconfig "ri" "wantrows" "wantcols" 180Reconfigure a 181.Em rasops_info 182descriptor because parameters have changed in some way. 183The arguments 184.Fa wantrows 185and 186.Fa wantcols 187are the number of rows and columns we'd like. 188If calling 189.Fn rasops_reconfig 190to change the font and ri_wsfcookie \*[Ge] 0, you must call 191.Fn wsfont_unlock 192on it, and reset it to -1 (or a new, valid cookie). 193.El 194.Sh CODE REFERENCES 195This section describes places within the 196.Ox 197source tree where actual code implementing or utilising the rasops 198subsystem can be found. 199All pathnames are relative to 200.Pa /usr/src . 201.Pp 202The rasops subsystem is implemented within the directory 203.Pa sys/dev/rasops . 204The 205.Nm 206module itself is implemented within the file 207.Pa sys/dev/rasops/rasops.c . 208.Sh SEE ALSO 209.Xr intro 9 210.\" XXX These don't exist yet 211.\" .Xr wscons 9 , 212.\" .Xr wsdisplay 9 , 213.\" .Xr wsfont 9 214.Sh HISTORY 215The 216.Nm 217subsystem appeared in 218.Nx 1.5 219and 220.Ox 221first support appeared in 222.Ox 2.9 . 223.Sh AUTHORS 224.An -nosplit 225The 226.Nm 227subsystem was written by 228.An Andrew Doran Aq Mt ad@NetBSD.org . 229Display rotation was written by 230.An Christopher Pascoe Aq Mt pascoe@openbsd.org . 231.Sh CAVEATS 232Display rotation only works for 16bpp displays. 233