1.\" $OpenBSD: rasops.9,v 1.16 2015/09/07 18:43:54 kettenis 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: September 7 2015 $ 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 struct wsdisplay_charcell *ri_bs; /* character backing store */ 76 int ri_crow; /* cursor row */ 77 int ri_ccol; /* cursor column */ 78 int ri_flg; /* various operational flags */ 79 80 /* 81 * These are optional and will default if zero. Meaningless 82 * on depths other than 15, 16, 24 and 32 bits per pel. On 83 * 24 bit displays, ri_{r,g,b}num must be 8. 84 */ 85 u_char ri_rnum; /* number of bits for red */ 86 u_char ri_gnum; /* number of bits for green */ 87 u_char ri_bnum; /* number of bits for blue */ 88 u_char ri_rpos; /* which bit red starts at */ 89 u_char ri_gpos; /* which bit green starts at */ 90 u_char ri_bpos; /* which bit blue starts at */ 91 92 /* 93 * These are filled in by rasops_init() 94 */ 95 int ri_emuwidth; /* width we actually care about */ 96 int ri_emuheight; /* height we actually care about */ 97 int ri_emustride; /* bytes per row we actually care about */ 98 int ri_rows; /* number of rows (characters) */ 99 int ri_cols; /* number of columns (characters) */ 100 int ri_delta; /* row delta in bytes */ 101 int ri_pelbytes; /* bytes per pel (may be zero) */ 102 int ri_fontscale; /* fontheight * fontstride */ 103 int ri_xscale; /* fontwidth * pelbytes */ 104 int ri_yscale; /* fontheight * stride */ 105 u_char *ri_origbits; /* where screen bits actually start */ 106 int ri_xorigin; /* where ri_bits begins (x) */ 107 int ri_yorigin; /* where ri_bits begins (y) */ 108 int32_t ri_devcmap[16]; /* color -\*[Gt] framebuffer data */ 109 110 /* 111 * The emulops you need to use, and the screen caps for wscons 112 */ 113 struct wsdisplay_emulops ri_ops; 114 int ri_caps; 115 116 /* 117 * Callbacks so we can share some code 118 */ 119 void (*ri_do_cursor)(struct rasops_info *); 120 void (*ri_updatecursor)(struct rasops_info *); 121 122#if NRASOPS_ROTATION > 0 123 /* Used to intercept putchar to permit display rotation */ 124 struct wsdisplay_emulops ri_real_ops; 125#endif 126}; 127.Ed 128.Pp 129The value of the 130.Em ri_flg 131member is formed by OR'ing the following values: 132.Pp 133.Bl -tag -offset indent -width RI_CURSORCLIP -compact 134.It RI_FULLCLEAR 135Force eraserows() to clear the whole screen instead of only text lines, 136when invoked with an 137.Em nrows 138parameter equal to the number of text lines. 139.It RI_FORCEMONO 140Do not output coloured text, even if the display supports it. 141.It RI_BSWAP 142Specifies that the frame buffer endianness is different from the CPU's. 143.It RI_CURSOR 144Set when the text cursor is enabled. 145.It RI_CLEAR 146Clear the display upon initialization. 147.It RI_CENTER 148Center the text area. 149.\" Only honoured if option RASOPS_CLIPPING which we don't use. 150.\" .It RI_CURSORCLIP 151.\" Cursor is currently clipped 152.It RI_ROTATE_CW 153Rotate the text display quarter clockwise. 154.It RI_CFGDONE 155.Fn rasops_reconfig 156completed successfully 157.It RI_VCONS 158Support the use of multiple screens. 159.It RI_WRONLY 160Do not read back pixels from the frame buffer memory when performing 161screen-to-screen copy operations. 162This flag is ignored unless 163.Dv RI_VCONS 164is set or the 165.Em ri_bs 166member is set. 167.El 168.Sh FUNCTIONS 169.Bl -tag -width compact 170.It Fn rasops_init "ri" "wantrows" "wantcols" 171Initialise a 172.Em rasops_info 173descriptor. 174The arguments 175.Fa wantrows 176and 177.Fa wantcols 178are the number of rows and columns we'd like. 179In terms of 180optimization, fonts that are a multiple of 8 pixels wide work the 181best. 182.It Fn rasops_reconfig "ri" "wantrows" "wantcols" 183Reconfigure a 184.Em rasops_info 185descriptor because parameters have changed in some way. 186The arguments 187.Fa wantrows 188and 189.Fa wantcols 190are the number of rows and columns we'd like. 191If calling 192.Fn rasops_reconfig 193to change the font and ri_wsfcookie \*[Ge] 0, you must call 194.Fn wsfont_unlock 195on it, and reset it to -1 (or a new, valid cookie). 196.El 197.Sh CODE REFERENCES 198This section describes places within the 199.Ox 200source tree where actual code implementing or utilising the rasops 201subsystem can be found. 202All pathnames are relative to 203.Pa /usr/src . 204.Pp 205The rasops subsystem is implemented within the directory 206.Pa sys/dev/rasops . 207The 208.Nm 209module itself is implemented within the file 210.Pa sys/dev/rasops/rasops.c . 211.Sh SEE ALSO 212.Xr intro 9 213.\" XXX These don't exist yet 214.\" .Xr wscons 9 , 215.\" .Xr wsdisplay 9 , 216.\" .Xr wsfont 9 217.Sh HISTORY 218The 219.Nm 220subsystem appeared in 221.Nx 1.5 222and 223.Ox 224first support appeared in 225.Ox 2.9 . 226.Sh AUTHORS 227.An -nosplit 228The 229.Nm 230subsystem was written by 231.An Andrew Doran Aq Mt ad@NetBSD.org . 232Display rotation was written by 233.An Christopher Pascoe Aq Mt pascoe@openbsd.org . 234.Sh CAVEATS 235Display rotation only works for 16bpp displays. 236