fbio.h revision 1817
1/*
2 * Copyright (c) 1992, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * This code is derived from software developed by the Computer Systems
6 * Engineering group at Lawrence Berkeley Laboratory under DARPA
7 * contract BG 91-66 and contributed to Berkeley.
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 University of
20 *	California, Berkeley and its contributors.
21 * 4. Neither the name of the University nor the names of its contributors
22 *    may be used to endorse or promote products derived from this software
23 *    without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 *	@(#)fbio.h	8.2 (Berkeley) 10/30/93
38 *
39 * $Id$
40 */
41
42/*
43 * Frame buffer ioctls (from Sprite, trimmed to essentials for X11).
44 */
45
46/*
47 * Frame buffer type codes.
48 */
49#define	FBTYPE_SUN1BW		0	/* multibus mono */
50#define	FBTYPE_SUN1COLOR	1	/* multibus color */
51#define	FBTYPE_SUN2BW		2	/* memory mono */
52#define	FBTYPE_SUN2COLOR	3	/* color w/rasterop chips */
53#define	FBTYPE_SUN2GP		4	/* GP1/GP2 */
54#define	FBTYPE_SUN5COLOR	5	/* RoadRunner accelerator */
55#define	FBTYPE_SUN3COLOR	6	/* memory color */
56#define	FBTYPE_MEMCOLOR		7	/* memory 24-bit */
57#define	FBTYPE_SUN4COLOR	8	/* memory color w/overlay */
58
59#define	FBTYPE_NOTSUN1		9	/* reserved for customer */
60#define	FBTYPE_NOTSUN2		10	/* reserved for customer */
61#define	FBTYPE_NOTSUN3		11	/* reserved for customer */
62
63#define	FBTYPE_SUNFAST_COLOR	12	/* accelerated 8bit */
64#define	FBTYPE_SUNROP_COLOR	13	/* MEMCOLOR with rop h/w */
65#define	FBTYPE_SUNFB_VIDEO	14	/* Simple video mixing */
66#define	FBTYPE_RESERVED5	15	/* reserved, do not use */
67#define	FBTYPE_RESERVED4	16	/* reserved, do not use */
68#define	FBTYPE_RESERVED3	17	/* reserved, do not use */
69#define	FBTYPE_RESERVED2	18	/* reserved, do not use */
70#define	FBTYPE_RESERVED1	19	/* reserved, do not use */
71
72#define	FBTYPE_LASTPLUSONE	20	/* max number of fbs (change as add) */
73
74/*
75 * Frame buffer descriptor as returned by FBIOGTYPE.
76 */
77struct fbtype {
78	int	fb_type;	/* as defined above */
79	int	fb_height;	/* in pixels */
80	int	fb_width;	/* in pixels */
81	int	fb_depth;	/* bits per pixel */
82	int	fb_cmsize;	/* size of color map (entries) */
83	int	fb_size;	/* total size in bytes */
84};
85#define	FBIOGTYPE	_IOR('F', 0, struct fbtype)
86
87#ifdef notdef
88/*
89 * General purpose structure for passing info in and out of frame buffers
90 * (used for gp1) -- unsupported.
91 */
92struct fbinfo {
93	int	fb_physaddr;	/* physical frame buffer address */
94	int	fb_hwwidth;	/* fb board width */
95	int	fb_hwheight;	/* fb board height */
96	int	fb_addrdelta;	/* phys addr diff between boards */
97	u_char	*fb_ropaddr;	/* fb virtual addr */
98	int	fb_unit;	/* minor devnum of fb */
99};
100#define	FBIOGINFO	_IOR('F', 2, struct fbinfo)
101#endif
102
103/*
104 * Color map I/O.
105 */
106struct fbcmap {
107	int	index;		/* first element (0 origin) */
108	int	count;		/* number of elements */
109	u_char	*red;		/* red color map elements */
110	u_char	*green;		/* green color map elements */
111	u_char	*blue;		/* blue color map elements */
112};
113#define	FBIOPUTCMAP	_IOW('F', 3, struct fbcmap)
114#define	FBIOGETCMAP	_IOW('F', 4, struct fbcmap)
115
116/*
117 * Set/get attributes.
118 */
119#define	FB_ATTR_NDEVSPECIFIC	8	/* no. of device specific values */
120#define	FB_ATTR_NEMUTYPES	4	/* no. of emulation types */
121
122struct fbsattr {
123	int	flags;			/* flags; see below */
124	int	emu_type;		/* emulation type (-1 if unused) */
125	int	dev_specific[FB_ATTR_NDEVSPECIFIC];	/* catchall */
126};
127#define	FB_ATTR_AUTOINIT	1	/* emulation auto init flag */
128#define	FB_ATTR_DEVSPECIFIC	2	/* dev. specific stuff valid flag */
129
130struct fbgattr {
131	int	real_type;		/* real device type */
132	int	owner;			/* PID of owner, 0 if myself */
133	struct	fbtype fbtype;		/* fbtype info for real device */
134	struct	fbsattr sattr;		/* see above */
135	int	emu_types[FB_ATTR_NEMUTYPES];	/* possible emulations */
136						/* (-1 if unused) */
137};
138/*	FBIOSATTR	_IOW('F', 5, struct fbsattr) -- unsupported */
139#define	FBIOGATTR	_IOR('F', 6, struct fbgattr)
140
141/*
142 * Video control.
143 */
144#define	FBVIDEO_OFF		0
145#define	FBVIDEO_ON		1
146
147#define	FBIOSVIDEO	_IOW('F', 7, int)
148#define	FBIOGVIDEO	_IOR('F', 8, int)
149
150/*
151 * Hardware cursor control (for, e.g., CG6).  A rather complex and icky
152 * interface that smells like VMS, but there it is....
153 */
154struct fbcurpos {
155	short	x;
156	short	y;
157};
158
159struct fbcursor {
160	short	set;		/* flags; see below */
161	short	enable;		/* nonzero => cursor on, 0 => cursor off */
162	struct	fbcurpos pos;	/* position on display */
163	struct	fbcurpos hot;	/* hot-spot within cursor */
164	struct	fbcmap cmap;	/* cursor color map */
165	struct	fbcurpos size;	/* number of valid bits in image & mask */
166	caddr_t	image;		/* cursor image bits */
167	caddr_t	mask;		/* cursor mask bits */
168};
169#define	FB_CUR_SETCUR	0x01	/* set on/off (i.e., obey fbcursor.enable) */
170#define	FB_CUR_SETPOS	0x02	/* set position */
171#define	FB_CUR_SETHOT	0x04	/* set hot-spot */
172#define	FB_CUR_SETCMAP	0x08	/* set cursor color map */
173#define	FB_CUR_SETSHAPE	0x10	/* set size & bits */
174#define	FB_CUR_SETALL	(FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT | \
175			 FB_CUR_SETCMAP | FB_CUR_SETSHAPE)
176
177/* controls for cursor attributes & shape (including position) */
178#define	FBIOSCURSOR	_IOW('F', 24, struct fbcursor)
179#define	FBIOGCURSOR	_IOWR('F', 25, struct fbcursor)
180
181/* controls for cursor position only */
182#define	FBIOSCURPOS	_IOW('F', 26, struct fbcurpos)
183#define	FBIOGCURPOS	_IOW('F', 27, struct fbcurpos)
184
185/* get maximum cursor size */
186#define	FBIOGCURMAX	_IOR('F', 28, struct fbcurpos)
187