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