Home | History | Annotate | Line # | Download | only in dev
grfioctl.h revision 1.11
      1  1.11    andvar /*	$NetBSD: grfioctl.h,v 1.11 2021/11/01 21:28:02 andvar Exp $	*/
      2   1.1       leo 
      3   1.1       leo /*
      4   1.9     rmind  * 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.10  dholland #include <sys/ioccom.h>
     45  1.10  dholland 
     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.8  christos 	void *	gd_fbaddr;	/* frame buffer linear physaddr	*/
     59   1.3    thomas 	int	gd_fbsize;	/* frame buffer linear size	*/
     60   1.3    thomas 	int	gd_linbase;	/* frame buffer linear base	*/
     61   1.8  christos 	void *	gd_regaddr;	/* register area physaddr	*/
     62   1.2       leo 	int	gd_regsize;	/* register area size		*/
     63   1.8  christos 	void *gd_vgaaddr;	/* vga area physaddr		*/
     64   1.3    thomas 	int	gd_vgasize;	/* vga area size		*/
     65   1.3    thomas 	int	gd_vgabase;	/* vga area base		*/
     66   1.1       leo 	short	gd_colors;	/* number of colors		*/
     67   1.1       leo 	short	gd_planes;	/* number of planes		*/
     68   1.1       leo 
     69   1.1       leo 	int	gd_fbwidth;	/* frame buffer width		*/
     70   1.1       leo 	int	gd_fbheight;	/* frame buffer height		*/
     71   1.1       leo 
     72   1.1       leo 	struct grfdyninfo gd_dyn; /* everything changable by GRFIOCSINFO */
     73   1.1       leo /* compatibility... */
     74   1.1       leo #define gd_fbx		gd_dyn.gdi_fbx
     75   1.1       leo #define gd_fby		gd_dyn.gdi_fby
     76   1.1       leo #define gd_dwidth 	gd_dyn.gdi_dwidth
     77   1.1       leo #define gd_dheight	gd_dyn.gdi_dheight
     78   1.1       leo #define gd_dx		gd_dyn.gdi_dx
     79   1.1       leo #define gd_dy		gd_dyn.gdi_dy
     80   1.1       leo 
     81   1.1       leo 	/* new for banked pager support */
     82   1.1       leo 	int	gd_bank_size;		/* size of a bank (or 0) */
     83   1.1       leo };
     84   1.1       leo 
     85   1.1       leo 
     86   1.7       wiz /* video mode, should be display-independent, but it might need
     87   1.7       wiz    modifications in the future to really become hardware-independent. */
     88   1.1       leo 
     89   1.1       leo struct grfvideo_mode {
     90   1.1       leo   u_char  mode_num;		/* index in mode table */
     91   1.1       leo   char	  mode_descr[80];	/* description of mode */
     92   1.1       leo   u_long  pixel_clock;		/* in Hz. */
     93   1.1       leo   u_short disp_width;		/* width of displayed video (incl overscan) */
     94   1.1       leo   u_short disp_height;		/* height "" */
     95   1.1       leo   u_short depth;		/* number of bitplanes resp. bits per pixel */
     96   1.1       leo   u_short hblank_start;
     97   1.1       leo   u_short hblank_stop;
     98   1.1       leo   u_short hsync_start;		/* video-parameters, take care not to   */
     99   1.1       leo   u_short hsync_stop;		/* use parameters that violete specs of */
    100   1.1       leo   u_short htotal;		/* your monitor !                       */
    101   1.1       leo   u_short vblank_start;
    102   1.1       leo   u_short vblank_stop;
    103   1.1       leo   u_short vsync_start;
    104   1.1       leo   u_short vsync_stop;
    105   1.1       leo   u_short vtotal;
    106   1.1       leo };
    107   1.1       leo 
    108   1.1       leo 
    109   1.1       leo /*
    110   1.1       leo  * BSD ioctls
    111   1.1       leo  */
    112   1.1       leo #define OGRFIOCGINFO	0x40344700		/* to keep compat for a while... */
    113   1.1       leo #define	GRFIOCGINFO	_IOR('G', 0, struct grfinfo) /* get info on device */
    114   1.1       leo #define	GRFIOCON	_IO('G', 1)		/* turn graphics on */
    115   1.1       leo #define	GRFIOCOFF	_IO('G', 2)		/* turn graphics off */
    116   1.1       leo #define GRFIOCMAP	_IOWR('G', 5, int)	/* map in regs+framebuffer */
    117   1.1       leo #define GRFIOCUNMAP	_IOW('G', 6, int)	/* unmap regs+framebuffer */
    118   1.1       leo 
    119   1.1       leo /* amiga addons */
    120   1.1       leo 	/* set info on device */
    121   1.1       leo #define	GRFIOCSINFO	_IOW('G', 40, struct grfdyninfo)
    122   1.1       leo 	/* get video_mode. mode_num==0 gets current mode. */
    123   1.1       leo #define GRFGETVMODE	_IOWR('G', 41, struct grfvideo_mode)
    124   1.1       leo 	/* set video_mode. */
    125   1.1       leo #define GRFSETVMODE	_IOW('G', 42, int)
    126   1.1       leo 	/* get number of configured video modes */
    127   1.1       leo #define GRFGETNUMVM	_IOR('G', 43, int)
    128   1.1       leo 
    129   1.1       leo 
    130   1.1       leo /*
    131   1.1       leo  * generic framebuffer-related ioctls. These are somewhat
    132   1.1       leo  * similar to SunOS fb-ioctls since I liked them reading
    133   1.1       leo  * thru the X11-server code.
    134   1.1       leo  */
    135   1.1       leo 
    136   1.1       leo /*
    137   1.1       leo  * colormap related information. Every grf has an associated
    138   1.1       leo  * colormap. Depending on the capabilities of the hardware, more
    139   1.1       leo  * or less of the information provided may be used.
    140  1.11    andvar  * Maximum value of "index" can be deduced from grfinfo->gd_colors.
    141   1.1       leo  */
    142   1.1       leo struct grf_colormap {
    143   1.1       leo   int	 index;	    /* start at red[index],green[index],blue[index] */
    144   1.1       leo   int	 count;	    /* till < red[index+count],... */
    145   1.1       leo   u_char *red;
    146   1.1       leo   u_char *green;
    147   1.1       leo   u_char *blue;
    148   1.1       leo };
    149   1.1       leo 
    150   1.1       leo /* write the selected slots into the active colormap */
    151   1.1       leo #define GRFIOCPUTCMAP	_IOW('G', 50, struct grf_colormap)
    152   1.1       leo 
    153   1.1       leo /* retrieve the selected slots from the active colormap */
    154   1.1       leo #define GRFIOCGETCMAP	_IOWR('G', 51, struct grf_colormap)
    155   1.1       leo 
    156   1.1       leo 
    157   1.1       leo /*
    158   1.1       leo  * support a possibly available hardware sprite. calls just fail
    159   1.1       leo  * if a given grf doesn't implement hardware sprites.
    160   1.1       leo  */
    161   1.1       leo struct grf_position {
    162   1.1       leo   u_short x, y;		/* 0,0 is upper left corner */
    163   1.1       leo };
    164   1.1       leo #define GRFIOCSSPRITEPOS _IOW('G', 52, struct grf_position)
    165   1.1       leo #define GRFIOCGSPRITEPOS _IOR('G', 53, struct grf_position)
    166   1.1       leo 
    167   1.1       leo struct grf_spriteinfo {
    168   1.1       leo   u_short  set;
    169   1.1       leo #define GRFSPRSET_ENABLE  (1<<0)
    170   1.1       leo #define GRFSPRSET_POS	  (1<<1)
    171   1.1       leo #define GRFSPRSET_HOT	  (1<<2)
    172   1.1       leo #define GRFSPRSET_CMAP	  (1<<3)
    173   1.1       leo #define GRFSPRSET_SHAPE	  (1<<4)
    174   1.1       leo #define GRFSPRSET_ALL	  0x1f
    175   1.1       leo   u_short  enable;	    /* sprite is displayed if == 1 */
    176   1.1       leo   struct grf_position pos;  /* sprite location */
    177   1.1       leo   struct grf_position hot;  /* sprite hot spot */
    178   1.1       leo   struct grf_colormap cmap; /* colormap for the sprite. */
    179   1.1       leo   struct grf_position size; /* x == width, y == height */
    180   1.1       leo   u_char *image, *mask;	    /* sprite bitmap and mask */
    181   1.1       leo };
    182   1.1       leo 
    183   1.1       leo #define GRFIOCSSPRITEINF _IOW('G', 54, struct grf_spriteinfo)
    184   1.1       leo #define GRFIOCGSPRITEINF _IOR('G', 55, struct grf_spriteinfo)
    185   1.1       leo 
    186   1.1       leo /* get maximum sprite size hardware can display */
    187   1.1       leo #define GRFIOCGSPRITEMAX _IOR('G', 56, struct grf_position)
    188   1.1       leo 
    189   1.1       leo 
    190   1.1       leo /* support for a BitBlt operation. The op-codes are identical
    191   1.1       leo    to X11 GCs */
    192   1.1       leo #define	GRFBBOPclear		0x0	/* 0 */
    193   1.1       leo #define GRFBBOPand		0x1	/* src AND dst */
    194   1.1       leo #define GRFBBOPandReverse	0x2	/* src AND NOT dst */
    195   1.1       leo #define GRFBBOPcopy		0x3	/* src */
    196   1.1       leo #define GRFBBOPandInverted	0x4	/* NOT src AND dst */
    197   1.1       leo #define	GRFBBOPnoop		0x5	/* dst */
    198   1.1       leo #define GRFBBOPxor		0x6	/* src XOR dst */
    199   1.1       leo #define GRFBBOPor		0x7	/* src OR dst */
    200   1.1       leo #define GRFBBOPnor		0x8	/* NOT src AND NOT dst */
    201   1.1       leo #define GRFBBOPequiv		0x9	/* NOT src XOR dst */
    202   1.1       leo #define GRFBBOPinvert		0xa	/* NOT dst */
    203   1.1       leo #define GRFBBOPorReverse	0xb	/* src OR NOT dst */
    204   1.1       leo #define GRFBBOPcopyInverted	0xc	/* NOT src */
    205   1.1       leo #define GRFBBOPorInverted	0xd	/* NOT src OR dst */
    206   1.1       leo #define GRFBBOPnand		0xe	/* NOT src OR NOT dst */
    207   1.1       leo #define GRFBBOPset		0xf	/* 1 */
    208   1.1       leo 
    209   1.1       leo struct grf_bitblt {
    210   1.1       leo   u_short op;		/* see above */
    211   1.1       leo   u_short src_x, src_y;	/* upper left corner of source-region */
    212   1.1       leo   u_short dst_x, dst_y;	/* upper left corner of dest-region */
    213   1.1       leo   u_short w, h;		/* width, height of region */
    214   1.1       leo   u_short mask;		/* bitmask to apply */
    215   1.1       leo };
    216   1.1       leo 
    217   1.1       leo #define GRFIOCBITBLT	_IOR('G', 57, struct grf_bitblt)
    218   1.1       leo 
    219   1.5        he #endif /* _MACHINE_GRFIOCTL_H_ */
    220