1112758Ssam/* $NetBSD: grfioctl.h,v 1.8 2007/03/04 05:59:40 christos Exp $ */ 2112758Ssam 3112758Ssam/* 4112758Ssam * Copyright (c) 1988 University of Utah. 5112758Ssam * Copyright (c) 1990 The Regents of the University of California. 6112758Ssam * All rights reserved. 7112758Ssam * 8112758Ssam * This code is derived from software contributed to Berkeley by 9112758Ssam * the Systems Programming Group of the University of Utah Computer 10112758Ssam * Science Department. 11112758Ssam * 12112758Ssam * Redistribution and use in source and binary forms, with or without 13112758Ssam * modification, are permitted provided that the following conditions 14112758Ssam * are met: 15112758Ssam * 1. Redistributions of source code must retain the above copyright 16112758Ssam * notice, this list of conditions and the following disclaimer. 17112758Ssam * 2. Redistributions in binary form must reproduce the above copyright 18112758Ssam * notice, this list of conditions and the following disclaimer in the 19112758Ssam * documentation and/or other materials provided with the distribution. 20112758Ssam * 3. Neither the name of the University nor the names of its contributors 21112758Ssam * may be used to endorse or promote products derived from this software 22112758Ssam * without specific prior written permission. 23112758Ssam * 24112758Ssam * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25112758Ssam * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26112758Ssam * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27112758Ssam * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28105197Ssam * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29105197Ssam * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30105197Ssam * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31105197Ssam * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32105197Ssam * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33105197Ssam * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34105197Ssam * SUCH DAMAGE. 35159965Sthompsa * 36105197Ssam * from: Utah $Hdr: grfioctl.h 1.1 90/07/09$ 37105197Ssam * 38105197Ssam * @(#)grfioctl.h 7.2 (Berkeley) 11/4/90 39105197Ssam */ 40105197Ssam 41105197Ssam#ifndef _MACHINE_GRFIOCTL_H_ 42105197Ssam#define _MACHINE_GRFIOCTL_H_ 43105197Ssam 44105197Ssam/* these are changeable values, encapsulated in their own structure, so 45105197Ssam no the whole thing has to be copied when setting parameters. */ 46105197Ssamstruct grfdyninfo { 47171497Sbz int gdi_fbx; /* frame buffer x offset */ 48105197Ssam int gdi_fby; /* frame buffer y offset */ 49195699Srwatson int gdi_dwidth; /* displayed part width */ 50105197Ssam int gdi_dheight; /* displayed part height */ 51105197Ssam int gdi_dx; /* displayed part x offset */ 52105197Ssam int gdi_dy; /* displayed part y offset */ 53105197Ssam}; 54105197Ssam 55105197Ssamstruct grfinfo { 56105197Ssam void * gd_fbaddr; /* frame buffer linear physaddr */ 57105197Ssam int gd_fbsize; /* frame buffer linear size */ 58105197Ssam int gd_linbase; /* frame buffer linear base */ 59105197Ssam void * gd_regaddr; /* register area physaddr */ 60105197Ssam int gd_regsize; /* register area size */ 61105197Ssam void *gd_vgaaddr; /* vga area physaddr */ 62105197Ssam int gd_vgasize; /* vga area size */ 63105197Ssam int gd_vgabase; /* vga area base */ 64105197Ssam short gd_colors; /* number of colors */ 65105197Ssam short gd_planes; /* number of planes */ 66105197Ssam 67105197Ssam int gd_fbwidth; /* frame buffer width */ 68105197Ssam int gd_fbheight; /* frame buffer height */ 69105197Ssam 70105197Ssam struct grfdyninfo gd_dyn; /* everything changable by GRFIOCSINFO */ 71105197Ssam/* compatibility... */ 72105197Ssam#define gd_fbx gd_dyn.gdi_fbx 73105197Ssam#define gd_fby gd_dyn.gdi_fby 74105197Ssam#define gd_dwidth gd_dyn.gdi_dwidth 75105197Ssam#define gd_dheight gd_dyn.gdi_dheight 76105197Ssam#define gd_dx gd_dyn.gdi_dx 77105197Ssam#define gd_dy gd_dyn.gdi_dy 78105197Ssam 79105197Ssam /* new for banked pager support */ 80105197Ssam int gd_bank_size; /* size of a bank (or 0) */ 81105197Ssam}; 82105197Ssam 83105197Ssam 84105197Ssam/* video mode, should be display-independent, but it might need 85105197Ssam modifications in the future to really become hardware-independent. */ 86194062Svanhu 87194062Svanhustruct grfvideo_mode { 88194062Svanhu u_char mode_num; /* index in mode table */ 89194062Svanhu char mode_descr[80]; /* description of mode */ 90181627Svanhu u_long pixel_clock; /* in Hz. */ 91181627Svanhu u_short disp_width; /* width of displayed video (incl overscan) */ 92181627Svanhu u_short disp_height; /* height "" */ 93181627Svanhu u_short depth; /* number of bitplanes resp. bits per pixel */ 94181627Svanhu u_short hblank_start; 95105197Ssam u_short hblank_stop; 96105197Ssam u_short hsync_start; /* video-parameters, take care not to */ 97105197Ssam u_short hsync_stop; /* use parameters that violete specs of */ 98105197Ssam u_short htotal; /* your monitor ! */ 99105197Ssam u_short vblank_start; 100105197Ssam u_short vblank_stop; 101105197Ssam u_short vsync_start; 102105197Ssam u_short vsync_stop; 103105197Ssam u_short vtotal; 104120585Ssam}; 105120585Ssam 106105197Ssam 107120585Ssam/* 108120585Ssam * BSD ioctls 109105197Ssam */ 110105197Ssam#define OGRFIOCGINFO 0x40344700 /* to keep compat for a while... */ 111105197Ssam#define GRFIOCGINFO _IOR('G', 0, struct grfinfo) /* get info on device */ 112105197Ssam#define GRFIOCON _IO('G', 1) /* turn graphics on */ 113105197Ssam#define GRFIOCOFF _IO('G', 2) /* turn graphics off */ 114105197Ssam#define GRFIOCMAP _IOWR('G', 5, int) /* map in regs+framebuffer */ 115105197Ssam#define GRFIOCUNMAP _IOW('G', 6, int) /* unmap regs+framebuffer */ 116105197Ssam 117105197Ssam/* amiga addons */ 118105197Ssam /* set info on device */ 119105197Ssam#define GRFIOCSINFO _IOW('G', 40, struct grfdyninfo) 120105197Ssam /* get video_mode. mode_num==0 gets current mode. */ 121105197Ssam#define GRFGETVMODE _IOWR('G', 41, struct grfvideo_mode) 122105197Ssam /* set video_mode. */ 123105197Ssam#define GRFSETVMODE _IOW('G', 42, int) 124105197Ssam /* get number of configured video modes */ 125105197Ssam#define GRFGETNUMVM _IOR('G', 43, int) 126105197Ssam 127105197Ssam 128105197Ssam/* 129105197Ssam * generic framebuffer-related ioctls. These are somewhat 130105197Ssam * similar to SunOS fb-ioctls since I liked them reading 131105197Ssam * thru the X11-server code. 132105197Ssam */ 133105197Ssam 134105197Ssam/* 135120585Ssam * colormap related information. Every grf has an associated 136105197Ssam * colormap. Depending on the capabilities of the hardware, more 137105197Ssam * or less of the information provided may be used. 138105197Ssam * Maxium value of "index" can be deduced from grfinfo->gd_colors. 139105197Ssam */ 140105197Ssamstruct grf_colormap { 141105197Ssam int index; /* start at red[index],green[index],blue[index] */ 142105197Ssam int count; /* till < red[index+count],... */ 143105197Ssam u_char *red; 144105197Ssam u_char *green; 145105197Ssam u_char *blue; 146105197Ssam}; 147105197Ssam 148120585Ssam/* write the selected slots into the active colormap */ 149105197Ssam#define GRFIOCPUTCMAP _IOW('G', 50, struct grf_colormap) 150105197Ssam 151105197Ssam/* retrieve the selected slots from the active colormap */ 152105197Ssam#define GRFIOCGETCMAP _IOWR('G', 51, struct grf_colormap) 153105197Ssam 154105197Ssam 155105197Ssam/* 156105197Ssam * support a possibly available hardware sprite. calls just fail 157105197Ssam * if a given grf doesn't implement hardware sprites. 158105197Ssam */ 159105197Ssamstruct grf_position { 160105197Ssam u_short x, y; /* 0,0 is upper left corner */ 161105197Ssam}; 162105197Ssam#define GRFIOCSSPRITEPOS _IOW('G', 52, struct grf_position) 163105197Ssam#define GRFIOCGSPRITEPOS _IOR('G', 53, struct grf_position) 164105197Ssam 165105197Ssamstruct grf_spriteinfo { 166105197Ssam u_short set; 167181803Sbz#define GRFSPRSET_ENABLE (1<<0) 168238700Sbz#define GRFSPRSET_POS (1<<1) 169221129Sbz#define GRFSPRSET_HOT (1<<2) 170221129Sbz#define GRFSPRSET_CMAP (1<<3) 171221129Sbz#define GRFSPRSET_SHAPE (1<<4) 172221129Sbz#define GRFSPRSET_ALL 0x1f 173221129Sbz u_short enable; /* sprite is displayed if == 1 */ 174221129Sbz struct grf_position pos; /* sprite location */ 175221129Sbz struct grf_position hot; /* sprite hot spot */ 176221129Sbz struct grf_colormap cmap; /* colormap for the sprite. */ 177221129Sbz struct grf_position size; /* x == width, y == height */ 178221129Sbz u_char *image, *mask; /* sprite bitmap and mask */ 179221129Sbz}; 180221129Sbz 181221129Sbz#define GRFIOCSSPRITEINF _IOW('G', 54, struct grf_spriteinfo) 182221129Sbz#define GRFIOCGSPRITEINF _IOR('G', 55, struct grf_spriteinfo) 183221129Sbz 184221129Sbz/* get maximum sprite size hardware can display */ 185221129Sbz#define GRFIOCGSPRITEMAX _IOR('G', 56, struct grf_position) 186221129Sbz 187221129Sbz 188221129Sbz/* support for a BitBlt operation. The op-codes are identical 189221129Sbz to X11 GCs */ 190105197Ssam#define GRFBBOPclear 0x0 /* 0 */ 191117056Ssam#define GRFBBOPand 0x1 /* src AND dst */ 192105197Ssam#define GRFBBOPandReverse 0x2 /* src AND NOT dst */ 193223637Sbz#define GRFBBOPcopy 0x3 /* src */ 194223637Sbz#define GRFBBOPandInverted 0x4 /* NOT src AND dst */ 195105197Ssam#define GRFBBOPnoop 0x5 /* dst */ 196105197Ssam#define GRFBBOPxor 0x6 /* src XOR dst */ 197105197Ssam#define GRFBBOPor 0x7 /* src OR dst */ 198105197Ssam#define GRFBBOPnor 0x8 /* NOT src AND NOT dst */ 199105197Ssam#define GRFBBOPequiv 0x9 /* NOT src XOR dst */ 200105197Ssam#define GRFBBOPinvert 0xa /* NOT dst */ 201105197Ssam#define GRFBBOPorReverse 0xb /* src OR NOT dst */ 202105197Ssam#define GRFBBOPcopyInverted 0xc /* NOT src */ 203105197Ssam#define GRFBBOPorInverted 0xd /* NOT src OR dst */ 204105197Ssam#define GRFBBOPnand 0xe /* NOT src OR NOT dst */ 205105197Ssam#define GRFBBOPset 0xf /* 1 */ 206105197Ssam 207105197Ssamstruct grf_bitblt { 208194062Svanhu u_short op; /* see above */ 209194062Svanhu u_short src_x, src_y; /* upper left corner of source-region */ 210194062Svanhu u_short dst_x, dst_y; /* upper left corner of dest-region */ 211194062Svanhu u_short w, h; /* width, height of region */ 212194062Svanhu u_short mask; /* bitmask to apply */ 213194062Svanhu}; 214194062Svanhu 215194062Svanhu#define GRFIOCBITBLT _IOR('G', 57, struct grf_bitblt) 216194062Svanhu 217194062Svanhu#endif /* _MACHINE_GRFIOCTL_H_ */ 218194062Svanhu