PageRenderTime 40ms CodeModel.GetById 20ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 1ms

/src/xgi_accel.h

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