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