xref: /netbsd-src/sys/arch/atari/dev/grfioctl.h (revision da5f4674a3fc214be3572d358b66af40ab9401e7)
1 /*	$NetBSD: grfioctl.h,v 1.4 2003/08/07 16:26:59 agc Exp $	*/
2 
3 /*
4  * Copyright (c) 1990 The Regents of the University of California.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * the Systems Programming Group of the University of Utah Computer
9  * Science Department.
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  * from: Utah $Hdr: grfioctl.h 1.1 90/07/09$
36  *
37  *	@(#)grfioctl.h	7.2 (Berkeley) 11/4/90
38  */
39 /*
40  * Copyright (c) 1988 University of Utah.
41  *
42  * This code is derived from software contributed to Berkeley by
43  * the Systems Programming Group of the University of Utah Computer
44  * Science Department.
45  *
46  * Redistribution and use in source and binary forms, with or without
47  * modification, are permitted provided that the following conditions
48  * are met:
49  * 1. Redistributions of source code must retain the above copyright
50  *    notice, this list of conditions and the following disclaimer.
51  * 2. Redistributions in binary form must reproduce the above copyright
52  *    notice, this list of conditions and the following disclaimer in the
53  *    documentation and/or other materials provided with the distribution.
54  * 3. All advertising materials mentioning features or use of this software
55  *    must display the following acknowledgement:
56  *	This product includes software developed by the University of
57  *	California, Berkeley and its contributors.
58  * 4. Neither the name of the University nor the names of its contributors
59  *    may be used to endorse or promote products derived from this software
60  *    without specific prior written permission.
61  *
62  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72  * SUCH DAMAGE.
73  *
74  * from: Utah $Hdr: grfioctl.h 1.1 90/07/09$
75  *
76  *	@(#)grfioctl.h	7.2 (Berkeley) 11/4/90
77  */
78 
79 
80 /* these are changeable values, encapsulated in their own structure, so
81    no the whole thing has to be copied when setting parameters. */
82 struct grfdyninfo {
83 	int	gdi_fbx;	/* frame buffer x offset	*/
84 	int	gdi_fby;	/* frame buffer y offset	*/
85 	int	gdi_dwidth;	/* displayed part width		*/
86 	int	gdi_dheight;	/* displayed part height	*/
87 	int	gdi_dx;		/* displayed part x offset	*/
88 	int	gdi_dy;		/* displayed part y offset	*/
89 };
90 
91 struct	grfinfo {
92 	caddr_t	gd_fbaddr;	/* frame buffer linear physaddr	*/
93 	int	gd_fbsize;	/* frame buffer linear size	*/
94 	int	gd_linbase;	/* frame buffer linear base	*/
95 	caddr_t	gd_regaddr;	/* register area physaddr	*/
96 	int	gd_regsize;	/* register area size		*/
97 	caddr_t gd_vgaaddr;	/* vga area physaddr		*/
98 	int	gd_vgasize;	/* vga area size		*/
99 	int	gd_vgabase;	/* vga area base		*/
100 	short	gd_colors;	/* number of colors		*/
101 	short	gd_planes;	/* number of planes		*/
102 
103 	int	gd_fbwidth;	/* frame buffer width		*/
104 	int	gd_fbheight;	/* frame buffer height		*/
105 
106 	struct grfdyninfo gd_dyn; /* everything changable by GRFIOCSINFO */
107 /* compatibility... */
108 #define gd_fbx		gd_dyn.gdi_fbx
109 #define gd_fby		gd_dyn.gdi_fby
110 #define gd_dwidth 	gd_dyn.gdi_dwidth
111 #define gd_dheight	gd_dyn.gdi_dheight
112 #define gd_dx		gd_dyn.gdi_dx
113 #define gd_dy		gd_dyn.gdi_dy
114 
115 	/* new for banked pager support */
116 	int	gd_bank_size;		/* size of a bank (or 0) */
117 };
118 
119 
120 /* video mode, should be display-independant, but it might need
121    modifications in the future to really become hardware-independant. */
122 
123 struct grfvideo_mode {
124   u_char  mode_num;		/* index in mode table */
125   char	  mode_descr[80];	/* description of mode */
126   u_long  pixel_clock;		/* in Hz. */
127   u_short disp_width;		/* width of displayed video (incl overscan) */
128   u_short disp_height;		/* height "" */
129   u_short depth;		/* number of bitplanes resp. bits per pixel */
130   u_short hblank_start;
131   u_short hblank_stop;
132   u_short hsync_start;		/* video-parameters, take care not to   */
133   u_short hsync_stop;		/* use parameters that violete specs of */
134   u_short htotal;		/* your monitor !                       */
135   u_short vblank_start;
136   u_short vblank_stop;
137   u_short vsync_start;
138   u_short vsync_stop;
139   u_short vtotal;
140 };
141 
142 
143 /*
144  * BSD ioctls
145  */
146 #define OGRFIOCGINFO	0x40344700		/* to keep compat for a while... */
147 #define	GRFIOCGINFO	_IOR('G', 0, struct grfinfo) /* get info on device */
148 #define	GRFIOCON	_IO('G', 1)		/* turn graphics on */
149 #define	GRFIOCOFF	_IO('G', 2)		/* turn graphics off */
150 #define GRFIOCMAP	_IOWR('G', 5, int)	/* map in regs+framebuffer */
151 #define GRFIOCUNMAP	_IOW('G', 6, int)	/* unmap regs+framebuffer */
152 
153 /* amiga addons */
154 	/* set info on device */
155 #define	GRFIOCSINFO	_IOW('G', 40, struct grfdyninfo)
156 	/* get video_mode. mode_num==0 gets current mode. */
157 #define GRFGETVMODE	_IOWR('G', 41, struct grfvideo_mode)
158 	/* set video_mode. */
159 #define GRFSETVMODE	_IOW('G', 42, int)
160 	/* get number of configured video modes */
161 #define GRFGETNUMVM	_IOR('G', 43, int)
162 
163 
164 /*
165  * generic framebuffer-related ioctls. These are somewhat
166  * similar to SunOS fb-ioctls since I liked them reading
167  * thru the X11-server code.
168  */
169 
170 /*
171  * colormap related information. Every grf has an associated
172  * colormap. Depending on the capabilities of the hardware, more
173  * or less of the information provided may be used.
174  * Maxium value of "index" can be deduced from grfinfo->gd_colors.
175  */
176 struct grf_colormap {
177   int	 index;	    /* start at red[index],green[index],blue[index] */
178   int	 count;	    /* till < red[index+count],... */
179   u_char *red;
180   u_char *green;
181   u_char *blue;
182 };
183 
184 /* write the selected slots into the active colormap */
185 #define GRFIOCPUTCMAP	_IOW('G', 50, struct grf_colormap)
186 
187 /* retrieve the selected slots from the active colormap */
188 #define GRFIOCGETCMAP	_IOWR('G', 51, struct grf_colormap)
189 
190 
191 /*
192  * support a possibly available hardware sprite. calls just fail
193  * if a given grf doesn't implement hardware sprites.
194  */
195 struct grf_position {
196   u_short x, y;		/* 0,0 is upper left corner */
197 };
198 #define GRFIOCSSPRITEPOS _IOW('G', 52, struct grf_position)
199 #define GRFIOCGSPRITEPOS _IOR('G', 53, struct grf_position)
200 
201 struct grf_spriteinfo {
202   u_short  set;
203 #define GRFSPRSET_ENABLE  (1<<0)
204 #define GRFSPRSET_POS	  (1<<1)
205 #define GRFSPRSET_HOT	  (1<<2)
206 #define GRFSPRSET_CMAP	  (1<<3)
207 #define GRFSPRSET_SHAPE	  (1<<4)
208 #define GRFSPRSET_ALL	  0x1f
209   u_short  enable;	    /* sprite is displayed if == 1 */
210   struct grf_position pos;  /* sprite location */
211   struct grf_position hot;  /* sprite hot spot */
212   struct grf_colormap cmap; /* colormap for the sprite. */
213   struct grf_position size; /* x == width, y == height */
214   u_char *image, *mask;	    /* sprite bitmap and mask */
215 };
216 
217 #define GRFIOCSSPRITEINF _IOW('G', 54, struct grf_spriteinfo)
218 #define GRFIOCGSPRITEINF _IOR('G', 55, struct grf_spriteinfo)
219 
220 /* get maximum sprite size hardware can display */
221 #define GRFIOCGSPRITEMAX _IOR('G', 56, struct grf_position)
222 
223 
224 /* support for a BitBlt operation. The op-codes are identical
225    to X11 GCs */
226 #define	GRFBBOPclear		0x0	/* 0 */
227 #define GRFBBOPand		0x1	/* src AND dst */
228 #define GRFBBOPandReverse	0x2	/* src AND NOT dst */
229 #define GRFBBOPcopy		0x3	/* src */
230 #define GRFBBOPandInverted	0x4	/* NOT src AND dst */
231 #define	GRFBBOPnoop		0x5	/* dst */
232 #define GRFBBOPxor		0x6	/* src XOR dst */
233 #define GRFBBOPor		0x7	/* src OR dst */
234 #define GRFBBOPnor		0x8	/* NOT src AND NOT dst */
235 #define GRFBBOPequiv		0x9	/* NOT src XOR dst */
236 #define GRFBBOPinvert		0xa	/* NOT dst */
237 #define GRFBBOPorReverse	0xb	/* src OR NOT dst */
238 #define GRFBBOPcopyInverted	0xc	/* NOT src */
239 #define GRFBBOPorInverted	0xd	/* NOT src OR dst */
240 #define GRFBBOPnand		0xe	/* NOT src OR NOT dst */
241 #define GRFBBOPset		0xf	/* 1 */
242 
243 struct grf_bitblt {
244   u_short op;		/* see above */
245   u_short src_x, src_y;	/* upper left corner of source-region */
246   u_short dst_x, dst_y;	/* upper left corner of dest-region */
247   u_short w, h;		/* width, height of region */
248   u_short mask;		/* bitmask to apply */
249 };
250 
251 #define GRFIOCBITBLT	_IOR('G', 57, struct grf_bitblt)
252 
253