2 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
3 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sub license,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * VIA, S3 GRAPHICS, AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
28 /***********************
30 ************************/
33 AMO_BurstCmdData= 0x01010000,
34 AMO_3DReg= 0x01048500,
35 AMO_MotionCompReg= 0x01048900,
36 AMO_VideoEngUnit= 0x01048A00,
37 AMO_CmdBufAddr= 0x01048c14,
38 AMO_TiledSurfReg0= 0x01048C40,
39 AMO_TiledSurfReg1= 0x01048C44,
40 AMO_TiledSurfReg2= 0x01048C48,
41 AMO_TiledSurfReg3= 0x01048C4C,
42 AMO_TiledSurfReg4= 0x01048C50,
43 AMO_TiledSurfReg5= 0x01048C54,
44 AMO_TiledSurfReg6= 0x01048C58,
45 AMO_TiledSurfReg7= 0x01048C5C,
46 AMO_LPBModeReg= 0x0100FF00,
47 AMO_LPBFifoSat= 0x0100FF04,
48 AMO_LPBIntFlag= 0x0100FF08,
49 AMO_LPBFmBufA0= 0x0100FF0C,
50 AMO_LPBFmBufA1= 0x0100FF10,
51 AMO_LPBRdWtAdr= 0x0100FF14,
52 AMO_LPBRdWtDat= 0x0100FF18,
53 AMO_LPBIOPort = 0x0100FF1C,
54 AMO_LPBSerPort= 0x0100FF20,
55 AMO_LPBVidInWinSz= 0x0100FF24,
56 AMO_LPBVidDatOffs= 0x0100FF28,
57 AMO_LPBHorScalCtrl= 0x0100FF2C,
58 AMO_LPBVerDeciCtrl= 0x0100FF30,
59 AMO_LPBLnStride= 0x0100FF34,
60 AMO_LPBFmBufAddr2= 0x0100FF38,
61 AMO_LPBVidCapVDCtrl=0x0100FF3C,
63 AMO_LPBVidCapFdStAd=0x0100FF60,
64 AMO_LPBVidCapFdMdAd=0x0100FF64,
65 AMO_LPBVidCapFdBtAd=0x0100FF68,
66 AMO_LPBVidCapFdSize=0x0100FF6C,
67 AMO_LPBBilinDecim1= 0x0100FF70,
68 AMO_LPBBilinDecim2= 0x0100FF74,
69 AMO_LPBBilinDecim3= 0x0100FF78,
70 AMO_LPBDspVEUHorSRR=0x0100FF7C,
71 AMO_LPBDspVEUVerSRR=0x0100FF80,
72 AMO_LPBDspVeuDnScDR=0x0100FF84,
73 AMO_LPB_VEUERPReg= 0x0100FF88,
74 AMO_LPB_VBISelReg= 0x0100FF8C,
75 AMO_LPB_VBIBasAdReg=0x0100FF90,
76 AMO_LPB_DatOffsReg= 0x0100FF94,
77 AMO_LPB_VBIVerDcReg=0x0100FF98,
78 AMO_LPB_VBICtrlReg= 0x0100FF9C,
79 AMO_LPB_VIPXferCtrl=0x0100FFA0,
80 AMO_LPB_FIFOWtMark= 0x0100FFA4,
81 AMO_LPB_FIFOCount= 0x0100FFA8,
82 AMO_LPBFdSkipPat= 0x0100FFAC,
83 AMO_LPBCapVEUHorSRR=0x0100FFB0,
84 AMO_LPBCapVEUVerSRR=0x0100FFB4,
85 AMO_LPBCapVeuDnScDR=0x0100FFB8
92 CMD_DrawPrim=0x10, /*10000*/
93 CMD_DrawIdxPrim=0x11, /*10001*/
94 CMD_SetRegister=0x12, /*10010*/
95 CMD_UpdateShadowStat=0x13 , /*10011*/
96 CMD_PageFlip=0x14, /* 10100*/
97 CMD_BusMasterImgXfer=0x15, /* 10101*/
98 CMD_ScaledImgXfer=0x16, /* 10110*/
99 CMD_Macroblock=0x17, /*10111*/
100 CMD_Wait= 0x18, /*11000*/
101 CMD_2D_NOP=0x08, /* 01000*/
102 CMD_2D_RCT=0x09, /*01001 rectangular fill*/
103 CMD_2D_SCNL=0x0a, /* 01010 scan line*/
104 CMD_2D_LIN=0x0b, /*01011 line*/
105 CMD_2D_SMTXT=0x0c, /*01100*/
106 CMD_2D_BPTXT=0x0d, /*01101*/
107 CMD_InitFlag=0x1f /*11111, for S/W initialization control*/
118 /***********************
120 ************************/
128 /*************************
129 Z Buffer / Alpha test
130 *************************/
141 }ZCmpFunc; /* same for Alpha test and Stencil test compare function */
143 typedef ZCmpFunc ACmpFunc;
146 ZDS_16i, /* .16 fixed*/
147 ZDS_32f /* 1.8.15 float*/
151 /**********************************
152 BCI Register Addressing Index
153 ***********************************/
159 CRI_VTX0_DIFFU= 0x03,
160 CRI_VTX0_SPECU= 0x04,
168 CRI_VTX1_DIFFU= 0x0c,
169 CRI_VTX1_SPECU= 0x0d,
177 CRI_VTX2_DIFFU= 0x15,
178 CRI_VTX2_SPECU= 0x16,
184 CRI_ZPixelOffset = 0x1d,
185 CRI_DrawCtrlLocal = 0x1e,
186 CRI_TexPalAddr = 0x1f,
191 CRI_TexBlendCtrl0 = 0x24,
192 CRI_TexBlendCtrl1 = 0x25,
193 CRI_TexXprClr = 0x26,
196 CRI_FogTable00= 0x28,
197 CRI_FogTable04= 0x29,
198 CRI_FogTable08= 0x2a,
199 CRI_FogTable12= 0x2b,
200 CRI_FogTable16= 0x2c,
201 CRI_FogTable20= 0x2d,
202 CRI_FogTable24= 0x2e,
203 CRI_FogTable28= 0x2f,
205 CRI_StencilCtrl= 0x31,
207 CRI_ZBufOffset= 0x33,
209 CRI_DrawCtrlGlobal0= 0x35,
210 CRI_DrawCtrlGlobal1= 0x36,
213 CRI_TexBlendColor= 0x39,
215 CRI_VertBufAddr= 0x3e,
217 CRI_MauFrameAddr0 = 0x40,
218 CRI_MauFrameAddr1 = 0x41,
219 CRI_MauFrameAddr2 = 0x42,
220 CRI_MauFrameAddr3 = 0x43,
221 CRI_FrameDesc = 0x44,
222 CRI_IDCT9bitEn = 0x45,
227 CRI_MacroDescr = 0x4a, /*kickoff?*/
232 CRI_FmtrSrcDimen = 0x53,
233 CRI_FmtrDestDimen = 0x54,
234 CRI_SrcCbAddr = 0x55,
235 CRI_SrcCrAddr = 0x56,
236 CRI_SrcCrCbStride = 0x57,
241 CRI_SSClrKeyCtrl=0xA1,
243 CRI_SSChromUpBound=0xA5,
244 CRI_SSHoriScaleCtrl=0xA6,
246 CRI_SSBlendCtrl=0xA8,
250 CRI_DB_LPB_Support=0xB3,
254 CRI_SSOpaqueCtrl=0xB7,
255 CRI_SSVertScaleCtrl=0xB8,
256 CRI_SSVertInitValue=0xB9,
257 CRI_SSSrcLineCnt=0xBA,
258 CRI_FIFO_RAS_Ctrl=0xBB,
259 CRI_PSWinStartCoord=0xBC,
261 CRI_SSWinStartCoord=0xBE,
270 /* 2D register starts at D0*/
272 CRI_DstXYorStep=0xD1 ,
274 CRI_DrawCmd=0xD3, /*kick off for image xfer*/
275 CRI_ShortStrkVecXfer=0xD4,
278 CRI_BitPlaneWtMask=0xD7,
279 CRI_BitPlaneRdMask=0xD8,
281 CRI_BackAndForeMix=0xDA ,
282 CRI_TopLeftSciss=0xDB ,
283 CRI_BotRightSciss=0xDC ,
284 CRI_PixOrMultiCtrl=0xDD ,
285 CRI_MultiCtrlOrRdSelct=0xDE ,
286 CRI_MinorOrMajorAxisCnt=0xDF ,
287 CRI_GlobalBmpDesc1=0xE0 ,
288 CRI_GlobalBmpDesc2=0xE1 ,
289 CRI_BurstPriBmpDesc1=0xE2 ,
290 CRI_BurstPriBmpDesc2=0xE3 ,
291 CRI_BurstSecBmpDesc1=0xE4 ,
292 CRI_BurstSecBmpDesc2=0xE5,
293 CRI_ImageDataPort=0xF8
297 /***********************
299 ************************/
306 /***********************
308 ************************/
326 TFT_S3TC4A4Bit, /*like S3TC4Bit but with 4 bit alpha*/
327 TFT_S3TC4CA4Bit, /*like S3TC4Bit, but with 4 bit compressed alpha*/
344 #define MAX_MIPMAP_LOD_BIAS 255
345 #define MIN_MIPMAP_LOD_BIAS -255
352 TFM_Trilin /*16 TPP*/
356 #define TBC_Decal 0x00850410
357 #define TBC_Modul 0x00850011
358 #define TBC_DecalAlpha 0x00852A04
359 #define TBC_ModulAlpha 0x00110011
360 #define TBC_Copy 0x00840410
361 #define TBC_CopyAlpha 0x00900405
362 #define TBC_NoTexMap 0x00850405
363 #define TBC_Blend0 0x00810004
364 #define TBC_Blend1 0x00870e02
365 #define TBC_BlendAlpha0 0x00040004
366 #define TBC_BlendAlpha1 TBC_Blend1
367 #define TBC_BlendInt0 0x00040004
368 #define TBC_BlendInt1 0x01c20e02
369 #define TBC_AddAlpha 0x19910c11
370 #define TBC_Add 0x18110c11
372 #define TBC_Decal1 0x00870410
373 #define TBC_Modul1 0x00870013
374 #define TBC_DecalAlpha1 0x00832A00
375 #define TBC_ModulAlpha1 0x00130013
376 #define TBC_NoTexMap1 0x00870407
377 #define TBC_Copy1 0x00870400
378 #define TBC_CopyAlpha1 0x00900400
379 #define TBC_AddAlpha1 0x19930c13
380 #define TBC_Add1 0x18130c13
383 * derived from TexBlendCtrl
394 /***********************
396 ************************/
403 } BackfaceCullingMode;
446 /***************************************************************
447 *** Bitfield Structures for Programming Interface **************
448 ***************************************************************/
450 /**************************
452 **************************/
454 typedef struct { /*for DrawIndexPrimitive command, vert0Idx is meaningful.*/
455 unsigned int vert0Idx:16;
456 unsigned int vertCnt:8;
458 unsigned int type:2; /*00=list, 01=strip, 10=fan, 11=reserved*/
460 }Reg_DrawIndexPrimitive;
462 typedef struct { /*for DrawIndexPrimitive command, vert0Idx is meaningful.*/
471 unsigned int reserved:9;
472 unsigned int vertCnt:8;
474 unsigned int type:2; /* 00=list, 01=strip, 10=fan, 11=reserved*/
480 unsigned int startRegIdx:8;
481 unsigned int reserved:8;
482 unsigned int regCnt:8;
483 unsigned int resvered1:1;
484 unsigned int lowEn:1;
485 unsigned int highEn:1;
490 unsigned int reserved1:22;
491 unsigned int isPrimary:1;
492 unsigned int MIU_SYNC:1;
493 unsigned int reserved2:3;
498 unsigned int reserved1:22;
500 unsigned int CTG:1; /*set to 0*/
502 unsigned int reserved2:1;
507 unsigned int PD:4; /*PM=mono, PS=descriptor specified*/
512 unsigned int DC:2; /*DC=destination clip*/
513 unsigned int CS:1; /*cs=color specified*/
522 unsigned int CodedBlkPattern:6;
523 unsigned int DCT_Type:1;
524 unsigned int MB_Type:2;
525 unsigned int MotionType:2;
526 unsigned int MB_Row:6;
527 unsigned int MB_Column:6;
536 unsigned int scanLnCnt:11;
537 unsigned int clkCnt:5;
542 unsigned int meuMit:1;
543 unsigned int meuSit:1;
544 unsigned int meuVx:1;
545 unsigned int meuMau:1;
546 unsigned int pageFlip:1;
547 unsigned int scanLn:1;
553 unsigned int reserved:27;
558 unsigned int eventTag:16;
559 unsigned int reserved2:6;
562 unsigned int reserved1:3;
567 Reg_DrawPrimitive vert;
568 Reg_DrawIndexPrimitive vertIdx;
570 Reg_QueuedPageFlip pageFlip;
571 Reg_MasterImgXfer masterImgXfer;
572 Reg_ScaledImgXfer scaledImgXfer;
573 Reg_UpdtShadowStat updtShadow;
574 Reg_MacroBlock macroBlk;
580 /*frank 2001/11/14 add BCI write macros*/
581 /* Registers not used in the X server
584 #define SAVAGE_NOP_ID 0x2094
585 #define SAVAGE_NOP_ID_MASK ((1<<22)-1)
591 /* Draw Primitive Control */
594 #define SAVAGE_HW_NO_Z (1<<0)
595 #define SAVAGE_HW_NO_W (1<<1)
596 #define SAVAGE_HW_NO_CD (1<<2)
597 #define SAVAGE_HW_NO_CS (1<<3)
598 #define SAVAGE_HW_NO_U0 (1<<4)
599 #define SAVAGE_HW_NO_V0 (1<<5)
600 #define SAVAGE_HW_NO_UV0 ((1<<4) | (1<<5))
601 #define SAVAGE_HW_NO_U1 (1<<6)
602 #define SAVAGE_HW_NO_V1 (1<<7)
603 #define SAVAGE_HW_NO_UV1 ((1<<6) | (1<<7))
604 #define SAVAGE_HW_SKIPFLAGS 0x000000ff