fbio.h revision 21673
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 * $FreeBSD: head/sys/sys/fbio.h 21673 1997-01-14 07:20:47Z jkh $
40 */
41
42#ifndef _SYS_FBIO_H_
43#define _SYS_FBIO_H_
44
45/*
46 * Frame buffer ioctls (from Sprite, trimmed to essentials for X11).
47 */
48
49/*
50 * Frame buffer type codes.
51 */
52#define	FBTYPE_SUN1BW		0	/* multibus mono */
53#define	FBTYPE_SUN1COLOR	1	/* multibus color */
54#define	FBTYPE_SUN2BW		2	/* memory mono */
55#define	FBTYPE_SUN2COLOR	3	/* color w/rasterop chips */
56#define	FBTYPE_SUN2GP		4	/* GP1/GP2 */
57#define	FBTYPE_SUN5COLOR	5	/* RoadRunner accelerator */
58#define	FBTYPE_SUN3COLOR	6	/* memory color */
59#define	FBTYPE_MEMCOLOR		7	/* memory 24-bit */
60#define	FBTYPE_SUN4COLOR	8	/* memory color w/overlay */
61
62#define	FBTYPE_NOTSUN1		9	/* reserved for customer */
63#define	FBTYPE_NOTSUN2		10	/* reserved for customer */
64#define	FBTYPE_NOTSUN3		11	/* reserved for customer */
65
66#define	FBTYPE_SUNFAST_COLOR	12	/* accelerated 8bit */
67#define	FBTYPE_SUNROP_COLOR	13	/* MEMCOLOR with rop h/w */
68#define	FBTYPE_SUNFB_VIDEO	14	/* Simple video mixing */
69#define	FBTYPE_RESERVED5	15	/* reserved, do not use */
70#define	FBTYPE_RESERVED4	16	/* reserved, do not use */
71#define	FBTYPE_RESERVED3	17	/* reserved, do not use */
72#define	FBTYPE_RESERVED2	18	/* reserved, do not use */
73#define	FBTYPE_RESERVED1	19	/* reserved, do not use */
74
75#define	FBTYPE_LASTPLUSONE	20	/* max number of fbs (change as add) */
76
77/*
78 * Frame buffer descriptor as returned by FBIOGTYPE.
79 */
80struct fbtype {
81	int	fb_type;	/* as defined above */
82	int	fb_height;	/* in pixels */
83	int	fb_width;	/* in pixels */
84	int	fb_depth;	/* bits per pixel */
85	int	fb_cmsize;	/* size of color map (entries) */
86	int	fb_size;	/* total size in bytes */
87};
88#define	FBIOGTYPE	_IOR('F', 0, struct fbtype)
89
90#ifdef notdef
91/*
92 * General purpose structure for passing info in and out of frame buffers
93 * (used for gp1) -- unsupported.
94 */
95struct fbinfo {
96	int	fb_physaddr;	/* physical frame buffer address */
97	int	fb_hwwidth;	/* fb board width */
98	int	fb_hwheight;	/* fb board height */
99	int	fb_addrdelta;	/* phys addr diff between boards */
100	u_char	*fb_ropaddr;	/* fb virtual addr */
101	int	fb_unit;	/* minor devnum of fb */
102};
103#define	FBIOGINFO	_IOR('F', 2, struct fbinfo)
104#endif
105
106/*
107 * Color map I/O.
108 */
109struct fbcmap {
110	int	index;		/* first element (0 origin) */
111	int	count;		/* number of elements */
112	u_char	*red;		/* red color map elements */
113	u_char	*green;		/* green color map elements */
114	u_char	*blue;		/* blue color map elements */
115};
116#define	FBIOPUTCMAP	_IOW('F', 3, struct fbcmap)
117#define	FBIOGETCMAP	_IOW('F', 4, struct fbcmap)
118
119/*
120 * Set/get attributes.
121 */
122#define	FB_ATTR_NDEVSPECIFIC	8	/* no. of device specific values */
123#define	FB_ATTR_NEMUTYPES	4	/* no. of emulation types */
124
125struct fbsattr {
126	int	flags;			/* flags; see below */
127	int	emu_type;		/* emulation type (-1 if unused) */
128	int	dev_specific[FB_ATTR_NDEVSPECIFIC];	/* catchall */
129};
130#define	FB_ATTR_AUTOINIT	1	/* emulation auto init flag */
131#define	FB_ATTR_DEVSPECIFIC	2	/* dev. specific stuff valid flag */
132
133struct fbgattr {
134	int	real_type;		/* real device type */
135	int	owner;			/* PID of owner, 0 if myself */
136	struct	fbtype fbtype;		/* fbtype info for real device */
137	struct	fbsattr sattr;		/* see above */
138	int	emu_types[FB_ATTR_NEMUTYPES];	/* possible emulations */
139						/* (-1 if unused) */
140};
141/*	FBIOSATTR	_IOW('F', 5, struct fbsattr) -- unsupported */
142#define	FBIOGATTR	_IOR('F', 6, struct fbgattr)
143
144/*
145 * Video control.
146 */
147#define	FBVIDEO_OFF		0
148#define	FBVIDEO_ON		1
149
150#define	FBIOSVIDEO	_IOW('F', 7, int)
151#define	FBIOGVIDEO	_IOR('F', 8, int)
152
153/*
154 * Hardware cursor control (for, e.g., CG6).  A rather complex and icky
155 * interface that smells like VMS, but there it is....
156 */
157struct fbcurpos {
158	short	x;
159	short	y;
160};
161
162struct fbcursor {
163	short	set;		/* flags; see below */
164	short	enable;		/* nonzero => cursor on, 0 => cursor off */
165	struct	fbcurpos pos;	/* position on display */
166	struct	fbcurpos hot;	/* hot-spot within cursor */
167	struct	fbcmap cmap;	/* cursor color map */
168	struct	fbcurpos size;	/* number of valid bits in image & mask */
169	caddr_t	image;		/* cursor image bits */
170	caddr_t	mask;		/* cursor mask bits */
171};
172#define	FB_CUR_SETCUR	0x01	/* set on/off (i.e., obey fbcursor.enable) */
173#define	FB_CUR_SETPOS	0x02	/* set position */
174#define	FB_CUR_SETHOT	0x04	/* set hot-spot */
175#define	FB_CUR_SETCMAP	0x08	/* set cursor color map */
176#define	FB_CUR_SETSHAPE	0x10	/* set size & bits */
177#define	FB_CUR_SETALL	(FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT | \
178			 FB_CUR_SETCMAP | FB_CUR_SETSHAPE)
179
180/* controls for cursor attributes & shape (including position) */
181#define	FBIOSCURSOR	_IOW('F', 24, struct fbcursor)
182#define	FBIOGCURSOR	_IOWR('F', 25, struct fbcursor)
183
184/* controls for cursor position only */
185#define	FBIOSCURPOS	_IOW('F', 26, struct fbcurpos)
186#define	FBIOGCURPOS	_IOW('F', 27, struct fbcurpos)
187
188/* get maximum cursor size */
189#define	FBIOGCURMAX	_IOR('F', 28, struct fbcurpos)
190
191#endif
192