xref: /netbsd-src/sys/dev/sun/fbio.h (revision 63aea4bd5b445e491ff0389fe27ec78b3099dba3)
1 /*	$NetBSD: fbio.h,v 1.12 2015/09/06 06:01:01 dholland Exp $ */
2 
3 /*
4  * Copyright (c) 1992 Regents of the University of California.
5  * All rights reserved.
6  *
7  * This code is derived from software developed by the Computer Systems
8  * Engineering group at Lawrence Berkeley Laboratory under DARPA
9  * contract BG 91-66 and contributed to Berkeley.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the University nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  * 	@(#)fbio.h	7.2 (Berkeley) 4/1/92
36  */
37 
38 #ifndef FBIO_H
39 #define FBIO_H
40 
41 #include <sys/ioccom.h>
42 
43 /*
44  * Frame buffer ioctls (from Sprite, trimmed to essentials for X11).
45  */
46 
47 /*
48  * Frame buffer type codes.
49  */
50 #define	FBTYPE_SUN1BW		0	/* multibus mono */
51 #define	FBTYPE_SUN1COLOR	1	/* multibus color */
52 #define	FBTYPE_SUN2BW		2	/* memory mono */
53 #define	FBTYPE_SUN2COLOR	3	/* color w/rasterop chips */
54 #define	FBTYPE_SUN2GP		4	/* GP1/GP2 */
55 #define	FBTYPE_SUN5COLOR	5	/* RoadRunner accelerator */
56 #define	FBTYPE_SUN3COLOR	6	/* memory color */
57 #define	FBTYPE_MEMCOLOR		7	/* memory 24-bit */
58 #define	FBTYPE_SUN4COLOR	8	/* memory color w/overlay */
59 
60 #define	FBTYPE_NOTSUN1		9	/* reserved for customer */
61 #define	FBTYPE_NOTSUN2		10	/* reserved for customer */
62 #define	FBTYPE_NOTSUN3		11	/* reserved for customer */
63 
64 #define	FBTYPE_SUNFAST_COLOR	12	/* accelerated 8bit */
65 #define	FBTYPE_SUNROP_COLOR	13	/* MEMCOLOR with rop h/w */
66 #define	FBTYPE_SUNFB_VIDEO	14	/* Simple video mixing */
67 #define	FBTYPE_RESERVED5	15	/* reserved, do not use */
68 #define	FBTYPE_RESERVED4	16	/* reserved, do not use */
69 #define	FBTYPE_RESERVED3	17	/* reserved, do not use */
70 #define FBTYPE_SUNGP3           17      /* cg12 running gpsi microcode */
71 #define FBTYPE_SUNGT            18      /* gt graphics accelerator */
72 #define FBTYPE_SUNLEO           19      /* zx graphics accelerator */
73 #define FBTYPE_MDICOLOR         20      /* cgfourteen framebuffer */
74 #define	FBTYPE_P9100		21	/* tadpole 3gx p9100 controller */
75 #define FBTYPE_CREATOR		22	/* ffb creator or elite */
76 #define FBTYPE_GENERIC_PCI	23	/* machfb, ofb and so on */
77 #define FBTYPE_AG10E		24	/* Fujitsu AG-10e */
78 #define FBTYPE_TCXCOLOR		25	/* Sun TCX, S24  */
79 
80 #define	FBTYPE_LASTPLUSONE	26	/* max number of fbs (change as add) */
81 
82 /*
83  * XXX These really shouldn't be here, but this is what the pmax
84  * XXX port did ages ago.
85  */
86 #define	PMAX_FBTYPE_PM_MONO	1
87 #define	PMAX_FBTYPE_PM_COLOR	2
88 #define	PMAX_FBTYPE_CFB		3
89 #define	PMAX_FBTYPE_XCFB	4
90 #define	PMAX_FBTYPE_MFB		5
91 #define	PMAX_FBTYPE_SFB		6
92 #define	PMAX_FBTYPE_PX		7
93 
94 #define	PMAX_FBTYPE_LASTPLUSONE	8
95 
96 /*
97  * Frame buffer descriptor as returned by FBIOGTYPE.
98  */
99 struct fbtype {
100 	int	fb_type;	/* as defined above */
101 	int	fb_height;	/* in pixels */
102 	int	fb_width;	/* in pixels */
103 	int	fb_depth;	/* bits per pixel */
104 	int	fb_cmsize;	/* size of color map (entries) */
105 	int	fb_size;	/* total size in bytes */
106 };
107 #define	FBIOGTYPE	_IOR('F', 0, struct fbtype)
108 
109 #ifdef notdef
110 /*
111  * General purpose structure for passing info in and out of frame buffers
112  * (used for gp1) -- unsupported.
113  */
114 struct fbinfo {
115 	int	fb_physaddr;	/* physical frame buffer address */
116 	int	fb_hwwidth;	/* fb board width */
117 	int	fb_hwheight;	/* fb board height */
118 	int	fb_addrdelta;	/* phys addr diff between boards */
119 	u_char	*fb_ropaddr;	/* fb virtual addr */
120 	int	fb_unit;	/* minor devnum of fb */
121 };
122 #define	FBIOGINFO	_IOR('F', 2, struct fbinfo)
123 #endif
124 
125 /*
126  * Color map I/O.
127  */
128 struct fbcmap {
129 	u_int	index;		/* first element (0 origin) */
130 	u_int	count;		/* number of elements */
131 	u_char	*red;		/* red color map elements */
132 	u_char	*green;		/* green color map elements */
133 	u_char	*blue;		/* blue color map elements */
134 };
135 #define	FBIOPUTCMAP	_IOW('F', 3, struct fbcmap)
136 #define	FBIOGETCMAP	_IOW('F', 4, struct fbcmap)
137 
138 /*
139  * Set/get attributes.
140  */
141 #define	FB_ATTR_NDEVSPECIFIC	8	/* no. of device specific values */
142 #define	FB_ATTR_NEMUTYPES	4	/* no. of emulation types */
143 
144 struct fbsattr {
145 	int	flags;			/* flags; see below */
146 	int	emu_type;		/* emulation type (-1 if unused) */
147 	int	dev_specific[FB_ATTR_NDEVSPECIFIC];	/* catchall */
148 };
149 #define	FB_ATTR_AUTOINIT	1	/* emulation auto init flag */
150 #define	FB_ATTR_DEVSPECIFIC	2	/* dev. specific stuff valid flag */
151 
152 struct fbgattr {
153 	int	real_type;		/* real device type */
154 	int	owner;			/* PID of owner, 0 if myself */
155 	struct	fbtype fbtype;		/* fbtype info for real device */
156 	struct	fbsattr sattr;		/* see above */
157 	int	emu_types[FB_ATTR_NEMUTYPES];	/* possible emulations */
158 						/* (-1 if unused) */
159 };
160 /*	FBIOSATTR	_IOW('F', 5, struct fbsattr) -- unsupported */
161 #define	FBIOGATTR	_IOR('F', 6, struct fbgattr)
162 
163 /*
164  * Video control.
165  */
166 #define	FBVIDEO_OFF		0
167 #define	FBVIDEO_ON		1
168 
169 #define	FBIOSVIDEO	_IOW('F', 7, int)
170 #define	FBIOGVIDEO	_IOR('F', 8, int)
171 
172 /*
173  * hardware cursor control
174  */
175 struct fbcurpos {
176 	short x;
177 	short y;
178 };
179 
180 #define FB_CUR_SETCUR   0x01
181 #define FB_CUR_SETPOS   0x02
182 #define FB_CUR_SETHOT   0x04
183 #define FB_CUR_SETCMAP  0x08
184 #define FB_CUR_SETSHAPE 0x10
185 #define FB_CUR_SETALL   0x1F
186 
187 struct fbcursor {
188 	short set;		/* what to set */
189 	short enable;		/* enable/disable cursor */
190 	struct fbcurpos pos;	/* cursor's position */
191 	struct fbcurpos hot;	/* cursor's hot spot */
192 	struct fbcmap cmap;	/* color map info */
193 	struct fbcurpos size;	/* cursor's bit map size */
194 	char *image;		/* cursor's image bits */
195 	char *mask;		/* cursor's mask bits */
196 };
197 
198 /* set/get cursor attributes/shape */
199 #define FBIOSCURSOR	_IOW('F', 24, struct fbcursor)
200 #define FBIOGCURSOR	_IOWR('F', 25, struct fbcursor)
201 
202 /* set/get cursor position */
203 #define FBIOSCURPOS	_IOW('F', 26, struct fbcurpos)
204 #define FBIOGCURPOS	_IOW('F', 27, struct fbcurpos)
205 
206 /* get max cursor size */
207 #define FBIOGCURMAX	_IOR('F', 28, struct fbcurpos)
208 
209 #endif /* FBIO_H */
210