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