sunGX.h revision ee7c6486
1/*
2 * $Xorg: sunGX.h,v 1.4 2001/02/09 02:04:44 xorgcvs Exp $
3 *
4Copyright 1991, 1998  The Open Group
5
6Permission to use, copy, modify, distribute, and sell this software and its
7documentation for any purpose is hereby granted without fee, provided that
8the above copyright notice appear in all copies and that both that
9copyright notice and this permission notice appear in supporting
10documentation.
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
18OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22Except as contained in this notice, the name of The Open Group shall not be
23used in advertising or otherwise to promote the sale, use or other dealings
24in this Software without prior written authorization from The Open Group.
25 *
26 * Author:  Keith Packard, MIT X Consortium
27 */
28/* $XFree86: xc/programs/Xserver/hw/sun/sunGX.h,v 1.4 2001/12/14 19:59:43 dawes Exp $ */
29
30typedef unsigned int	Uint;
31typedef volatile Uint VUint;
32
33/* modes */
34#define GX_INDEX(n)	    ((n) << 4)
35#define GX_INDEX_ALL	    0x00000030
36#define GX_INDEX_MOD	    0x00000040
37#define GX_BDISP_0	    0x00000080
38#define GX_BDISP_1	    0x00000100
39#define GX_BDISP_ALL	    0x00000180
40#define GX_BREAD_0	    0x00000200
41#define GX_BREAD_1	    0x00000400
42#define GX_BREAD_ALL	    0x00000600
43#define GX_BWRITE1_ENABLE   0x00000800
44#define GX_BWRITE1_DISABLE  0x00001000
45#define GX_BWRITE1_ALL	    0x00001800
46#define GX_BWRITE0_ENABLE   0x00002000
47#define GX_BWRITE0_DISABLE  0x00004000
48#define GX_BWRITE0_ALL	    0x00006000
49#define GX_DRAW_RENDER	    0x00008000
50#define GX_DRAW_PICK	    0x00010000
51#define GX_DRAW_ALL	    0x00018000
52#define GX_MODE_COLOR8	    0x00020000
53#define GX_MODE_COLOR1	    0x00040000
54#define GX_MODE_HRMONO	    0x00060000
55#define GX_MODE_ALL	    0x00060000
56#define GX_VBLANK	    0x00080000
57#define GX_BLIT_NOSRC	    0x00100000
58#define GX_BLIT_SRC	    0x00200000
59#define GX_BLIT_ALL	    0x00300000
60
61/* rasterops */
62#define GX_ROP_CLEAR	    0x0
63#define GX_ROP_INVERT	    0x1
64#define GX_ROP_NOOP	    0x2
65#define GX_ROP_SET	    0x3
66
67#define GX_ROP_00_0(rop)    ((rop) << 0)
68#define GX_ROP_00_1(rop)    ((rop) << 2)
69#define GX_ROP_01_0(rop)    ((rop) << 4)
70#define GX_ROP_01_1(rop)    ((rop) << 6)
71#define GX_ROP_10_0(rop)    ((rop) << 8)
72#define GX_ROP_10_1(rop)    ((rop) << 10)
73#define GX_ROP_11_0(rop)    ((rop) << 12)
74#define GX_ROP_11_1(rop)    ((rop) << 14)
75#define GX_PLOT_PLOT	    0x00000000
76#define GX_PLOT_UNPLOT	    0x00020000
77#define GX_RAST_BOOL	    0x00000000
78#define GX_RAST_LINEAR	    0x00040000
79#define GX_ATTR_UNSUPP	    0x00400000
80#define GX_ATTR_SUPP	    0x00800000
81#define GX_POLYG_OVERLAP    0x01000000
82#define GX_POLYG_NONOVERLAP 0x02000000
83#define GX_PATTERN_ZEROS    0x04000000
84#define GX_PATTERN_ONES	    0x08000000
85#define GX_PATTERN_MASK	    0x0c000000
86#define GX_PIXEL_ZEROS	    0x10000000
87#define GX_PIXEL_ONES	    0x20000000
88#define GX_PIXEL_MASK	    0x30000000
89#define GX_PLANE_ZEROS	    0x40000000
90#define GX_PLANE_ONES	    0x80000000
91#define GX_PLANE_MASK	    0xc0000000
92
93typedef struct _sunGX {
94	Uint	junk0[1];
95	VUint	mode;
96	VUint	clip;
97	Uint	junk1[1];
98	VUint	s;
99	VUint	draw;
100	VUint	blit;
101	VUint	font;
102	Uint	junk2[24];
103	VUint	x0, y0, z0, color0;
104	VUint	x1, y1, z1, color1;
105	VUint	x2, y2, z2, color2;
106	VUint	x3, y3, z3, color3;
107	VUint	offx, offy;
108	Uint	junk3[2];
109	VUint	incx, incy;
110	Uint	junk4[2];
111	VUint	clipminx, clipminy;
112	Uint	junk5[2];
113	VUint	clipmaxx, clipmaxy;
114	Uint	junk6[2];
115	VUint	fg;
116	VUint	bg;
117	VUint	alu;
118	VUint	pm;
119	VUint	pixelm;
120	Uint	junk7[2];
121	VUint	patalign;
122	VUint	pattern[8];
123	Uint	junk8[432];
124	VUint	apointx, apointy, apointz;
125	Uint	junk9[1];
126	VUint	rpointx, rpointy, rpointz;
127	Uint	junk10[5];
128	VUint	pointr, pointg, pointb, pointa;
129	VUint	alinex, aliney, alinez;
130	Uint	junk11[1];
131	VUint	rlinex, rliney, rlinez;
132	Uint	junk12[5];
133	VUint	liner, lineg, lineb, linea;
134	VUint	atrix, atriy, atriz;
135	Uint	junk13[1];
136	VUint	rtrix, rtriy, rtriz;
137	Uint	junk14[5];
138	VUint	trir, trig, trib, tria;
139	VUint	aquadx, aquady, aquadz;
140	Uint	junk15[1];
141	VUint	rquadx, rquady, rquadz;
142	Uint	junk16[5];
143	VUint	quadr, quadg, quadb, quada;
144	VUint	arectx, arecty, arectz;
145	Uint	junk17[1];
146	VUint	rrectx, rrecty, rrectz;
147	Uint	junk18[5];
148	VUint	rectr, rectg, rectb, recta;
149} sunGX, *sunGXPtr;
150
151/* Macros */
152
153#define GX_ROP_USE_PIXELMASK	0x30000000
154
155#define GX_BLT_INPROGRESS	0x20000000
156
157#define GX_INPROGRESS		0x10000000
158#define GX_FULL			0x20000000
159
160#define GXWait(gx,r)\
161    do\
162	(r) = (int) (gx)->s; \
163    while ((r) & GX_INPROGRESS)
164
165#define GXDrawDone(gx,r) \
166    do \
167	(r) = (int) (gx)->draw; \
168    while ((r) < 0 && ((r) & GX_FULL))
169
170#define GXBlitDone(gx,r)\
171    do\
172	(r)= (int) (gx)->blit; \
173    while ((r) < 0 && ((r) & GX_BLT_INPROGRESS))
174
175#define GXBlitInit(gx,rop,pmsk) {\
176    gx->fg = 0xff;\
177    gx->bg = 0x00;\
178    gx->pixelm = ~0;\
179    gx->s = 0;\
180    gx->alu = rop;\
181    gx->pm = pmsk;\
182    gx->clip = 0;\
183}
184
185#define GXDrawInit(gx,fore,rop,pmsk) {\
186    gx->fg = fore;\
187    gx->bg = 0x00; \
188    gx->pixelm = ~0; \
189    gx->s = 0; \
190    gx->alu = rop; \
191    gx->pm = pmsk; \
192    gx->clip = 0;\
193}
194
195#define GXStippleInit(gx,stipple) {\
196    int		_i; \
197    Uint	*sp; \
198    VUint	*dp; \
199    _i = 8;  \
200    sp = stipple->bits; \
201    dp = gx->pattern; \
202    while (_i--) {  \
203	dp[_i] =  sp[_i]; \
204    } \
205    gx->fg = stipple->fore; \
206    gx->bg = stipple->back; \
207    gx->patalign = stipple->patalign; \
208    gx->alu = stipple->alu; \
209}
210
211extern int  sunGXScreenPrivateIndex;
212extern int  sunGXGCPrivateIndex;
213extern int  sunGXWindowPrivateIndex;
214
215#define sunGXGetScreenPrivate(s)    ((sunGXPtr) \
216			    (s)->devPrivates[sunGXScreenPrivateIndex].ptr)
217
218typedef struct _sunGXStipple {
219    Uint	fore, back;
220    Uint	patalign;
221    Uint	alu;
222    Uint	bits[8];	/* actually 16 shorts */
223} sunGXStippleRec, *sunGXStipplePtr;
224
225typedef struct _sunGXPrivGC {
226    int		    type;
227    sunGXStipplePtr stipple;
228} sunGXPrivGCRec, *sunGXPrivGCPtr;
229
230#define sunGXGetGCPrivate(g)	    ((sunGXPrivGCPtr) \
231			    (g)->devPrivates[sunGXGCPrivateIndex].ptr)
232
233#define sunGXGetWindowPrivate(w)    ((sunGXStipplePtr) \
234			    (w)->devPrivates[sunGXWindowPrivateIndex].ptr)
235
236#define sunGXSetWindowPrivate(w,p) (\
237	    (w)->devPrivates[sunGXWindowPrivateIndex].ptr = (pointer) p)
238
239