xref: /netbsd-src/share/man/man9/rasops.9 (revision 8b0f9554ff8762542c4defc4f70e1eb76fb508fa)
1.\"     $NetBSD: rasops.9,v 1.10 2006/02/18 18:36:26 jmcneill 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.In dev/wscons/wsdisplayvar.h
47.In dev/rasops/rasops.h
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	 * If you want shadow framebuffer support, point ri_hwbits
76	 * to the real framebuffer, and ri_bits to the shadow framebuffer
77	 */
78	u_char	*ri_hwbits;
79
80	/*
81	 * These can optionally be left zeroed out. If you fill ri_font,
82	 * but aren't using wsfont, set ri_wsfcookie to -1.
83	 */
84	struct	wsdisplay_font *ri_font;
85	int	ri_wsfcookie;	/* wsfont cookie */
86	void	*ri_hw;		/* driver private data */
87	int	ri_crow;	/* cursor row */
88	int	ri_ccol;	/* cursor column */
89	int	ri_flg;		/* various operational flags */
90
91	/*
92	 * These are optional and will default if zero. Meaningless
93	 * on depths other than 15, 16, 24 and 32 bits per pel. On
94	 * 24 bit displays, ri_{r,g,b}num must be 8.
95	 */
96	u_char	ri_rnum;	/* number of bits for red */
97	u_char	ri_gnum;	/* number of bits for green */
98	u_char	ri_bnum;	/* number of bits for blue */
99	u_char	ri_rpos;	/* which bit red starts at */
100	u_char	ri_gpos;	/* which bit green starts at */
101	u_char	ri_bpos;	/* which bit blue starts at */
102
103	/*
104	 * These are filled in by rasops_init()
105	 */
106	int	ri_emuwidth;	/* width we actually care about */
107	int	ri_emuheight;	/* height we actually care about */
108	int	ri_emustride;	/* bytes per row we actually care about */
109	int	ri_rows;	/* number of rows (characters) */
110	int	ri_cols;	/* number of columns (characters) */
111	int	ri_delta;	/* row delta in bytes */
112	int	ri_pelbytes;	/* bytes per pel (may be zero) */
113	int	ri_fontscale;	/* fontheight * fontstride */
114	int	ri_xscale;	/* fontwidth * pelbytes */
115	int	ri_yscale;	/* fontheight * stride */
116	u_char  *ri_origbits;	/* where screen bits actually start */
117	int	ri_xorigin;	/* where ri_bits begins (x) */
118	int	ri_yorigin;	/* where ri_bits begins (y) */
119	int32_t	ri_devcmap[16]; /* color -\*[Gt] framebuffer data */
120
121	/*
122	 * The emulops you need to use, and the screen caps for wscons
123	 */
124	struct	wsdisplay_emulops ri_ops;
125	int	ri_caps;
126
127	/*
128	 * Callbacks so we can share some code
129	 */
130	void	(*ri_do_cursor)(struct rasops_info *);
131};
132.Ed
133.Pp
134Valid values for the
135.Em ri_flg
136member are:
137.Pp
138.Bl -tag -offset indent -width RI_CURSORCLIP -compact
139.It  RI_FULLCLEAR
140eraserows() hack to clear full screen
141.It  RI_FORCEMONO
142monochrome output even if we can do color
143.It  RI_BSWAP
144framebuffer endianness doesn't match CPU
145.It  RI_CURSOR
146cursor is switched on
147.It  RI_CLEAR
148clear display on startup
149.It  RI_CENTER
150center onscreen output
151.It  RI_CURSORCLIP
152cursor is currently clipped
153.It  RI_CFGDONE
154.Fn rasops_reconfig
155completed successfully
156.El
157.Sh FUNCTIONS
158.Bl -tag -width compact
159.It Fn rasops_init "ri" "wantrows" "wantcols"
160Initialise a
161.Em rasops_info
162descriptor.
163The arguments
164.Fa wantrows
165and
166.Fa wantcols
167are the number of rows and columns we'd like.
168In terms of optimization, fonts that are a multiple of 8 pixels wide
169work the best.
170.It Fn rasops_reconfig "ri" "wantrows" "wantcols"
171Reconfigure a
172.Em rasops_info
173descriptor because parameters have changed in some way.
174The arguments
175.Fa wantrows
176and
177.Fa wantcols
178are the number of rows and columns we'd like.
179If calling
180.Fn rasops_reconfig
181to change the font and ri_wsfcookie \*[Ge] 0, you must call
182.Fn wsfont_unlock
183on it, and reset it to -1 (or a new, valid cookie).
184.El
185.Sh CODE REFERENCES
186This section describes places within the
187.Nx
188source tree where actual code implementing or using the rasops
189subsystem can be found.
190All pathnames are relative to
191.Pa /usr/src .
192.Pp
193The rasops subsystem is implemented within the directory
194.Pa sys/dev/rasops .
195The
196.Nm
197module itself is implemented within the file
198.Pa sys/dev/rasops/rasops.c .
199.Sh SEE ALSO
200.Xr intro 9 ,
201.Xr wscons 9 ,
202.Xr wsdisplay 9 ,
203.Xr wsfont 9
204.Sh HISTORY
205The
206.Nm
207subsystem appeared in
208.Nx 1.5 .
209.Sh AUTHORS
210The
211.Nm
212subsystem was written by
213.An Andrew Doran
214.Aq ad@NetBSD.org .
215