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