1dfe64dd3Smacallan/*
2dfe64dd3Smacallan * 2D acceleration for 5597/5598 and 6326
3dfe64dd3Smacallan * Definitions for the XGI engine communication
4dfe64dd3Smacallan *
5dfe64dd3Smacallan * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
6dfe64dd3Smacallan * Parts Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria.
7dfe64dd3Smacallan *
8dfe64dd3Smacallan * Licensed under the following terms:
9dfe64dd3Smacallan *
10dfe64dd3Smacallan * Permission to use, copy, modify, distribute, and sell this software and its
11dfe64dd3Smacallan * documentation for any purpose is hereby granted without fee, provided that
12dfe64dd3Smacallan * the above copyright notice appears in all copies and that both that copyright
13dfe64dd3Smacallan * notice and this permission notice appear in supporting documentation, and
14dfe64dd3Smacallan * and that the name of the copyright holder not be used in advertising
15dfe64dd3Smacallan * or publicity pertaining to distribution of the software without specific,
16dfe64dd3Smacallan * written prior permission. The copyright holder makes no representations
17dfe64dd3Smacallan * about the suitability of this software for any purpose.  It is provided
18dfe64dd3Smacallan * "as is" without expressed or implied warranty.
19dfe64dd3Smacallan *
20dfe64dd3Smacallan * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
21dfe64dd3Smacallan * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
22dfe64dd3Smacallan * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
23dfe64dd3Smacallan * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
24dfe64dd3Smacallan * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
25dfe64dd3Smacallan * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26dfe64dd3Smacallan * PERFORMANCE OF THIS SOFTWARE.
27dfe64dd3Smacallan *
28dfe64dd3Smacallan * Authors:  Alan Hourihane <alanh@fairlite.demon.co.uk>,
29dfe64dd3Smacallan *           Mike Chapman <mike@paranoia.com>,
30dfe64dd3Smacallan *           Juanjo Santamarta <santamarta@ctv.es>,
31dfe64dd3Smacallan *           Mitani Hiroshi <hmitani@drl.mei.co.jp>,
32dfe64dd3Smacallan *           David Thomas <davtom@dream.org.uk>,
33dfe64dd3Smacallan *	     Thomas Winischhofer <thomas@winischhofer.net>.
34dfe64dd3Smacallan */
35dfe64dd3Smacallan
36dfe64dd3Smacallan#ifndef _XGI_315_ACCEL_H_
37dfe64dd3Smacallan#define _XGI_315_ACCEL_H_
38dfe64dd3Smacallan
39dfe64dd3Smacallan#include "xgi.h"
40dfe64dd3Smacallan
41dfe64dd3Smacallan/* Definitions for the XGI engine communication. */
42dfe64dd3Smacallan
43dfe64dd3Smacallan#define PATREGSIZE 256
44dfe64dd3Smacallan
45dfe64dd3Smacallan#define XGIG2_SCR2SCRCOPY
46dfe64dd3Smacallan#define XGIG2_SOLIDFILL
47dfe64dd3Smacallan#define XGIG2_8X8MONOPATFILL
48dfe64dd3Smacallan
49dfe64dd3Smacallan
50dfe64dd3Smacallan/*
51dfe64dd3Smacallan#define XGIG2_COLOREXPSCANLN
52dfe64dd3Smacallan#define XGIG2_SOLIDLINE
53dfe64dd3Smacallan#define XGIG2_DASHEDLINE
54dfe64dd3Smacallan#define XGIG2_S2SCOLOREXPANFILL
55dfe64dd3Smacallan#define XGIG2_8X8COLORPATFILL
56dfe64dd3Smacallan#define XGIG2_C2SCOLOREXPANFILL
57dfe64dd3Smacallan#define XGIG2_IMAGEWRITE
58dfe64dd3Smacallan#define XGIG2_COLOREXPSCANLN
59dfe64dd3Smacallan#define XGIG2_IMAGEWRITE
60dfe64dd3Smacallan*/
61dfe64dd3Smacallan
62dfe64dd3Smacallan#undef BR
63dfe64dd3Smacallan#define BR(x)   (0x8200 | (x) << 2)
64dfe64dd3Smacallan
65dfe64dd3Smacallan/* Definitions for the engine command */
66dfe64dd3Smacallan#define BITBLT                  0x00000000
67dfe64dd3Smacallan#define COLOREXP                0x00000001
68dfe64dd3Smacallan#define ENCOLOREXP              0x00000002
69dfe64dd3Smacallan#define MULTIPLE_SCANLINE       0x00000003
70dfe64dd3Smacallan#define LINE                    0x00000004
71dfe64dd3Smacallan#define TRAPAZOID_FILL          0x00000005
72dfe64dd3Smacallan#define TRANSPARENT_BITBLT      0x00000006
73dfe64dd3Smacallan
74dfe64dd3Smacallan#define SRCVIDEO                0x00000000
75dfe64dd3Smacallan#define SRCSYSTEM               0x00000010
76dfe64dd3Smacallan#define SRCAGP                  0x00000020
77dfe64dd3Smacallan
78dfe64dd3Smacallan#define PATFG                   0x00000000
79dfe64dd3Smacallan#define PATPATREG               0x00000040
80dfe64dd3Smacallan#define PATMONO                 0x00000080
81dfe64dd3Smacallan
82dfe64dd3Smacallan#define X_INC                   0x00010000
83dfe64dd3Smacallan#define X_DEC                   0x00000000
84dfe64dd3Smacallan#define Y_INC                   0x00020000
85dfe64dd3Smacallan#define Y_DEC                   0x00000000
86dfe64dd3Smacallan
87dfe64dd3Smacallan#define NOCLIP                  0x00000000
88dfe64dd3Smacallan#define NOMERGECLIP             0x04000000
89dfe64dd3Smacallan#define CLIPENABLE              0x00040000
90dfe64dd3Smacallan#define CLIPWITHOUTMERGE        0x04040000
91dfe64dd3Smacallan
92dfe64dd3Smacallan#define OPAQUE                  0x00000000
93dfe64dd3Smacallan#define TRANSPARENT             0x00100000
94dfe64dd3Smacallan
95dfe64dd3Smacallan#define DSTAGP                  0x02000000
96dfe64dd3Smacallan#define DSTVIDEO                0x02000000
97dfe64dd3Smacallan
98dfe64dd3Smacallan/* Line */
99dfe64dd3Smacallan#define LINE_STYLE              0x00800000
100dfe64dd3Smacallan#define NO_RESET_COUNTER        0x00400000
101dfe64dd3Smacallan#define NO_LAST_PIXEL           0x00200000
102dfe64dd3Smacallan
103dfe64dd3Smacallan/* Macros to do useful things with the XGI BitBLT engine */
104dfe64dd3Smacallan
105dfe64dd3Smacallan
106dfe64dd3Smacallan/*
107dfe64dd3Smacallan   bit 31 2D engine: 1 is idle,
108dfe64dd3Smacallan   bit 30 3D engine: 1 is idle,
109dfe64dd3Smacallan   bit 29 Command queue: 1 is empty
110dfe64dd3Smacallan*/
111dfe64dd3Smacallan
112dfe64dd3Smacallan#define GR_SKPC_HEADER          0x16800000L
113dfe64dd3Smacallan#define GR_NIL_CMD              0x168F0000L
114dfe64dd3Smacallan
115dfe64dd3Smacallan#define Dst_Hight		0xFFF
116dfe64dd3Smacallan
117dfe64dd3Smacallan#define BandSize 		0x10
118dfe64dd3Smacallan
119dfe64dd3Smacallan/* Jong 09/27/2007; recover for compiler error */
120dfe64dd3Smacallan/* typedef unsigned long ulong ; */
121dfe64dd3Smacallan
122dfe64dd3Smacallanunsigned long    r_port, w_port ;
123dfe64dd3Smacallan
124dfe64dd3Smacallanint     G2CmdQueLen;
125dfe64dd3Smacallanint 	Alignment ;
126dfe64dd3Smacallan/* int    GBCount = 0 ; */
127dfe64dd3Smacallan
128dfe64dd3Smacallanextern void Volari_SetDefaultIdleWait(XGIPtr pXGI, unsigned HDisplay,
129dfe64dd3Smacallan    unsigned depth);
130dfe64dd3Smacallanextern void Volari_Idle(XGIPtr pXGI);
131dfe64dd3Smacallan
132dfe64dd3Smacallan#define Volari_GetSwWP() (unsigned long)(*(pXGI->pCQ_shareWritePort))
133dfe64dd3Smacallan#define Volari_GetHwRP() (unsigned long)(MMIO_IN32(pXGI->IOBase, 0x85c8))
134dfe64dd3Smacallan
135dfe64dd3Smacallanvoid XGIDumpCMDQueue(ScrnInfoPtr pScrn);
136dfe64dd3Smacallan
137dfe64dd3Smacallan#define Volari_SyncWP\
138dfe64dd3Smacallan    {\
139dfe64dd3Smacallan        unsigned long p ;\
140dfe64dd3Smacallan        \
141dfe64dd3Smacallan        p = *(pXGI->pCQ_shareWritePort);\
142dfe64dd3Smacallan        PACCELDEBUG(ErrorF("Volari_SyncWP(%08lx)\n",(p)));\
143dfe64dd3Smacallan        MMIO_OUT32(pXGI->IOBase, 0x85c4,(p)) ;\
144dfe64dd3Smacallan    }
145dfe64dd3Smacallan
146dfe64dd3Smacallan#define Volari_UpdateHwWP(p)\
147dfe64dd3Smacallan    {\
148dfe64dd3Smacallan        PACCELDEBUG(ErrorF("Volari_UpdateHwWP(%08lx)\n",(p)));\
149dfe64dd3Smacallan        *(pXGI->pCQ_shareWritePort) = (p) ;\
150dfe64dd3Smacallan        MMIO_OUT32(pXGI->IOBase, 0x85c4, (p)) ;\
151dfe64dd3Smacallan    }
152dfe64dd3Smacallan
153dfe64dd3Smacallan#define Volari_UpdateSwWP(p)\
154dfe64dd3Smacallan    {\
155dfe64dd3Smacallan        PACCELDEBUG(ErrorF("Volari_UpdateSwWP(%08lx)\n",(p)));\
156dfe64dd3Smacallan        *(pXGI->pCQ_shareWritePort) = (p) ;\
157dfe64dd3Smacallan    }
158dfe64dd3Smacallan
159dfe64dd3Smacallan
160dfe64dd3Smacallan#define Volari_ResetCmd \
161dfe64dd3Smacallan    pXGI->CommandReg = 0 ;
162dfe64dd3Smacallan
163dfe64dd3Smacallan#define Volari_SetupROP(rop) \
164dfe64dd3Smacallan    pXGI->CommandReg |= (rop) << 8;
165dfe64dd3Smacallan
166dfe64dd3Smacallan#define Volari_SetupCMDFlag(flags) \
167dfe64dd3Smacallan    pXGI->CommandReg |= (flags);
168dfe64dd3Smacallan
169dfe64dd3Smacallan#if 1
170dfe64dd3Smacallan#define GuardBand(CS)\
171dfe64dd3Smacallan{\
172dfe64dd3Smacallan	unsigned long lTemp ;\
173dfe64dd3Smacallan	int waitCount = 0, maxCount = 1000 ;\
174dfe64dd3Smacallan	w_port = Volari_GetSwWP() ;\
175dfe64dd3Smacallan	lTemp = (r_port - w_port - BandSize) & pXGI->cmdQueueSizeMask ;\
176dfe64dd3Smacallan	if( lTemp < (CS) )\
177dfe64dd3Smacallan	{\
178dfe64dd3Smacallan		Volari_SyncWP;\
179dfe64dd3Smacallan		w_port = Volari_GetSwWP() ;\
180dfe64dd3Smacallan		do{\
181dfe64dd3Smacallan			waitCount++ ;\
182dfe64dd3Smacallan                	r_port = Volari_GetHwRP(); \
183dfe64dd3Smacallan			lTemp = (r_port - w_port - BandSize)&pXGI->cmdQueueSizeMask ;\
184dfe64dd3Smacallan			if( lTemp >= (CS) ) break ;\
185dfe64dd3Smacallan			if( waitCount > maxCount ){\
186dfe64dd3Smacallan				waitCount = 0 ;\
187dfe64dd3Smacallan				maxCount /= 10 ; maxCount *= 2;\
188dfe64dd3Smacallan				usleep(1) ;\
189dfe64dd3Smacallan			}\
190dfe64dd3Smacallan		}while(lTemp < (CS)) ;\
191dfe64dd3Smacallan	}\
192dfe64dd3Smacallan}
193dfe64dd3Smacallan#else
194dfe64dd3Smacallan#define GuardBand(CS)\
195dfe64dd3Smacallan    {\
196dfe64dd3Smacallan        unsigned long lTemp ; \
197dfe64dd3Smacallan        \
198dfe64dd3Smacallan        w_port = Volari_GetSwWP();  \
199dfe64dd3Smacallan        lTemp = r_port - w_port + pXGI->cmdQueueSize ; \
200dfe64dd3Smacallan        \
201dfe64dd3Smacallan        if( ((lTemp & pXGI->cmdQueueSizeMask ) < (BandSize + CS)) && ( r_port != w_port ) ) \
202dfe64dd3Smacallan        { \
203dfe64dd3Smacallan            while ( 1 ) \
204dfe64dd3Smacallan            { \
205dfe64dd3Smacallan                r_port = Volari_GetHwRP(); \
206dfe64dd3Smacallan                if(r_port == w_port) \
207dfe64dd3Smacallan                    break; \
208dfe64dd3Smacallan                lTemp = r_port - w_port + pXGI->cmdQueueSize ; \
209dfe64dd3Smacallan                if( (lTemp & pXGI->cmdQueueSizeMask ) >= (BandSize + CS) ) \
210dfe64dd3Smacallan                    break; \
211dfe64dd3Smacallan                usleep(1);/*usleep(100);*//* Jong Lin 08-29-2005 */\
212dfe64dd3Smacallan            } \
213dfe64dd3Smacallan        } \
214dfe64dd3Smacallan    }
215dfe64dd3Smacallan#endif
216dfe64dd3Smacallan
217dfe64dd3Smacallan/*
218dfe64dd3Smacallan#define GuardBand(CS)\
219dfe64dd3Smacallan    {\
220dfe64dd3Smacallan        long lTemp ; \
221dfe64dd3Smacallan        w_port = Volari_GetSwWP();  \
222dfe64dd3Smacallan        while ( 1 ) \
223dfe64dd3Smacallan        { \
224dfe64dd3Smacallan            r_port = Volari_GetHwRP(); \
225dfe64dd3Smacallan            if(r_port == w_port)\
226dfe64dd3Smacallan                break; \
227dfe64dd3Smacallan            lTemp = r_port - w_port + pXGI->cmdQueueSize ; \
228dfe64dd3Smacallan            if( (lTemp & pXGI->cmdQueueSizeMask ) >= (BandSize + CS) ) \
229dfe64dd3Smacallan                break; \
230dfe64dd3Smacallan        }\
231dfe64dd3Smacallan   }
232dfe64dd3Smacallan*/
233dfe64dd3Smacallan
234dfe64dd3Smacallan#define Volari_DoCMD\
235dfe64dd3Smacallan    {\
236dfe64dd3Smacallan        unsigned long ulTemp ;\
237dfe64dd3Smacallan        \
238dfe64dd3Smacallan        PACCELDEBUG(ErrorF("pXGI->CommandReg = %08lX\n", pXGI->CommandReg));\
239dfe64dd3Smacallan        \
240dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
241dfe64dd3Smacallan        \
242dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
243dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x823C) ;\
244dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
245dfe64dd3Smacallan            (CARD32)BE_SWAP32(pXGI->CommandReg) ;\
246dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
247dfe64dd3Smacallan        { \
248dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
249dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
250dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
251dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
252dfe64dd3Smacallan            ulTemp += 0x10 ;\
253dfe64dd3Smacallan        } \
254dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
255dfe64dd3Smacallan            ulTemp += 0x08 ;\
256dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
257dfe64dd3Smacallan        Volari_UpdateHwWP(ulTemp) ;\
258dfe64dd3Smacallan        \
259dfe64dd3Smacallan    }
260dfe64dd3Smacallan
261dfe64dd3Smacallan/**********************************************************************
262dfe64dd3Smacallan#define Volari_SetupSRCBase(base) \
263dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
264dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(0), base);\
265dfe64dd3Smacallan                G2CmdQueLen --;
266dfe64dd3Smacallan **********************************************************************/
267dfe64dd3Smacallan
268dfe64dd3Smacallan#define Volari_SetupSRCBase(base) \
269dfe64dd3Smacallan    {\
270dfe64dd3Smacallan        unsigned long ulTemp ;\
271dfe64dd3Smacallan        \
272dfe64dd3Smacallan		if(base != g_srcbase) \
273dfe64dd3Smacallan		{ \
274dfe64dd3Smacallan			g_srcbase = base; \
275dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
276dfe64dd3Smacallan        \
277dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
278dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x8200) ;\
279dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
280dfe64dd3Smacallan            (CARD32)BE_SWAP32(base) ;\
281dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
282dfe64dd3Smacallan        { \
283dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
284dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
285dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
286dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
287dfe64dd3Smacallan            ulTemp += 0x10 ;\
288dfe64dd3Smacallan        } \
289dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
290dfe64dd3Smacallan            ulTemp += 0x08 ;\
291dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
292dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
293dfe64dd3Smacallan		} \
294dfe64dd3Smacallan    }
295dfe64dd3Smacallan
296dfe64dd3Smacallan
297dfe64dd3Smacallan/***********************************************************************
298dfe64dd3Smacallan#define Volari_SetupSRCPitch(pitch) \
299dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
300dfe64dd3Smacallan                MMIO_OUT16(pXGI->IOBase, BR(1), pitch);\
301dfe64dd3Smacallan                G2CmdQueLen --;
302dfe64dd3Smacallan
303dfe64dd3Smacallan***********************************************************************/
304dfe64dd3Smacallan
305dfe64dd3Smacallan#define Volari_SetupSRCPitch(pitch) \
306dfe64dd3Smacallan        {\
307dfe64dd3Smacallan        unsigned long ulTemp ;\
308dfe64dd3Smacallan		if(pitch != g_SrcPitch)	\
309dfe64dd3Smacallan		{	\
310dfe64dd3Smacallan		g_SrcPitch = pitch;	\
311dfe64dd3Smacallan        \
312dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
313dfe64dd3Smacallan        \
314dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
315dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x8204) ;\
316dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
317dfe64dd3Smacallan            (CARD32)BE_SWAP32(pitch) ;\
318dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
319dfe64dd3Smacallan        { \
320dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
321dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
322dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
323dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
324dfe64dd3Smacallan            ulTemp += 0x10 ;\
325dfe64dd3Smacallan        } \
326dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
327dfe64dd3Smacallan            ulTemp += 0x08 ;\
328dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
329dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
330dfe64dd3Smacallan		}	\
331dfe64dd3Smacallan        \
332dfe64dd3Smacallan    }
333dfe64dd3Smacallan
334dfe64dd3Smacallan/***********************************************************************
335dfe64dd3Smacallan#define Volari_SetupSRCXY(x,y) \
336dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
337dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(2), (x)<<16 | (y) );\
338dfe64dd3Smacallan                G2CmdQueLen --;
339dfe64dd3Smacallan***********************************************************************/
340dfe64dd3Smacallan
341dfe64dd3Smacallan#define Volari_SetupSRCXY(x,y) \
342dfe64dd3Smacallan        {\
343dfe64dd3Smacallan        unsigned long ulTemp ;\
344dfe64dd3Smacallan        \
345dfe64dd3Smacallan			if((x != g_src_x) || (y != g_src_y)) \
346dfe64dd3Smacallan			{ \
347dfe64dd3Smacallan				g_src_x = x; \
348dfe64dd3Smacallan				g_src_y = y; \
349dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
350dfe64dd3Smacallan        \
351dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
352dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x8208) ;\
353dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
354dfe64dd3Smacallan            (CARD32)BE_SWAP32((x<<16)+(y&0xFFFF)) ;\
355dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
356dfe64dd3Smacallan        { \
357dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
358dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
359dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
360dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
361dfe64dd3Smacallan            ulTemp += 0x10 ;\
362dfe64dd3Smacallan        } \
363dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
364dfe64dd3Smacallan            ulTemp += 0x08 ;\
365dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
366dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
367dfe64dd3Smacallan			} \
368dfe64dd3Smacallan    }
369dfe64dd3Smacallan
370dfe64dd3Smacallan/***********************************************************************
371dfe64dd3Smacallan#define Volari_SetupDSTBase(base) \
372dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
373dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(4), base);\
374dfe64dd3Smacallan                G2CmdQueLen --;
375dfe64dd3Smacallan
376dfe64dd3Smacallan***********************************************************************/
377dfe64dd3Smacallan
378dfe64dd3Smacallan#define Volari_SetupDSTBase(base) \
379dfe64dd3Smacallan        {\
380dfe64dd3Smacallan        unsigned long ulTemp ;\
381dfe64dd3Smacallan        \
382dfe64dd3Smacallan			if(base != g_dstbase) \
383dfe64dd3Smacallan			{ \
384dfe64dd3Smacallan				g_dstbase=base; \
385dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
386dfe64dd3Smacallan        \
387dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
388dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x8210) ;\
389dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
390dfe64dd3Smacallan            (CARD32)BE_SWAP32(base) ;\
391dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
392dfe64dd3Smacallan        { \
393dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
394dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
395dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
396dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
397dfe64dd3Smacallan            ulTemp += 0x10 ;\
398dfe64dd3Smacallan        } \
399dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
400dfe64dd3Smacallan            ulTemp += 0x08 ;\
401dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
402dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
403dfe64dd3Smacallan			} \
404dfe64dd3Smacallan    }
405dfe64dd3Smacallan
406dfe64dd3Smacallan/***********************************************************************
407dfe64dd3Smacallan#define Volari_SetupDSTXY(x,y) \
408dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
409dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(3), (x)<<16 | (y) );\
410dfe64dd3Smacallan                G2CmdQueLen --;
411dfe64dd3Smacallan
412dfe64dd3Smacallan***********************************************************************/
413dfe64dd3Smacallan
414dfe64dd3Smacallan#define Volari_SetupDSTXY(x,y) \
415dfe64dd3Smacallan        {\
416dfe64dd3Smacallan        unsigned long ulTemp ;\
417dfe64dd3Smacallan        \
418dfe64dd3Smacallan			if((x != g_dst_x) || (y != g_dst_y)) \
419dfe64dd3Smacallan			{ \
420dfe64dd3Smacallan				g_dst_x = x; \
421dfe64dd3Smacallan				g_dst_y = y; \
422dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
423dfe64dd3Smacallan        \
424dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
425dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x820C) ;\
426dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
427dfe64dd3Smacallan            (CARD32)BE_SWAP32(((x)<<16)+((y)&0xFFFF)) ;\
428dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
429dfe64dd3Smacallan        { \
430dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
431dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
432dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
433dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
434dfe64dd3Smacallan            ulTemp += 0x10 ;\
435dfe64dd3Smacallan        } \
436dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
437dfe64dd3Smacallan            ulTemp += 0x08 ;\
438dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
439dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
440dfe64dd3Smacallan			} \
441dfe64dd3Smacallan    }
442dfe64dd3Smacallan
443dfe64dd3Smacallan/***********************************************************************
444dfe64dd3Smacallan#define Volari_SetupDSTRect(x,y) \
445dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
446dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(5), (y)<<16 | (x) );\
447dfe64dd3Smacallan                G2CmdQueLen --;
448dfe64dd3Smacallan
449dfe64dd3Smacallan***********************************************************************/
450dfe64dd3Smacallan
451dfe64dd3Smacallan#define Volari_SetupDSTRect(x,y) \
452dfe64dd3Smacallan        {\
453dfe64dd3Smacallan        unsigned long ulTemp ;\
454dfe64dd3Smacallan        \
455dfe64dd3Smacallan		if( (x != g_DstRectX) || (y != g_DstRectY)) \
456dfe64dd3Smacallan		{ \
457dfe64dd3Smacallan		g_DstRectX = x; \
458dfe64dd3Smacallan		g_DstRectY = y; \
459dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
460dfe64dd3Smacallan        \
461dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
462dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x8214) ;\
463dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
464dfe64dd3Smacallan            (CARD32)BE_SWAP32(((y)<<16)|((x)&0xFFFF)) ;\
465dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
466dfe64dd3Smacallan        { \
467dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
468dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
469dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
470dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
471dfe64dd3Smacallan            ulTemp += 0x10 ;\
472dfe64dd3Smacallan        } \
473dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
474dfe64dd3Smacallan            ulTemp += 0x08 ;\
475dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
476dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
477dfe64dd3Smacallan	Volari_UpdateHwWP(ulTemp) ;\
478dfe64dd3Smacallan		}	\
479dfe64dd3Smacallan        \
480dfe64dd3Smacallan    }
481dfe64dd3Smacallan
482dfe64dd3Smacallan/***********************************************************************
483dfe64dd3Smacallan#define Volari_SetupDSTColorDepth(bpp) \
484dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
485dfe64dd3Smacallan                MMIO_OUT16(pXGI->IOBase, BR(1)+2, bpp);\
486dfe64dd3Smacallan                G2CmdQueLen --;
487dfe64dd3Smacallan***********************************************************************/
488dfe64dd3Smacallan
489dfe64dd3Smacallan#define Volari_SetupDSTColorDepth(bpp) \
490dfe64dd3Smacallan    pXGI->CommandReg |= ((ulong)(bpp))&(GENMASK(17:16)) ;
491dfe64dd3Smacallan
492dfe64dd3Smacallan/***********************************************************************
493dfe64dd3Smacallan#define Volari_SetupRect(w,h) \
494dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
495dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(6), (h)<<16 | (w) );\
496dfe64dd3Smacallan                G2CmdQueLen --;
497dfe64dd3Smacallan***********************************************************************/
498dfe64dd3Smacallan
499dfe64dd3Smacallan#define Volari_SetupRect(w,h) \
500dfe64dd3Smacallan        {\
501dfe64dd3Smacallan        unsigned long ulTemp ;\
502dfe64dd3Smacallan        \
503dfe64dd3Smacallan		if( (w != g_width) || (h != g_height)) \
504dfe64dd3Smacallan		{ \
505dfe64dd3Smacallan			g_width = w; \
506dfe64dd3Smacallan			g_height = h; \
507dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
508dfe64dd3Smacallan        \
509dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
510dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x8218) ;\
511dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
512dfe64dd3Smacallan            (CARD32)BE_SWAP32(((h)<<16)|((w)&0xffff)) ;\
513dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
514dfe64dd3Smacallan        { \
515dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
516dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
517dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
518dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
519dfe64dd3Smacallan            ulTemp += 0x10 ;\
520dfe64dd3Smacallan        } \
521dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
522dfe64dd3Smacallan            ulTemp += 0x08 ;\
523dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
524dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
525dfe64dd3Smacallan		} \
526dfe64dd3Smacallan    }
527dfe64dd3Smacallan
528dfe64dd3Smacallan/***********************************************************************
529dfe64dd3Smacallan#define Volari_SetupPATFG(color) \
530dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
531dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(7), color);\
532dfe64dd3Smacallan                G2CmdQueLen --;
533dfe64dd3Smacallan***********************************************************************/
534dfe64dd3Smacallan/***********************************************************************
535dfe64dd3Smacallan#define Volari_SetupPATBG(color) \
536dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
537dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(8), color);\
538dfe64dd3Smacallan                G2CmdQueLen --;
539dfe64dd3Smacallan***********************************************************************/
540dfe64dd3Smacallan/***********************************************************************
541dfe64dd3Smacallan#define Volari_SetupSRCFG(color) \
542dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
543dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(9), color);\
544dfe64dd3Smacallan                G2CmdQueLen --;
545dfe64dd3Smacallan***********************************************************************/
546dfe64dd3Smacallan/***********************************************************************
547dfe64dd3Smacallan#define Volari_SetupSRCBG(color) \
548dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
549dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(10), color);\
550dfe64dd3Smacallan                G2CmdQueLen --;
551dfe64dd3Smacallan***********************************************************************/
552dfe64dd3Smacallan
553dfe64dd3Smacallan#define Volari_SetupPATFG(color) \
554dfe64dd3Smacallan        {\
555dfe64dd3Smacallan        unsigned long ulTemp ;\
556dfe64dd3Smacallan        \
557dfe64dd3Smacallan		if( color != g_MonoPatFgColor) \
558dfe64dd3Smacallan		{ \
559dfe64dd3Smacallan		g_MonoPatFgColor = color; \
560dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
561dfe64dd3Smacallan        \
562dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
563dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(7)) ;\
564dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
565dfe64dd3Smacallan            (CARD32)BE_SWAP32(color) ;\
566dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
567dfe64dd3Smacallan        { \
568dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
569dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
570dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
571dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
572dfe64dd3Smacallan            ulTemp += 0x10 ;\
573dfe64dd3Smacallan        } \
574dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
575dfe64dd3Smacallan            ulTemp += 0x08 ;\
576dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
577dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
578dfe64dd3Smacallan	Volari_UpdateHwWP(ulTemp) ;\
579dfe64dd3Smacallan		}	\
580dfe64dd3Smacallan        \
581dfe64dd3Smacallan    }
582dfe64dd3Smacallan
583dfe64dd3Smacallan#define Volari_SetupPATBG(color) \
584dfe64dd3Smacallan        {\
585dfe64dd3Smacallan        unsigned long ulTemp ;\
586dfe64dd3Smacallan        \
587dfe64dd3Smacallan		if( color != g_MonoPatBgColor) \
588dfe64dd3Smacallan		{ \
589dfe64dd3Smacallan		g_MonoPatBgColor = color; \
590dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
591dfe64dd3Smacallan        \
592dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
593dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(8)) ;\
594dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
595dfe64dd3Smacallan            (CARD32)BE_SWAP32(color) ;\
596dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
597dfe64dd3Smacallan        { \
598dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
599dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
600dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
601dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
602dfe64dd3Smacallan            ulTemp += 0x10 ;\
603dfe64dd3Smacallan        } \
604dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
605dfe64dd3Smacallan            ulTemp += 0x08 ;\
606dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
607dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
608dfe64dd3Smacallan		}	\
609dfe64dd3Smacallan        \
610dfe64dd3Smacallan    }
611dfe64dd3Smacallan
612dfe64dd3Smacallan#define Volari_SetupSRCFG(color) \
613dfe64dd3Smacallan        {\
614dfe64dd3Smacallan        unsigned long ulTemp ;\
615dfe64dd3Smacallan        \
616dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
617dfe64dd3Smacallan        \
618dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
619dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(9)) ;\
620dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
621dfe64dd3Smacallan            (CARD32)BE_SWAP32(color) ;\
622dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
623dfe64dd3Smacallan        { \
624dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
625dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
626dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
627dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
628dfe64dd3Smacallan            ulTemp += 0x10 ;\
629dfe64dd3Smacallan        } \
630dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
631dfe64dd3Smacallan            ulTemp += 0x08 ;\
632dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
633dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
634dfe64dd3Smacallan        \
635dfe64dd3Smacallan    }
636dfe64dd3Smacallan
637dfe64dd3Smacallan#define Volari_SetupSRCBG(color) \
638dfe64dd3Smacallan        {\
639dfe64dd3Smacallan        unsigned long ulTemp ;\
640dfe64dd3Smacallan        \
641dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
642dfe64dd3Smacallan        \
643dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
644dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(10)) ;\
645dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
646dfe64dd3Smacallan            (CARD32)BE_SWAP32(color) ;\
647dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
648dfe64dd3Smacallan        { \
649dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
650dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
651dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
652dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
653dfe64dd3Smacallan            ulTemp += 0x10 ;\
654dfe64dd3Smacallan        } \
655dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
656dfe64dd3Smacallan            ulTemp += 0x08 ;\
657dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
658dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
659dfe64dd3Smacallan        \
660dfe64dd3Smacallan    }
661dfe64dd3Smacallan
662dfe64dd3Smacallan/***********************************************************************
663dfe64dd3Smacallan#define Volari_SetupMONOPAT(p0,p1) \
664dfe64dd3Smacallan                if (G2CmdQueLen <= 1)  Volari_Idle(pXGI);\
665dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(11), p0);\
666dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(12), p1);\
667dfe64dd3Smacallan                G2CmdQueLen =G2CmdQueLen-2;
668dfe64dd3Smacallan***********************************************************************/
669dfe64dd3Smacallan
670dfe64dd3Smacallan#define Volari_SetupMONOPAT0(p0) \
671dfe64dd3Smacallan        {\
672dfe64dd3Smacallan        unsigned long ulTemp ;\
673dfe64dd3Smacallan        \
674dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
675dfe64dd3Smacallan        \
676dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
677dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x822C) ;\
678dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
679dfe64dd3Smacallan            (CARD32)BE_SWAP32(p0) ;\
680dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
681dfe64dd3Smacallan        { \
682dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
683dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
684dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
685dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
686dfe64dd3Smacallan            ulTemp += 0x10 ;\
687dfe64dd3Smacallan        } \
688dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
689dfe64dd3Smacallan            ulTemp += 0x08 ;\
690dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
691dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
692dfe64dd3Smacallan        \
693dfe64dd3Smacallan    }
694dfe64dd3Smacallan
695dfe64dd3Smacallan#define Volari_SetupMONOPAT1(p1) \
696dfe64dd3Smacallan        {\
697dfe64dd3Smacallan        unsigned long ulTemp ;\
698dfe64dd3Smacallan        \
699dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
700dfe64dd3Smacallan        \
701dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
702dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + 0x8230) ;\
703dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
704dfe64dd3Smacallan            (CARD32)BE_SWAP32(p1) ;\
705dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
706dfe64dd3Smacallan        { \
707dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
708dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
709dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
710dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
711dfe64dd3Smacallan            ulTemp += 0x10 ;\
712dfe64dd3Smacallan        } \
713dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
714dfe64dd3Smacallan            ulTemp += 0x08 ;\
715dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
716dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
717dfe64dd3Smacallan        \
718dfe64dd3Smacallan    }
719dfe64dd3Smacallan/***********************************************************************
720dfe64dd3Smacallan#define Volari_SetupClipLT(left,top) \
721dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
722dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\
723dfe64dd3Smacallan                G2CmdQueLen--;
724dfe64dd3Smacallan***********************************************************************/
725dfe64dd3Smacallan/***********************************************************************
726dfe64dd3Smacallan#define Volari_SetupClipRB(right,bottom) \
727dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
728dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\
729dfe64dd3Smacallan                G2CmdQueLen --;
730dfe64dd3Smacallan***********************************************************************/
731dfe64dd3Smacallan
732dfe64dd3Smacallan#define Volari_SetupClip(left,top,right,bottom) \
733dfe64dd3Smacallan        {\
734dfe64dd3Smacallan        unsigned long ulTemp ;\
735dfe64dd3Smacallan        \
736dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
737dfe64dd3Smacallan        \
738dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
739dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(13)) ;\
740dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
741dfe64dd3Smacallan            (CARD32)BE_SWAP32(((top)<<16)|((left)&0xffff)) ;\
742dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
743dfe64dd3Smacallan        { \
744dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
745dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
746dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
747dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
748dfe64dd3Smacallan            ulTemp += 0x10 ;\
749dfe64dd3Smacallan        } \
750dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
751dfe64dd3Smacallan            ulTemp += 0x08 ;\
752dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
753dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
754dfe64dd3Smacallan        \
755dfe64dd3Smacallan    }
756dfe64dd3Smacallan
757dfe64dd3Smacallan#define Volari_SetupClipLT(left,top) \
758dfe64dd3Smacallan        {\
759dfe64dd3Smacallan        unsigned long ulTemp ;\
760dfe64dd3Smacallan        \
761dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
762dfe64dd3Smacallan        \
763dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
764dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(13)) ;\
765dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
766dfe64dd3Smacallan            (CARD32)BE_SWAP32(((top)<<16)|((left)&0xffff)) ;\
767dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
768dfe64dd3Smacallan        { \
769dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
770dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
771dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
772dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
773dfe64dd3Smacallan            ulTemp += 0x10 ;\
774dfe64dd3Smacallan        } \
775dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
776dfe64dd3Smacallan            ulTemp += 0x08 ;\
777dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
778dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
779dfe64dd3Smacallan        \
780dfe64dd3Smacallan    }
781dfe64dd3Smacallan
782dfe64dd3Smacallan#define Volari_SetupClipRB(right,bottom) \
783dfe64dd3Smacallan    {\
784dfe64dd3Smacallan        unsigned long ulTemp ;\
785dfe64dd3Smacallan        \
786dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
787dfe64dd3Smacallan        \
788dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
789dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(14)) ;\
790dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
791dfe64dd3Smacallan            (CARD32)BE_SWAP32(((right) & 0xFFFF) | ((bottom)<<16))) ;\
792dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
793dfe64dd3Smacallan        { \
794dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
795dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
796dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
797dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
798dfe64dd3Smacallan            ulTemp += 0x10 ;\
799dfe64dd3Smacallan        } \
800dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
801dfe64dd3Smacallan            ulTemp += 0x08 ;\
802dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
803dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
804dfe64dd3Smacallan        \
805dfe64dd3Smacallan    }
806dfe64dd3Smacallan
807dfe64dd3Smacallan/***********************************************************************
808dfe64dd3Smacallan#define Volari_SetupROP(rop) \
809dfe64dd3Smacallan        pXGI->CommandReg = (rop) << 8;
810dfe64dd3Smacallan
811dfe64dd3Smacallan#define Volari_SetupCMDFlag(flags) \
812dfe64dd3Smacallan        pXGI->CommandReg |= (flags);
813dfe64dd3Smacallan
814dfe64dd3Smacallan#define Volari_DoCMD \
815dfe64dd3Smacallan                if (G2CmdQueLen <= 1)  Volari_Idle(pXGI);\
816dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(15), pXGI->CommandReg); \
817dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(16), 0);\
818dfe64dd3Smacallan                G2CmdQueLen =G2CmdQueLen-2;
819dfe64dd3Smacallan***********************************************************************/
820dfe64dd3Smacallan
821dfe64dd3Smacallan/***********************************************************************
822dfe64dd3Smacallan#define Volari_SetupX0Y0(x,y) \
823dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
824dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(2), (y)<<16 | (x) );\
825dfe64dd3Smacallan                G2CmdQueLen --;
826dfe64dd3Smacallan#define Volari_SetupX1Y1(x,y) \
827dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
828dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(3), (y)<<16 | (x) );\
829dfe64dd3Smacallan                G2CmdQueLen --;
830dfe64dd3Smacallan#define Volari_SetupLineCount(c) \
831dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
832dfe64dd3Smacallan                MMIO_OUT16(pXGI->IOBase, BR(6), c);\
833dfe64dd3Smacallan                G2CmdQueLen --;
834dfe64dd3Smacallan#define Volari_SetupStylePeriod(p) \
835dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
836dfe64dd3Smacallan                MMIO_OUT16(pXGI->IOBase, BR(6)+2, p);\
837dfe64dd3Smacallan                G2CmdQueLen --;
838dfe64dd3Smacallan#define Volari_SetupStyleLow(ls) \
839dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
840dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(11), ls);\
841dfe64dd3Smacallan                G2CmdQueLen --;
842dfe64dd3Smacallan#define Volari_SetupStyleHigh(ls) \
843dfe64dd3Smacallan                if (G2CmdQueLen <= 0)  Volari_Idle(pXGI);\
844dfe64dd3Smacallan                MMIO_OUT32(pXGI->IOBase, BR(12), ls);\
845dfe64dd3Smacallan                G2CmdQueLen --;
846dfe64dd3Smacallan***********************************************************************/
847dfe64dd3Smacallan
848dfe64dd3Smacallan
849dfe64dd3Smacallan/***********************************************************************
850dfe64dd3Smacallan * For Line Drawing
851dfe64dd3Smacallan ***********************************************************************/
852dfe64dd3Smacallan
853dfe64dd3Smacallan#define Volari_SetupX0Y0(x,y) \
854dfe64dd3Smacallan        {\
855dfe64dd3Smacallan        unsigned long ulTemp ;\
856dfe64dd3Smacallan        \
857dfe64dd3Smacallan		if((x != g_src_y) || (y != g_src_x)) \
858dfe64dd3Smacallan		{ \
859dfe64dd3Smacallan			g_src_x = y; \
860dfe64dd3Smacallan			g_src_y = x; \
861dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
862dfe64dd3Smacallan        \
863dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
864dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(2)) ;\
865dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
866dfe64dd3Smacallan            (CARD32)BE_SWAP32(((y)<<16) | ((x)&0xFFFF) ) ;\
867dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
868dfe64dd3Smacallan        { \
869dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
870dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
871dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
872dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
873dfe64dd3Smacallan            ulTemp += 0x10 ;\
874dfe64dd3Smacallan        } \
875dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
876dfe64dd3Smacallan            ulTemp += 0x08 ;\
877dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
878dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
879dfe64dd3Smacallan		} \
880dfe64dd3Smacallan    }
881dfe64dd3Smacallan
882dfe64dd3Smacallan#define Volari_SetupX1Y1(x,y) \
883dfe64dd3Smacallan        {\
884dfe64dd3Smacallan        unsigned long ulTemp ;\
885dfe64dd3Smacallan        \
886dfe64dd3Smacallan		if((x != g_dst_y) || (y != g_dst_x)) \
887dfe64dd3Smacallan		{ \
888dfe64dd3Smacallan			g_dst_x = y; \
889dfe64dd3Smacallan			g_dst_y = x; \
890dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
891dfe64dd3Smacallan        \
892dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
893dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(3)) ;\
894dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
895dfe64dd3Smacallan            (CARD32)BE_SWAP32(((y)<<16) | ((x)&0xFFFF) ) ;\
896dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
897dfe64dd3Smacallan        { \
898dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
899dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
900dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
901dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
902dfe64dd3Smacallan            ulTemp += 0x10 ;\
903dfe64dd3Smacallan        } \
904dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
905dfe64dd3Smacallan            ulTemp += 0x08 ;\
906dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
907dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
908dfe64dd3Smacallan		} \
909dfe64dd3Smacallan    }
910dfe64dd3Smacallan
911dfe64dd3Smacallan#define Volari_SetupLineCount(c) \
912dfe64dd3Smacallan    {\
913dfe64dd3Smacallan        unsigned long ulTemp ;\
914dfe64dd3Smacallan        \
915dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
916dfe64dd3Smacallan        \
917dfe64dd3Smacallan		if(c != g_width) \
918dfe64dd3Smacallan		{ \
919dfe64dd3Smacallan			g_width = c; \
920dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
921dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(6) + 0x30000 ) ;\
922dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
923dfe64dd3Smacallan            (CARD32)BE_SWAP32(((c)&0xffff)) ;\
924dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
925dfe64dd3Smacallan        { \
926dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
927dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
928dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
929dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
930dfe64dd3Smacallan            ulTemp += 0x10 ;\
931dfe64dd3Smacallan        } \
932dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
933dfe64dd3Smacallan            ulTemp += 0x08 ;\
934dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
935dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
936dfe64dd3Smacallan		} \
937dfe64dd3Smacallan    }
938dfe64dd3Smacallan
939dfe64dd3Smacallan#define Volari_SetupStylePeriod(p) \
940dfe64dd3Smacallan    {\
941dfe64dd3Smacallan        unsigned long ulTemp ;\
942dfe64dd3Smacallan        \
943dfe64dd3Smacallan		if(p != g_height) \
944dfe64dd3Smacallan		{ \
945dfe64dd3Smacallan			g_height = c; \
946dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
947dfe64dd3Smacallan        \
948dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
949dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(6) + 0xC0000 ) ;\
950dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
951dfe64dd3Smacallan            (CARD32)BE_SWAP32(((p)<<16)) ;\
952dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
953dfe64dd3Smacallan        { \
954dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
955dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
956dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
957dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
958dfe64dd3Smacallan            ulTemp += 0x10 ;\
959dfe64dd3Smacallan        } \
960dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
961dfe64dd3Smacallan            ulTemp += 0x08 ;\
962dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
963dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
964dfe64dd3Smacallan		} \
965dfe64dd3Smacallan    }
966dfe64dd3Smacallan
967dfe64dd3Smacallan#define Volari_SetupStylePeriodCount(p,c) \
968dfe64dd3Smacallan        {\
969dfe64dd3Smacallan        unsigned long ulTemp ;\
970dfe64dd3Smacallan        \
971dfe64dd3Smacallan		if((c != g_width) || (p != g_height)) \
972dfe64dd3Smacallan		{ \
973dfe64dd3Smacallan			g_width = c; \
974dfe64dd3Smacallan			g_height = p; \
975dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
976dfe64dd3Smacallan        \
977dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
978dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(6)) ;\
979dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
980dfe64dd3Smacallan            (CARD32)BE_SWAP32(((p)<<16)|((c)&0xffff)) ;\
981dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
982dfe64dd3Smacallan        { \
983dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
984dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
985dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
986dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
987dfe64dd3Smacallan            ulTemp += 0x10 ;\
988dfe64dd3Smacallan        } \
989dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
990dfe64dd3Smacallan            ulTemp += 0x08 ;\
991dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
992dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
993dfe64dd3Smacallan		} \
994dfe64dd3Smacallan    }
995dfe64dd3Smacallan
996dfe64dd3Smacallan#define Volari_SetupStyle(ls,hs) \
997dfe64dd3Smacallan    {\
998dfe64dd3Smacallan        unsigned long ulTemp ;\
999dfe64dd3Smacallan        \
1000dfe64dd3Smacallan        ulTemp = Volari_GetSwWP() ;\
1001dfe64dd3Smacallan        \
1002dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp) = \
1003dfe64dd3Smacallan            (CARD32)BE_SWAP32(GR_SKPC_HEADER + BR(11)) ;\
1004dfe64dd3Smacallan        *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+4) =\
1005dfe64dd3Smacallan            (CARD32)BE_SWAP32(ls) ;\
1006dfe64dd3Smacallan        if( pXGI->Chipset == PCI_CHIP_XGIXG40 ) \
1007dfe64dd3Smacallan        { \
1008dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+8) = \
1009dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
1010dfe64dd3Smacallan            *(CARD32 *)(pXGI->cmdQueueBase+ulTemp+12) = \
1011dfe64dd3Smacallan                (CARD32)BE_SWAP32(GR_NIL_CMD) ;\
1012dfe64dd3Smacallan            ulTemp += 0x10 ;\
1013dfe64dd3Smacallan        } \
1014dfe64dd3Smacallan        else if(( pXGI->Chipset == PCI_CHIP_XGIXG20 )||( pXGI->Chipset == PCI_CHIP_XGIXG21 )||( pXGI->Chipset == PCI_CHIP_XGIXG27 )) \
1015dfe64dd3Smacallan            ulTemp += 0x08 ;\
1016dfe64dd3Smacallan        ulTemp &= pXGI->cmdQueueSizeMask ;\
1017dfe64dd3Smacallan        Volari_UpdateSwWP(ulTemp) ;\
1018dfe64dd3Smacallan        \
1019dfe64dd3Smacallan    }
1020dfe64dd3Smacallan
1021dfe64dd3Smacallan#endif /* _XGI_315_ACCEL_H_ */
1022dfe64dd3Smacallan
1023