/*
 * Copyright 1988-1994, Sun Microsystems, Inc.
 */

#ifndef	_SYS_CG6IO_H
#define	_SYS_CG6IO_H

#pragma ident	"@(#)cg6io.h	1.1	94/06/13 SMI"

#define	CG6IOC		('F'<<8)

/*
 * hardware cursor control
 */

struct cg6curpos {
	short x, y;
};

/*
 * Color map I/O.
 */
struct	cg6cmap {
	int		index;		/* first element (0 origin) */
	int		count;		/* number of elements */
	unsigned char	*red;		/* red color map elements */
	unsigned char	*green;		/* green color map elements */
	unsigned char	*blue;		/* blue color map elements */
};

struct cg6cursor {
	short set;		/* what to set */
#define	CG6_CUR_SETCUR	0x01
#define	CG6_CUR_SETPOS	0x02
#define	CG6_CUR_SETHOT	0x04
#define	CG6_CUR_SETCMAP	0x08
#define	CG6_CUR_SETSHAPE 0x10
#define	CG6_CUR_SETALL	0x1F
	short enable;		/* cursor on/off */
	struct cg6curpos pos;	/* cursor position */
	struct cg6curpos hot;	/* cursor hot spot */
	struct cg6cmap cmap;	/* color map info */
	struct cg6curpos size;	/* cursor bit map size */
	char *image;		/* cursor image bits */
	char *mask;		/* cursor mask bits */
};

/* set/get cursor attributes/shape */
#define	CG6IOSCURSOR	(CG6IOC|24)
#define	CG6IOGCURSOR	(CG6IOC|25)

/* set/get cursor position */
#define	CG6IOSCURPOS	(CG6IOC|26)
#define	CG6IOGCURPOS	(CG6IOC|27)

/* get max cursor size */
#define	CG6IOGCURMAX	(CG6IOC|28)

struct cg6_inform {
	u_short	  accessible_width;	/* accessible bytes in scanline */
	u_short	  accessible_height;	/* number of accessible scanlines */
	u_short	  line_bytes;		/* number of bytes/scanline */
	u_short	  hdb_capable;		/* can this thing hardware db? */
	u_short	  vmsize;		/* this is Mb of video memory */
	u_char	  boardrev;		/* board revision # */
	u_char	  slot;			/* sbus slot # */
	u_long	  pad1;			/* expansion */
};

#define	CG6_MON_TYPE_STEREO		0x8	/* stereo display */
#define	CG6_MON_TYPE_0_OFFSET	0x4	/* black level 0 ire instead of 7.5 */
#define	CG6_MON_TYPE_OVERSCAN	0x2	/* overscan */
#define	CG6_MON_TYPE_GRAY	0x1	/* greyscale monitor */

struct cg6_mon_info {
	u_long	  mon_type;		/* bit array: defined above */
	u_long	  pixfreq;		/* pixel frequency in Hz */
	u_long	  hfreq;		/* horizontal freq in Hz */
	u_long	  vfreq;		/* vertical freq in Hz */
	u_long	  vsync;		/* vertical sync in scanlines */
	u_long	  hsync;		/* horizontal sync in pixels */
					/* these are in pixel units */
	u_short	  hfporch;		/* horizontal front porch */
	u_short	  hbporch;		/* horizontal back porch */
	u_short	  vfporch;		/* vertical front porch */
	u_short	  vbporch;		/* vertical back porch */
};

#define	CG6_IDENTIFIER 12	/* accelerated 8bit */

/*
 * Set/Get attributes
 */
#define	CG6_ATTR_NDEVSPECIFIC	8	/* no. of device specific values */
#define	CG6_ATTR_NEMUTYPES	4	/* no. of emulation types */

struct cg6_sattr {
	int	flags;			/* misc flags */
	int	emu_type;		/* emulation type (-1 if unused) */
	int	dev_specific[CG6_ATTR_NDEVSPECIFIC];	/* catchall */
};

struct	cg6_info_more {
	int	fb_type;	/* as defined below */
	int	fb_height;	/* in pixels */
	int	fb_width;	/* in pixels */
	int	fb_depth;	/* bits per pixel */
	int	fb_cmsize;	/* size of color map (entries) */
	int	fb_size;	/* total size in bytes */
};

struct cg6_gattr {
	int	real_type;		/* real device type */
	int	owner;			/* PID of owner, 0 if myself */
	struct cg6_info_more fbtype;	/* fbtype info for real device */
	struct cg6_sattr sattr;		/* see above */
	int	emu_types[CG6_ATTR_NEMUTYPES];	/* possible emulations */
						/* (-1 if unused) */
};

#define	CG6IOSATTR	(CG6IOC|5)
#define	CG6IOGATTR	(CG6IOC|6)

#define	CG6IOPUTCMAP	(CG6IOC|3)
#define	CG6IOGETCMAP	(CG6IOC|4)

/*
 * Video control
 * (the unused bits are reserved for future use)
 */
#define	CG6VIDEO_OFF	0
#define	CG6VIDEO_ON	1

#define	CG6IOSVIDEO	(CG6IOC|7)
#define	CG6IOGVIDEO	(CG6IOC|8)

#define	CG6IOVERTICAL	(CG6IOC|9)

#define	CG6IOGXINFO	(CG6IOC|39)
#define	CG6IOMONINFO	(CG6IOC|40)

#define	CG6IOVRTOFFSET	(CG6IOC|38)


#endif /* _SYS_CG6IO_H */
