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