1.\" $NetBSD: rasops.9,v 1.16 2012/01/13 23:12:32 wiz 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.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd January 13, 2012 31.Dt RASOPS 9 32.Os 33.Sh NAME 34.Nm rasops , 35.Nm rasops_init , 36.Nm rasops_reconfig 37.Nd raster display operations 38.Sh SYNOPSIS 39.In dev/wscons/wsdisplayvar.h 40.In dev/rasops/rasops.h 41.Ft int 42.Fn rasops_init "struct rasops_info *ri" "int wantrows" "int wantcols" 43.Ft int 44.Fn rasops_reconfig "struct rasops_info *ri" "int wantrows" "int wantcols" 45.Sh DESCRIPTION 46The 47.Nm 48subsystem is a set of raster operations for 49.Xr wscons 9 . 50.Pp 51The primary data type for using the raster operations is the 52.Em rasops_info 53structure in 54.Pa dev/rasops/rasops.h : 55.Bd -literal 56struct rasops_info { 57 58 /* 59 * These must be filled in by the caller 60 */ 61 int ri_depth; /* depth in bits */ 62 u_char *ri_bits; /* ptr to bits */ 63 int ri_width; /* width (pels) */ 64 int ri_height; /* height (pels) */ 65 int ri_stride; /* stride in bytes */ 66 67 /* 68 * If you want shadow framebuffer support, point ri_hwbits 69 * to the real framebuffer, and ri_bits to the shadow framebuffer 70 */ 71 u_char *ri_hwbits; 72 73 /* 74 * These can optionally be left zeroed out. If you fill ri_font, 75 * but aren't using wsfont, set ri_wsfcookie to -1. 76 */ 77 struct wsdisplay_font *ri_font; 78 int ri_wsfcookie; /* wsfont cookie */ 79 void *ri_hw; /* driver private data */ 80 int ri_crow; /* cursor row */ 81 int ri_ccol; /* cursor column */ 82 int ri_flg; /* various operational flags */ 83 84 /* 85 * These are optional and will default if zero. Meaningless 86 * on depths other than 15, 16, 24 and 32 bits per pel. On 87 * 24 bit displays, ri_{r,g,b}num must be 8. 88 */ 89 u_char ri_rnum; /* number of bits for red */ 90 u_char ri_gnum; /* number of bits for green */ 91 u_char ri_bnum; /* number of bits for blue */ 92 u_char ri_rpos; /* which bit red starts at */ 93 u_char ri_gpos; /* which bit green starts at */ 94 u_char ri_bpos; /* which bit blue starts at */ 95 96 /* 97 * These are filled in by rasops_init() 98 */ 99 int ri_emuwidth; /* width we actually care about */ 100 int ri_emuheight; /* height we actually care about */ 101 int ri_emustride; /* bytes per row we actually care about */ 102 int ri_rows; /* number of rows (characters) */ 103 int ri_cols; /* number of columns (characters) */ 104 int ri_delta; /* row delta in bytes */ 105 int ri_pelbytes; /* bytes per pel (may be zero) */ 106 int ri_fontscale; /* fontheight * fontstride */ 107 int ri_xscale; /* fontwidth * pelbytes */ 108 int ri_yscale; /* fontheight * stride */ 109 u_char *ri_origbits; /* where screen bits actually start */ 110 int ri_xorigin; /* where ri_bits begins (x) */ 111 int ri_yorigin; /* where ri_bits begins (y) */ 112 int32_t ri_devcmap[16]; /* color -\*[Gt] framebuffer data */ 113 114 /* 115 * The emulops you need to use, and the screen caps for wscons 116 */ 117 struct wsdisplay_emulops ri_ops; 118 int ri_caps; 119 120 /* 121 * Callbacks so we can share some code 122 */ 123 void (*ri_do_cursor)(struct rasops_info *); 124}; 125.Ed 126.Pp 127Valid values for the 128.Em ri_flg 129member are: 130.Pp 131.Bl -tag -offset indent -width RI_ENABLE_ALPHA_XX -compact 132.It Dv RI_FULLCLEAR 133.Fn eraserows 134hack to clear full screen 135.It Dv RI_FORCEMONO 136monochrome output even if we can do color 137.It Dv RI_BSWAP 138framebuffer endianness doesn't match CPU 139.It Dv RI_CURSOR 140cursor is switched on 141.It Dv RI_CLEAR 142clear display on startup 143.It Dv RI_CENTER 144center onscreen output 145.It Dv RI_CURSORCLIP 146cursor is currently clipped 147.It Dv RI_CFGDONE 148.Fn rasops_reconfig 149completed successfully 150.It Dv RI_NO_AUTO 151do not generate box drawing characters for ISO fonts. 152Use this when it is not safe to allocate memory, for example when setting up 153an early console. 154.It Dv RI_ENABLE_ALPHA 155set this if the caller supports anti-aliased fonts in the given colour depth. 156Without this flag 157.Fn rasops_init 158will only pick bitmap fonts. 159.It Dv RI_8BIT_IS_RGB 160set this if the caller uses an R3G3B2 colour map in 8 bit. 161.Fn rasops_init 162will generate an appropriate ri_devcmap[] but the caller still needs to set up 163the actual colour map. 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 optimization, fonts that are a multiple of 8 pixels wide 177work the best. 178.It Fn rasops_reconfig "ri" "wantrows" "wantcols" 179Reconfigure a 180.Em rasops_info 181descriptor because parameters have changed in some way. 182The arguments 183.Fa wantrows 184and 185.Fa wantcols 186are the number of rows and columns we'd like. 187Passing zero for either one of 188them uses the default - normally 80x25 but it can be changed with 189.Bd -literal -offset indent 190options RASOPS_DEFAULT_WIDTH=80 191options RASOPS_DEFAULT_HEIGHT=25 192.Ed 193If calling 194.Fn rasops_reconfig 195to change the font and ri_wsfcookie \*[Ge] 0, you must call 196.Fn wsfont_unlock 197on it, and reset it to -1 (or a new, valid cookie). 198.El 199.Sh CODE REFERENCES 200The rasops subsystem is implemented within the directory 201.Pa sys/dev/rasops . 202The 203.Nm 204module itself is implemented within the file 205.Pa sys/dev/rasops/rasops.c . 206.Sh SEE ALSO 207.Xr intro 9 , 208.Xr wscons 9 , 209.Xr wsdisplay 9 , 210.Xr wsfont 9 211.Sh HISTORY 212The 213.Nm 214subsystem appeared in 215.Nx 1.5 . 216.Sh AUTHORS 217The 218.Nm 219subsystem was written by 220.An Andrew Doran 221.Aq ad@NetBSD.org . 222