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