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