xref: /original-bsd/sys/sparc/sbus/btvar.h (revision edc2ab72)
1 /*
2  * Copyright (c) 1993 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This software was developed by the Computer Systems Engineering group
6  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7  * contributed to Berkeley.
8  *
9  * All advertising materials mentioning features or use of this software
10  * must display the following acknowledgement:
11  *	This product includes software developed by the University of
12  *	California, Lawrence Berkeley Laboratory.
13  *
14  * %sccs.include.redist.c%
15  *
16  *	@(#)btvar.h	8.1 (Berkeley) 10/30/93
17  *
18  * from: $Header: btvar.h,v 1.1 93/10/12 15:29:01 torek Exp $
19  */
20 
21 /*
22  * Brooktree color frame buffer state variables (see btreg.h).
23  *
24  * Unfortunately, remarkably little code can be shared between the
25  * cg3 and cg6 drivers here, as the cg3 registers do longword-ops
26  * `as expected', but the cg6 ones use only the upper byte.
27  *
28  * Still, the software color map manipulation is not completely trivial.
29  */
30 union bt_cmap {
31 	u_char  cm_map[256][3];		/* 256 R/G/B entries */
32 	u_int   cm_chip[256 * 3 / 4];	/* the way the chip gets loaded */
33 };
34 
35 /*
36  * Routines in bt_subr.c.
37  */
38 int	bt_getcmap __P((struct fbcmap *, union bt_cmap *, int));
39 int	bt_putcmap __P((struct fbcmap *, union bt_cmap *, int));
40 
41 /*
42  * Compute (x / 4) * 3 and (x / 4) * 4.  These are used in turning
43  * RGB indices (which are in multiples of three) into `chip RGB' values
44  * (which are in multiples of four).
45  */
46 #define	BT_D4M3(x) ((((x) >> 2) << 1) + ((x) >> 2))	/* (x / 4) * 3 */
47 #define	BT_D4M4(x) ((x) & ~3)				/* (x / 4) * 4 */
48