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