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