2 * Copyright © 2003 Eric Anholt
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Eric Anholt not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Eric Anholt makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 /* Many of the Radeon and Rage 128 registers are the same.
24 * ATI_ should denote registers and values that are common for R128 and Radeon.
26 * The information in this file comes from many sources, including the Rage 128
27 * DDK, Rage 128 register reference, the XFree86 and kernel Rage 128 and Radeon
28 * register definition headers, and bits from the Radeon DDK and RV200 register
29 * specs supplied by others.
32 #define ATI_REG_CLOCK_CNTL_INDEX 0x0008
33 # define ATI_PLL_WR_EN (1 << 7)
34 # define ATI_PLL_DIV_SEL (3 << 8)
36 #define ATI_REG_CLOCK_CNTL_DATA 0x000c
38 #define ATI_REG_BUS_CNTL 0x0030
39 # define ATI_BUS_MASTER_DIS (1 << 6)
41 #define ATI_REG_GEN_INT_CNTL 0x0040
43 #define ATI_REG_GEN_CNTL 0x0050
44 # define ATI_CRTC_DBL_SCAN_EN (1 << 0) /* 0x00000001 */
45 # define ATI_CRTC_INTERLACE_EN (1 << 1) /* 0x00000002 */
46 # define ATI_CRTC_CSYNC_EN (1 << 4) /* 0x00000010 */
47 # define ATI_CRTC_PIX_WIDTH_MASK (7 << 8) /* 0x00000700 */
48 # define ATI_CRTC_CUR_EN (1 << 16) /* 0x00010000 */
49 # define ATI_CRTC_CUR_MODE_MASK (7 << 17) /* 0x000e0000 */
50 # define ATI_CRTC_ICON_EN (1 << 20) /* 0x00100000 */
51 # define ATI_CRTC_ARGB_EN (2 << 20) /* 0x00200000 */
52 # define ATI_CRTC_EXT_DISP_EN (1 << 24) /* 0x01000000 */
53 # define ATI_CRTC_EN (1 << 25) /* 0x02000000 */
54 # define ATI_CRTC_DISP_REQ_EN_B (1 << 26) /* 0x04000000 */
56 #define ATI_REG_CRTC_EXT_CNTL 0x0054
57 # define ATI_CRTC_EN (1 << 25)
58 # define ATI_CRTC_VGA_XOVERSCAN (1 << 0)
59 # define ATI_VGA_ATI_LINEAR (1 << 3)
60 # define ATI_XCRT_CNT_EN (1 << 6)
61 # define ATI_CRTC_HSYNC_DIS (1 << 8)
62 # define ATI_CRTC_VSYNC_DIS (1 << 9)
63 # define ATI_CRTC_DISPLAY_DIS (1 << 10)
64 # define RADEON_CRTC_SYNC_TRISTAT (1 << 11)
65 # define ATI_CRTC_CRT_ON (1 << 15)
66 # define R128_FP_OUT_EN (1 << 22)
67 # define R128_FP_ACTIVE (1 << 23)
69 #define ATI_REG_DAC_CNTL 0x0058
70 # define ATI_DAC_RANGE_CNTL (3 << 0)
71 # define ATI_DAC_BLANKING (1 << 2)
72 # define R128_DAC_CRT_SEL_CRTC2 (1 << 4)
73 # define ATI_DAC_CMP_EN (1 << 3)
74 # define R128_DAC_PALETTE_ACC_CTL (1 << 5)
75 # define ATI_DAC_CMP_OUTPUT (1 << 7)
76 # define ATI_DAC_8BIT_EN (1 << 8)
77 # define ATI_DAC_VGA_ADR_EN (1 << 13)
78 # define ATI_DAC_PDWN (1 << 15)
79 # define ATI_DAC_MASK_ALL (0xff << 24)
81 #define ATI_REG_I2C_CNTL_1 0x0094
83 #define R128_REG_GEN_RESET_CNTL 0x00f0
84 # define R128_SOFT_RESET_GUI (1 << 0)
85 # define R128_SOFT_RESET_VCLK (1 << 8)
86 # define R128_SOFT_RESET_PCLK (1 << 9)
87 # define R128_SOFT_RESET_DISPENG_XCLK (1 << 11)
88 # define R128_SOFT_RESET_MEMCTLR_XCLK (1 << 12)
90 #define RADEON_REG_RBBM_SOFT_RESET 0x00f0
91 # define RADEON_SOFT_RESET_CP (1 << 0)
92 # define RADEON_SOFT_RESET_HI (1 << 1)
93 # define RADEON_SOFT_RESET_SE (1 << 2)
94 # define RADEON_SOFT_RESET_RE (1 << 3)
95 # define RADEON_SOFT_RESET_PP (1 << 4)
96 # define RADEON_SOFT_RESET_E2 (1 << 5)
97 # define RADEON_SOFT_RESET_RB (1 << 6)
98 # define RADEON_SOFT_RESET_HDP (1 << 7)
100 #define RADEON_REG_HOST_PATH_CNTL 0x0130
101 # define RADEON_HDP_SOFT_RESET (1 << 26)
103 #define ATI_REG_AGP_BASE 0x0170
105 #define ATI_REG_AGP_CNTL 0x0174
106 # define R128_AGP_APER_SIZE_256MB (0x00 << 0)
107 # define R128_AGP_APER_SIZE_128MB (0x20 << 0)
108 # define R128_AGP_APER_SIZE_64MB (0x30 << 0)
109 # define R128_AGP_APER_SIZE_32MB (0x38 << 0)
110 # define R128_AGP_APER_SIZE_16MB (0x3c << 0)
111 # define R128_AGP_APER_SIZE_8MB (0x3e << 0)
112 # define R128_AGP_APER_SIZE_4MB (0x3f << 0)
113 # define R128_AGP_APER_SIZE_MASK (0x3f << 0)
114 # define RADEON_PENDING_SLOTS_VAL 0x00060000
115 # define RADEON_PENDING_SLOTS_SEL 0x00080000
117 #define R128_REG_PCI_GART_PAGE 0x017c
119 #define R128_REG_PC_NGUI_CTLSTAT 0x0184
120 # define R128_PC_FLUSH_GUI (3 << 0)
121 # define R128_PC_RI_GUI (1 << 2)
122 # define R128_PC_FLUSH_ALL 0x00ff
123 # define R128_PC_BUSY (1 << 31)
125 #define R128_REG_VIPH_CONTROL 0x01d0
127 #define ATI_REG_CRTC_H_TOTAL_DISP 0x0200
128 #define ATI_REG_CRTC2_H_TOTAL_DISP 0x0300
129 # define ATI_CRTC_H_TOTAL (0x01ff << 0)
130 # define ATI_CRTC_H_TOTAL_SHIFT 0
131 # define ATI_CRTC_H_DISP (0x00ff << 16)
132 # define ATI_CRTC_H_DISP_SHIFT 16
134 #define ATI_REG_CRTC_H_SYNC_STRT_WID 0x0204
135 #define ATI_REG_CRTC2_H_SYNC_STRT_WID 0x0304
136 # define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0)
137 # define RADEON_CRTC_H_SYNC_STRT_CHAR (0x3ff << 3)
138 # define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3
139 # define RADEON_CRTC_H_SYNC_WID (0x3f << 16)
140 # define RADEON_CRTC_H_SYNC_WID_SHIFT 16
141 # define RADEON_CRTC_H_SYNC_POL (1 << 23)
143 #define ATI_REG_CRTC_OFFSET 0x0224
144 #define ATI_REG_CRTC2_OFFSET 0x0324
145 #define ATI_REG_CRTC_OFFSET_CNTL 0x0228
146 #define ATI_REG_CRTC2_OFFSET_CNTL 0x0328
147 #define ATI_REG_CRTC_PITCH 0x022c
148 #define ATI_REG_CRTC2_PITCH 0x032c
150 #define ATI_REG_OVR_CLR 0x0230
151 #define ATI_REG_OVR_WID_LEFT_RIGHT 0x0234
152 #define ATI_REG_OVR_WID_TOP_BOTTOM 0x0238
154 #define ATI_REG_CUR_OFFSET 0x0260
155 #define ATI_REG_CUR_HORZ_VERT_POSN 0x0264
156 #define ATI_REG_CUR_HORZ_VERT_OFF 0x0268
157 # define ATI_CUR_LOCK (1 << 31)
158 # define ATI_CURSOR_WIDTH 64
159 # define ATI_CURSOR_HEIGHT 64
160 # define ATI_CURSOR_PITCH 16
162 #define ATI_REG_CUR_CLR0 0x026c
163 #define ATI_REG_CUR_CLR1 0x0270
164 #define ATI_REG_OV0_SCALE_CNTL 0x0420
165 #define ATI_REG_SUBPIC_CNTL 0x0540
166 #define ATI_REG_CAP0_TRIG_CNTL 0x0950
167 #define RADEON_REG_VIPH_CONTROL 0x0c50
169 #define RADEON_REG_RBBM_STATUS 0x0e40
170 # define RADEON_RBBM_FIFOCNT_MASK 0x007f
171 # define RADEON_RBBM_ACTIVE (1 << 31)
173 #define ATI_REG_CCE_RB_BASE 0x0700
175 #define R128_REG_PM4_BUFFER_CNTL 0x0704
176 # define R128_PM4_IN_FRAME_BUFFER (1 << 26)
177 # define R128_PM4_BUFFER_CNTL_NOUPDATE (1 << 27)
178 # define R128_PM4_NONPM4 (0 << 28)
179 # define R128_PM4_192PIO (1 << 28)
180 # define R128_PM4_192BM (2 << 28)
181 # define R128_PM4_128PIO_64INDBM (3 << 28)
182 # define R128_PM4_128BM_64INDBM (4 << 28)
183 # define R128_PM4_64PIO_128INDBM (5 << 28)
184 # define R128_PM4_64BM_128INDBM (6 << 28)
185 # define R128_PM4_64PIO_64VCBM_64INDBM (7 << 28)
186 # define R128_PM4_64BM_64VCBM_64INDBM (8 << 28)
187 # define R128_PM4_64PIO_64VCPIO_64INDPIO (15 << 28)
189 #define RADEON_REG_CP_RB_CNTL 0x0704
191 #define R128_REG_PM4_BUFFER_WM_CNTL 0x0708
192 # define R128_WMA_SHIFT 0
193 # define R128_WMB_SHIFT 8
194 # define R128_WMC_SHIFT 16
195 # define R128_WB_WM_SHIFT 24
197 #define ATI_REG_CCE_RPTR_ADDR 0x070c
198 #define ATI_REG_CCE_RPTR 0x0710
199 #define ATI_REG_CCE_WPTR 0x0714
200 # define R128_PM4_BUFFER_DL_DONE (1 << 31)
202 #define R128_REG_PM4_VC_FPU_SETUP 0x071c
203 # define R128_FRONT_DIR_CW (0 << 0)
204 # define R128_FRONT_DIR_CCW (1 << 0)
205 # define R128_FRONT_DIR_MASK (1 << 0)
206 # define R128_BACKFACE_CULL (0 << 1)
207 # define R128_BACKFACE_POINTS (1 << 1)
208 # define R128_BACKFACE_LINES (2 << 1)
209 # define R128_BACKFACE_SOLID (3 << 1)
210 # define R128_BACKFACE_MASK (3 << 1)
211 # define R128_FRONTFACE_CULL (0 << 3)
212 # define R128_FRONTFACE_POINTS (1 << 3)
213 # define R128_FRONTFACE_LINES (2 << 3)
214 # define R128_FRONTFACE_SOLID (3 << 3)
215 # define R128_FRONTFACE_MASK (3 << 3)
216 # define R128_FPU_COLOR_SOLID (0 << 5)
217 # define R128_FPU_COLOR_FLAT (1 << 5)
218 # define R128_FPU_COLOR_GOURAUD (2 << 5)
219 # define R128_FPU_COLOR_GOURAUD2 (3 << 5)
220 # define R128_FPU_COLOR_MASK (3 << 5)
221 # define R128_FPU_SUB_PIX_2BITS (0 << 7)
222 # define R128_FPU_SUB_PIX_4BITS (1 << 7)
223 # define R128_FPU_MODE_2D (0 << 8)
224 # define R128_FPU_MODE_3D (1 << 8)
225 # define R128_TRAP_BITS_DISABLE (1 << 9)
226 # define R128_EDGE_ANTIALIAS (1 << 10)
227 # define R128_SUPERSAMPLE (1 << 11)
228 # define R128_XFACTOR_2 (0 << 12)
229 # define R128_XFACTOR_4 (1 << 12)
230 # define R128_YFACTOR_2 (0 << 13)
231 # define R128_YFACTOR_4 (1 << 13)
232 # define R128_FLAT_SHADE_VERTEX_D3D (0 << 14)
233 # define R128_FLAT_SHADE_VERTEX_OGL (1 << 14)
234 # define R128_FPU_ROUND_TRUNCATE (0 << 15)
235 # define R128_FPU_ROUND_NEAREST (1 << 15)
236 # define R128_WM_SEL_8DW (0 << 16)
237 # define R128_WM_SEL_16DW (1 << 16)
238 # define R128_WM_SEL_32DW (2 << 16)
240 #define R128_REG_PM4_IW_INDOFF 0x0738
241 #define R128_REG_PM4_IW_INDSIZE 0x073c
243 #define RADEON_REG_CP_CSQ_CNTL 0x0740
244 # define RADEON_CSQ_CNT_PRIMARY_MASK 0x000000ff
245 # define RADEON_CSQ_CNT_INDIRECT_MASK 0x0000ff00
246 # define R200_CSQ_CNT_PRIMARY_MASK 0x000001ff
247 # define R200_CSQ_CNT_INDIRECT_MASK 0x0003fe00
248 # define RADEON_CSQ_PRIDIS_INDDIS (0 << 28)
249 # define RADEON_CSQ_PRIPIO_INDDIS (1 << 28)
250 # define RADEON_CSQ_PRIBM_INDDIS (2 << 28)
251 # define RADEON_CSQ_PRIPIO_INDBM (3 << 28)
252 # define RADEON_CSQ_PRIBM_INDBM (4 << 28)
253 # define RADEON_CSQ_PRIPIO_INDPIO (15 << 28)
255 #define R128_REG_PM4_STAT 0x07b8
256 # define R128_PM4_FIFOCNT_MASK 0x00000fff
257 # define R128_PM4_BUSY (1 << 16)
258 # define R128_PM4_GUI_ACTIVE (1 << 31)
260 #define RADEON_REG_CP_STAT 0x07c0
261 # define RADEON_CSQ_PRIMARY_BUSY (1 << 10)
262 # define RADEON_CSQ_INDIRECT_BUSY (1 << 11)
264 #define RADEON_REG_ME_CNTL 0x07d0
265 # define RADEON_ME_MODE_FREE_RUN (1 << 30)
267 #define ATI_REG_MICROCODE_RAM_ADDR 0x07d4
268 #define ATI_REG_MICROCODE_RAM_RADDR 0x07d8
269 #define ATI_REG_MICROCODE_RAM_DATAH 0x07dc
270 #define ATI_REG_MICROCODE_RAM_DATAL 0x07e0
271 #define R128_REG_PM4_BUFFER_ADDR 0x07f0
273 #define RADEON_REG_CP_CSQ_STAT 0x07f8
274 # define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0)
275 # define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8)
276 # define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16)
277 # define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24)
278 # define R200_CSQ_RPTR_PRIMARY_MASK (0x1ff << 0)
279 # define R200_CSQ_WPTR_PRIMARY_MASK (0x1ff << 9)
281 #define R128_REG_PM4_MICRO_CNTL 0x07fc
282 # define R128_PM4_MICRO_FREERUN (1 << 30)
284 #define RADEON_TV_MASTER_CNTL 0x0800
285 # define RADEON_TV_MACROVISION (1 << 5)
286 # define RADEON_TVCLK_ALWAYS_ON (1 << 30)
288 #define R128_REG_BM_CHUNK_0_VAL 0x0a18
289 # define R128_BM_PTR_FORCE_TO_PCI (1 << 21)
290 # define R128_BM_PM4_RD_FORCE_TO_PCI (1 << 22)
291 # define R128_BM_GLOBAL_FORCE_TO_PCI (1 << 23)
293 /* Offset of the PCI config space mirror */
294 #define ATI_PCI_CFG_OFFSET 0x0f00
296 #define ATI_REG_PCI_CFG_STATUS 0x0f06
297 # define ATI_CAP_LIST 0x0010
299 #define ATI_REG_PCI_CFG_CAPABILITIES_PTR 0x0f34
300 # define ATI_CAP_PTR_MASK 0x00fc
301 # define ATI_CAP_ID_NULL 0x0000 /* End of capability list */
302 # define ATI_CAP_ID_AGP 0x0002 /* AGP capability ID */
304 #define R128_REG_AGP_STATUS 0x0f54 /* PCI */
305 # define R128_AGP_1X_MODE 0x01
306 # define R128_AGP_2X_MODE 0x02
307 # define R128_AGP_4X_MODE 0x04
308 # define R128_AGP_MODE_MASK 0x07
310 #define R128_REG_AGP_COMMAND 0x0f58
311 # define R128_AGP_ENABLE (1 << 8)
313 #define RADEON_REG_AGP_STATUS 0x0f5c /* PCI */
314 # define RADEON_AGP_1X_MODE 0x01
315 # define RADEON_AGP_2X_MODE 0x02
316 # define RADEON_AGP_4X_MODE 0x04
317 # define RADEON_AGP_FW_MODE 0x10
318 # define RADEON_AGP_MODE_MASK 0x17
320 #define RADEON_REG_AGP_COMMAND 0x0f60
321 # define RADEON_AGP_ENABLE (1 << 8)
323 #define R128_REG_PM4_FIFO_DATA_EVEN 0x1000
324 #define R128_REG_PM4_FIFO_DATA_ODD 0x1004
326 #define RADEON_REG_CSQ_APER_PRIMARY 0x1000
327 #define RADEON_REG_CSQ_APER_PRIMARY_END 0x11fc
328 #define RADEON_REG_CSQ_APER_INDIRECT 0x1300
329 #define RADEON_REG_CSQ_APER_INDIRECT_END 0x13fc
330 #define ATI_REG_SRC_PITCH_OFFSET 0x1428
331 #define ATI_REG_DST_PITCH_OFFSET 0x142c
332 #define ATI_REG_SRC_Y_X 0x1434
333 #define ATI_REG_DST_Y_X 0x1438
334 #define ATI_REG_DST_HEIGHT_WIDTH 0x143c
336 #define ATI_REG_DP_GUI_MASTER_CNTL 0x146c
337 # define ATI_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
338 # define ATI_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
339 # define ATI_GMC_SRC_CLIPPING (1 << 2)
340 # define ATI_GMC_DST_CLIPPING (1 << 3)
341 # define ATI_GMC_BRUSH_SOLID_COLOR (13 << 4)
342 # define ATI_GMC_BRUSH_NONE (15 << 4)
343 # define ATI_GMC_BRUSH_MASK (15 << 4)
344 # define ATI_GMC_DST_DATATYPE_MASK (0xf << 8)
345 # define ATI_GMC_SRC_DATATYPE_COLOR (3 << 12)
346 # define R128_GMC_CONVERSION_TEMP (1 << 15)
347 # define R128_GMC_CONVERSION_TEMP_6500 (0 << 15)
348 # define R128_GMC_CONVERSION_TEMP_9300 (1 << 15)
349 # define ATI_GMC_ROP3_MASK (0xff << 16)
350 # define ATI_DP_SRC_SOURCE_MEMORY (2 << 24)
351 # define ATI_DP_SRC_SOURCE_HOST_DATA (3 << 24)
352 # define R128_GMC_3D_FCN_EN (1 << 27)
353 # define ATI_GMC_CLR_CMP_CNTL_DIS (1 << 28)
354 # define R128_GMC_AUX_CLIP_DIS (1 << 29)
355 # define ATI_GMC_WR_MSK_DIS (1 << 30)
356 # define R128_GMC_LD_BRUSH_Y_X (1 << 31)
358 #define ATI_REG_DP_BRUSH_FRGD_CLR 0x147c
359 #define ATI_REG_DST_WIDTH_HEIGHT 0x1598
360 #define ATI_REG_CLR_CMP_CNTL 0x15c0
362 #define R128_REG_AUX_SC_CNTL 0x1660
363 # define R128_AUX1_SC_ENB (1 << 0)
364 # define R128_AUX1_SC_MODE_SUB (1 << 1)
365 # define R128_AUX2_SC_ENB (1 << 0)
366 # define R128_AUX2_SC_MODE_SUB (1 << 1)
367 # define R128_AUX3_SC_ENB (1 << 0)
368 # define R128_AUX3_SC_MODE_SUB (1 << 1)
370 #define R128_REG_AUX1_SC_LEFT 0x1664
371 #define R128_REG_AUX1_SC_RIGHT 0x1668
372 #define R128_REG_AUX1_SC_TOP 0x166c
373 #define R128_REG_AUX1_SC_BOTTOM 0x1670
374 #define R128_REG_AUX2_SC_LEFT 0x1674
375 #define R128_REG_AUX2_SC_RIGHT 0x1678
376 #define R128_REG_AUX2_SC_TOP 0x167c
377 #define R128_REG_AUX2_SC_BOTTOM 0x1680
378 #define R128_REG_AUX3_SC_LEFT 0x1684
379 #define R128_REG_AUX3_SC_RIGHT 0x1688
380 #define R128_REG_AUX3_SC_TOP 0x168c
381 #define R128_REG_AUX3_SC_BOTTOM 0x1690
383 #define ATI_REG_DP_CNTL 0x16c0
384 # define ATI_DST_X_LEFT_TO_RIGHT (1 << 0)
385 # define ATI_DST_Y_TOP_TO_BOTTOM (1 << 1)
387 #define ATI_REG_DP_MIX 0x16c8
388 #define ATI_REG_DP_WRITE_MASK 0x16cc
389 #define ATI_REG_DEFAULT_OFFSET 0x16e0
390 #define ATI_REG_DEFAULT_PITCH 0x16e4
392 #define ATI_REG_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
393 # define ATI_DEFAULT_SC_RIGHT_MAX 0x00001fff
394 # define ATI_DEFAULT_SC_BOTTOM_MAX 0x1fff0000
396 #define ATI_REG_SC_TOP_LEFT 0x16ec
397 #define ATI_REG_SC_BOTTOM_RIGHT 0x16f0
399 #define ATI_REG_WAIT_UNTIL 0x1720
400 # define ATI_WAIT_CRTC_PFLIP (1 << 0)
401 # define ATI_WAIT_RE_CRTC_VLINE (1 << 1)
402 # define ATI_WAIT_FE_CRTC_VLINE (1 << 2)
403 # define ATI_WAIT_CRTC_VLINE (1 << 3)
404 # define ATI_WAIT_DMA_VIPH0_IDLE (1 << 4)
405 # define ATI_WAIT_DMA_VIPH1_IDLE (1 << 5)
406 # define ATI_WAIT_DMA_VIPH2_IDLE (1 << 6)
407 # define ATI_WAIT_DMA_VIPH3_IDLE (1 << 7)
408 # define ATI_WAIT_DMA_VID_IDLE (1 << 8)
409 # define ATI_WAIT_DMA_GUI_IDLE (1 << 9)
410 # define ATI_WAIT_CMDFIFO (1 << 10)
411 # define ATI_WAIT_OV0_FLIP (1 << 11)
412 # define RADEON_WAIT_OV0_SLICEDONE (1 << 12)
413 # define RADEON_WAIT_2D_IDLE (1 << 14)
414 # define RADEON_WAIT_3D_IDLE (1 << 15)
415 # define RADEON_WAIT_2D_IDLECLEAN (1 << 16)
416 # define RADEON_WAIT_3D_IDLECLEAN (1 << 17)
417 # define RADEON_WAIT_HOST_IDLECLEAN (1 << 18)
418 # define ATI_WAIT_CMDFIFO_ENTRIES (0x07f00000)
419 # define RADEON_WAIT_BOTH_CRTC_PFLIP (1 << 30)
420 # define RADEON_ENG_DISPLAY_SELECT (1 << 31)
422 #define RADEON_REG_ISYNC_CNTL 0x1724
423 #define ISYNC_ANY2D_IDLE3D 0x1
424 #define ISYNC_ANY3D_IDLE2D 0x2
426 #define R128_REG_GUI_STAT 0x1740
427 # define R128_GUI_ACTIVE (1 << 31)
429 #define R128_REG_PC_GUI_MODE 0x1744
430 #define R128_PC_GUI_PRIORITY (1 << 0)
431 #define R128_PC_RISE_DF_EN (1 << 1)
432 #define R128_PC_FALL_DF_EN (1 << 2)
433 #define R128_PC_BYPASS_EN (1 << 3)
434 #define R128_PC_CACHE_SIZE (1 << 4)
435 #define R128_PC_IGNORE_UNIFY (1 << 5)
436 #define R128_PC_IGNORE_WRHINT (1 << 6)
437 #define R128_PC_IGNORE_RDHINT (1 << 7)
438 #define R128_PC_RISE_DP_EN (1 << 8)
440 #define R128_REG_PC_GUI_CTLSTAT 0x1748
441 /* bits match R128_REG_PC_NGUI_CTLSTAT */
443 #define R128_REG_TEX_CNTL 0x1800
444 #define R128_REG_SECONDARY_SCALE_OFFSET 0x1980
445 #define R128_REG_SECONDARY_SCALE_PITCH 0x1980
446 #define R128_REG_SECONDARY_SCALE_X_INC 0x1984
447 #define R128_REG_SECONDARY_SCALE_Y_INC 0x1988
448 #define R128_REG_SECONDARY_SCALE_HACC 0x198c
449 #define R128_REG_SECONDARY_SCALE_VACC 0x1990
450 #define R128_REG_SCALE_SRC_HEIGHT_WIDTH 0x1994
451 #define R128_REG_SCALE_OFFSET_0 0x1998
452 #define R128_REG_SCALE_PITCH 0x199c
453 #define R128_REG_SCALE_X_INC 0x19a0
454 #define R128_REG_SCALE_Y_INC 0x19a4
455 #define R128_REG_SCALE_HACC 0x19a8
456 #define R128_REG_SCALE_VACC 0x19ac
457 #define R128_REG_SCALE_DST_X_Y 0x19b0
458 #define R128_REG_SCALE_DST_HEIGHT_WIDTH 0x19b4
460 #define R128_REG_SCALE_3D_CNTL 0x1a00
461 # define R128_SCALE_DITHER_ERR_DIFF (0 << 1)
462 # define R128_SCALE_DITHER_TABLE (1 << 1)
463 # define R128_TEX_CACHE_SIZE_FULL (0 << 2)
464 # define R128_TEX_CACHE_SIZE_HALF (1 << 2)
465 # define R128_DITHER_INIT_CURR (0 << 3)
466 # define R128_DITHER_INIT_RESET (1 << 3)
467 # define R128_ROUND_24BIT (1 << 4)
468 # define R128_TEX_CACHE_DISABLE (1 << 5)
469 # define R128_SCALE_3D_NOOP (0 << 6)
470 # define R128_SCALE_3D_SCALE (1 << 6)
471 # define R128_SCALE_3D_TEXMAP_SHADE (2 << 6)
472 # define R128_SCALE_PIX_BLEND (0 << 8)
473 # define R128_SCALE_PIX_REPLICATE (1 << 8)
474 # define R128_TEX_CACHE_SPLIT (1 << 9)
475 # define R128_APPLE_YUV_MODE (1 << 10)
476 # define R128_TEX_CACHE_PALLETE_MODE (1 << 11)
477 # define R128_ALPHA_COMB_ADD_CLAMP (0 << 12)
478 # define R128_ALPHA_COMB_ADD_NCLAMP (1 << 12)
479 # define R128_ALPHA_COMB_SUB_DST_SRC_CLAMP (2 << 12)
480 # define R128_ALPHA_COMB_SUB_DST_SRC_NCLAMP (3 << 12)
481 # define R128_FOG_TABLE (1 << 14)
482 # define R128_SIGNED_DST_CLAMP (1 << 15)
483 /* Alpha bits from R128_REG_MISC_3D_CNTL */
484 # define R128_COMPOSITE_SHADOW_CMP_EQUAL (0 << 28)
485 # define R128_COMPOSITE_SHADOW_CMP_NEQUAL (1 << 28)
486 # define R128_COMPOSITE_SHADOW (1 << 29)
487 # define R128_TEX_MAP_ALPHA_IN_TEXTURE (1 << 30)
488 # define R128_TEX_CACHE_LINE_SIZE_8QW (0 << 31)
489 # define R128_TEX_CACHE_LINE_SIZE_4QW (1 << 31)
491 #define R128_REG_SCALE_3D_DATATYPE 0x1a20
493 #define R128_REG_SETUP_CNTL 0x1bc4
494 # define R128_DONT_START_TRIANGLE (1 << 0)
495 # define R128_Z_BIAS (0 << 1)
496 # define R128_DONT_START_ANY_ON (1 << 2)
497 # define R128_COLOR_SOLID_COLOR (0 << 3)
498 # define R128_COLOR_FLAT_VERT_1 (1 << 3)
499 # define R128_COLOR_FLAT_VERT_2 (2 << 3)
500 # define R128_COLOR_FLAT_VERT_3 (3 << 3)
501 # define R128_COLOR_GOURAUD (4 << 3)
502 # define R128_PRIM_TYPE_TRI (0 << 7)
503 # define R128_PRIM_TYPE_LINE (1 << 7)
504 # define R128_PRIM_TYPE_POINT (2 << 7)
505 # define R128_PRIM_TYPE_POLY_EDGE (3 << 7)
506 # define R128_TEXTURE_ST_MULT_W (0 << 9)
507 # define R128_TEXTURE_ST_DIRECT (1 << 9)
508 # define R128_STARTING_VERTEX_1 (1 << 14)
509 # define R128_STARTING_VERTEX_2 (2 << 14)
510 # define R128_STARTING_VERTEX_3 (3 << 14)
511 # define R128_ENDING_VERTEX_1 (1 << 16)
512 # define R128_ENDING_VERTEX_2 (2 << 16)
513 # define R128_ENDING_VERTEX_3 (3 << 16)
514 # define R128_SU_POLY_LINE_LAST (0 << 18)
515 # define R128_SU_POLY_LINE_NOT_LAST (1 << 18)
516 # define R128_SUB_PIX_2BITS (0 << 19)
517 # define R128_SUB_PIX_4BITS (1 << 19)
518 # define R128_SET_UP_CONTINUE (1 << 31)
520 #define R128_REG_WINDOW_XY_OFFSET 0x1bcc
522 #define RADEON_REG_RB3D_BLENDCNTL 0x1c20
523 # define RADEON_COMB_FCN_MASK (3 << 12)
524 # define RADEON_COMB_FCN_ADD_CLAMP (0 << 12)
525 # define RADEON_COMB_FCN_ADD_NOCLAMP (1 << 12)
526 # define RADEON_COMB_FCN_SUB_CLAMP (2 << 12)
527 # define RADEON_COMB_FCN_SUB_NOCLAMP (3 << 12)
528 # define R200_COMB_FCN_MIN (4 << 12)
529 # define R200_COMB_FCN_MAX (5 << 12)
530 # define R200_COMB_FCN_RSUB_CLAMP (6 << 12)
531 # define R200_COMB_FCN_RSUB_NOCLAMP (7 << 12)
532 # define RADEON_SBLEND_GL_ZERO (32 << 16)
533 # define RADEON_SBLEND_GL_ONE (33 << 16)
534 # define RADEON_SBLEND_GL_SRC_COLOR (34 << 16)
535 # define RADEON_SBLEND_GL_INV_SRC_COLOR (35 << 16)
536 # define RADEON_SBLEND_GL_DST_COLOR (36 << 16)
537 # define RADEON_SBLEND_GL_INV_DST_COLOR (37 << 16)
538 # define RADEON_SBLEND_GL_SRC_ALPHA (38 << 16)
539 # define RADEON_SBLEND_GL_INV_SRC_ALPHA (39 << 16)
540 # define RADEON_SBLEND_GL_DST_ALPHA (40 << 16)
541 # define RADEON_SBLEND_GL_INV_DST_ALPHA (41 << 16)
542 # define RADEON_SBLEND_GL_SRC_ALPHA_SATURATE (42 << 16)
543 # define R200_SBLEND_GL_CONST_COLOR (43 << 16)
544 # define R200_SBLEND_GL_ONE_MINUS_CONST_COLOR (44 << 16)
545 # define R200_SBLEND_GL_CONST_ALPHA (45 << 16)
546 # define R200_SBLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 16)
547 # define RADEON_SBLEND_MASK (63 << 16)
548 # define RADEON_DBLEND_GL_ZERO (32 << 24)
549 # define RADEON_DBLEND_GL_ONE (33 << 24)
550 # define RADEON_DBLEND_GL_SRC_COLOR (34 << 24)
551 # define RADEON_DBLEND_GL_INV_SRC_COLOR (35 << 24)
552 # define RADEON_DBLEND_GL_DST_COLOR (36 << 24)
553 # define RADEON_DBLEND_GL_INV_DST_COLOR (37 << 24)
554 # define RADEON_DBLEND_GL_SRC_ALPHA (38 << 24)
555 # define RADEON_DBLEND_GL_INV_SRC_ALPHA (39 << 24)
556 # define RADEON_DBLEND_GL_DST_ALPHA (40 << 24)
557 # define RADEON_DBLEND_GL_INV_DST_ALPHA (41 << 24)
558 # define R200_DBLEND_GL_CONST_COLOR (43 << 24)
559 # define R200_DBLEND_GL_ONE_MINUS_CONST_COLOR (44 << 24)
560 # define R200_DBLEND_GL_CONST_ALPHA (45 << 24)
561 # define R200_DBLEND_GL_ONE_MINUS_CONST_ALPHA (46 << 24)
562 # define RADEON_DBLEND_MASK (63 << 24)
564 #define RADEON_REG_PP_CNTL 0x1c38
565 # define RADEON_STIPPLE_ENABLE (1 << 0)
566 # define RADEON_SCISSOR_ENABLE (1 << 1)
567 # define RADEON_PATTERN_ENABLE (1 << 2)
568 # define RADEON_SHADOW_ENABLE (1 << 3)
569 # define RADEON_TEX_ENABLE_MASK (0xf << 4)
570 # define RADEON_TEX_0_ENABLE (1 << 4)
571 # define RADEON_TEX_1_ENABLE (1 << 5)
572 # define RADEON_TEX_2_ENABLE (1 << 6)
573 # define RADEON_TEX_3_ENABLE (1 << 7)
574 # define R200_TEX_4_ENABLE (1 << 8)
575 # define R200_TEX_5_ENABLE (1 << 9)
576 # define RADEON_TEX_BLEND_ENABLE_MASK (0xf << 12)
577 # define RADEON_TEX_BLEND_0_ENABLE (1 << 12)
578 # define RADEON_TEX_BLEND_1_ENABLE (1 << 13)
579 # define RADEON_TEX_BLEND_2_ENABLE (1 << 14)
580 # define RADEON_TEX_BLEND_3_ENABLE (1 << 15)
581 # define R200_TEX_BLEND_4_ENABLE (1 << 16)
582 # define R200_TEX_BLEND_5_ENABLE (1 << 17)
583 # define R200_TEX_BLEND_6_ENABLE (1 << 18)
584 # define RADEON_PLANAR_YUV_ENABLE (1 << 20)
585 # define RADEON_SPECULAR_ENABLE (1 << 21)
586 # define RADEON_FOG_ENABLE (1 << 22)
587 # define RADEON_ALPHA_TEST_ENABLE (1 << 23)
588 # define RADEON_ANTI_ALIAS_NONE (0 << 24)
589 # define RADEON_ANTI_ALIAS_LINE (1 << 24)
590 # define RADEON_ANTI_ALIAS_POLY (2 << 24)
591 # define RADEON_ANTI_ALIAS_LINE_POLY (3 << 24)
592 # define RADEON_BUMP_MAP_ENABLE (1 << 26)
593 # define RADEON_BUMPED_MAP_T0 (0 << 27)
594 # define RADEON_BUMPED_MAP_T1 (1 << 27)
595 # define RADEON_BUMPED_MAP_T2 (2 << 27)
596 # define RADEON_TEX_3D_ENABLE_0 (1 << 29)
597 # define RADEON_TEX_3D_ENABLE_1 (1 << 30)
598 # define RADEON_MC_ENABLE (1 << 31)
600 #define RADEON_REG_RB3D_CNTL 0x1c3c
601 # define RADEON_ALPHA_BLEND_ENABLE (1 << 0)
602 # define RADEON_PLANE_MASK_ENABLE (1 << 1)
603 # define RADEON_DITHER_ENABLE (1 << 2)
604 # define RADEON_ROUND_ENABLE (1 << 3)
605 # define RADEON_SCALE_DITHER_ENABLE (1 << 4)
606 # define RADEON_DITHER_INIT (1 << 5)
607 # define RADEON_ROP_ENABLE (1 << 6)
608 # define RADEON_STENCIL_ENABLE (1 << 7)
609 # define RADEON_Z_ENABLE (1 << 8)
610 # define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9)
611 # define RADEON_COLOR_FORMAT_ARGB1555 (3 << 10)
612 # define RADEON_COLOR_FORMAT_RGB565 (4 << 10)
613 # define RADEON_COLOR_FORMAT_ARGB8888 (6 << 10)
614 # define RADEON_COLOR_FORMAT_RGB332 (7 << 10)
615 # define RADEON_COLOR_FORMAT_Y8 (8 << 10)
616 # define RADEON_COLOR_FORMAT_RGB8 (9 << 10)
617 # define RADEON_COLOR_FORMAT_YUV422_VYUY (11 << 10)
618 # define RADEON_COLOR_FORMAT_YUV422_YVYU (12 << 10)
619 # define RADEON_COLOR_FORMAT_aYUV444 (14 << 10)
620 # define RADEON_COLOR_FORMAT_ARGB4444 (15 << 10)
621 # define RADEON_CLRCMP_FLIP_ENABLE (1 << 14)
623 #define RADEON_REG_RB3D_COLOROFFSET 0x1c40
624 # define RADEON_COLOROFFSET_MASK 0xfffffff0
626 #define RADEON_REG_RE_WIDTH_HEIGHT 0x1c44
628 #define RADEON_REG_RB3D_COLORPITCH 0x1c48
629 # define RADEON_COLORPITCH_MASK 0x000001ff8
630 # define RADEON_COLOR_TILE_ENABLE (1 << 16)
631 # define RADEON_COLOR_MICROTILE_ENABLE (1 << 17)
632 # define RADEON_COLOR_ENDIAN_NO_SWAP (0 << 18)
633 # define RADEON_COLOR_ENDIAN_WORD_SWAP (1 << 18)
634 # define RADEON_COLOR_ENDIAN_DWORD_SWAP (2 << 18)
636 #define RADEON_REG_SE_CNTL 0x1c4c
637 # define RADEON_FFACE_CULL_CW (0 << 0)
638 # define RADEON_FFACE_CULL_CCW (1 << 0)
639 # define RADEON_FFACE_CULL_DIR_MASK (1 << 0)
640 # define RADEON_BFACE_CULL (0 << 1)
641 # define RADEON_BFACE_SOLID (3 << 1)
642 # define RADEON_FFACE_CULL (0 << 3)
643 # define RADEON_FFACE_SOLID (3 << 3)
644 # define RADEON_FFACE_CULL_MASK (3 << 3)
645 # define RADEON_BADVTX_CULL_DISABLE (1 << 5)
646 # define RADEON_FLAT_SHADE_VTX_0 (0 << 6)
647 # define RADEON_FLAT_SHADE_VTX_1 (1 << 6)
648 # define RADEON_FLAT_SHADE_VTX_2 (2 << 6)
649 # define RADEON_FLAT_SHADE_VTX_LAST (3 << 6)
650 # define RADEON_DIFFUSE_SHADE_SOLID (0 << 8)
651 # define RADEON_DIFFUSE_SHADE_FLAT (1 << 8)
652 # define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8)
653 # define RADEON_DIFFUSE_SHADE_MASK (3 << 8)
654 # define RADEON_ALPHA_SHADE_SOLID (0 << 10)
655 # define RADEON_ALPHA_SHADE_FLAT (1 << 10)
656 # define RADEON_ALPHA_SHADE_GOURAUD (2 << 10)
657 # define RADEON_ALPHA_SHADE_MASK (3 << 10)
658 # define RADEON_SPECULAR_SHADE_SOLID (0 << 12)
659 # define RADEON_SPECULAR_SHADE_FLAT (1 << 12)
660 # define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12)
661 # define RADEON_SPECULAR_SHADE_MASK (3 << 12)
662 # define RADEON_FOG_SHADE_SOLID (0 << 14)
663 # define RADEON_FOG_SHADE_FLAT (1 << 14)
664 # define RADEON_FOG_SHADE_GOURAUD (2 << 14)
665 # define RADEON_FOG_SHADE_MASK (3 << 14)
666 # define RADEON_ZBIAS_ENABLE_POINT (1 << 16)
667 # define RADEON_ZBIAS_ENABLE_LINE (1 << 17)
668 # define RADEON_ZBIAS_ENABLE_TRI (1 << 18)
669 # define RADEON_WIDELINE_ENABLE (1 << 20)
670 # define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24)
671 # define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25)
672 # define RADEON_VTX_PIX_CENTER_D3D (0 << 27)
673 # define RADEON_VTX_PIX_CENTER_OGL (1 << 27)
674 # define RADEON_ROUND_MODE_TRUNC (0 << 28)
675 # define RADEON_ROUND_MODE_ROUND (1 << 28)
676 # define RADEON_ROUND_MODE_ROUND_EVEN (2 << 28)
677 # define RADEON_ROUND_MODE_ROUND_ODD (3 << 28)
678 # define RADEON_ROUND_PREC_16TH_PIX (0 << 30)
679 # define RADEON_ROUND_PREC_8TH_PIX (1 << 30)
680 # define RADEON_ROUND_PREC_4TH_PIX (2 << 30)
681 # define RADEON_ROUND_PREC_HALF_PIX (3 << 30)
683 #define R200_REG_RE_CNTL 0x1c50
685 #define RADEON_REG_SE_COORD_FMT 0x1c50
686 # define RADEON_VTX_XY_PRE_MULT_1_OVER_W0 (1 << 0)
687 # define RADEON_VTX_Z_PRE_MULT_1_OVER_W0 (1 << 1)
688 # define RADEON_VTX_ST0_NONPARAMETRIC (1 << 8)
689 # define RADEON_VTX_ST1_NONPARAMETRIC (1 << 9)
690 # define RADEON_VTX_ST2_NONPARAMETRIC (1 << 10)
691 # define RADEON_VTX_ST3_NONPARAMETRIC (1 << 11)
692 # define RADEON_VTX_W0_NORMALIZE (1 << 12)
693 # define RADEON_VTX_W0_IS_NOT_1_OVER_W0 (1 << 16)
694 # define RADEON_VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17)
695 # define RADEON_VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19)
696 # define RADEON_VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21)
697 # define RADEON_VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23)
698 # define RADEON_TEX1_W_ROUTING_USE_W0 (0 << 26)
699 # define RADEON_TEX1_W_ROUTING_USE_Q1 (1 << 26)
701 #define RADEON_REG_PP_TXFILTER_0 0x1c54
702 #define RADEON_REG_PP_TXFILTER_1 0x1c6c
703 #define RADEON_REG_PP_TXFILTER_2 0x1c84
704 # define RADEON_MAG_FILTER_NEAREST (0 << 0)
705 # define RADEON_MAG_FILTER_LINEAR (1 << 0)
706 # define RADEON_MAG_FILTER_MASK (1 << 0)
707 # define RADEON_MIN_FILTER_NEAREST (0 << 1)
708 # define RADEON_MIN_FILTER_LINEAR (1 << 1)
709 # define RADEON_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
710 # define RADEON_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
711 # define RADEON_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
712 # define RADEON_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
713 # define RADEON_MIN_FILTER_ANISO_NEAREST (8 << 1)
714 # define RADEON_MIN_FILTER_ANISO_LINEAR (9 << 1)
715 # define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
716 # define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
717 # define RADEON_MIN_FILTER_MASK (15 << 1)
718 # define RADEON_MAX_ANISO_1_TO_1 (0 << 5)
719 # define RADEON_MAX_ANISO_2_TO_1 (1 << 5)
720 # define RADEON_MAX_ANISO_4_TO_1 (2 << 5)
721 # define RADEON_MAX_ANISO_8_TO_1 (3 << 5)
722 # define RADEON_MAX_ANISO_16_TO_1 (4 << 5)
723 # define RADEON_MAX_ANISO_MASK (7 << 5)
724 # define RADEON_LOD_BIAS_MASK (0xff << 8)
725 # define RADEON_LOD_BIAS_SHIFT 8
726 # define RADEON_MAX_MIP_LEVEL_MASK (0x0f << 16)
727 # define RADEON_MAX_MIP_LEVEL_SHIFT 16
728 # define RADEON_YUV_TO_RGB (1 << 20)
729 # define RADEON_YUV_TEMPERATURE_COOL (0 << 21)
730 # define RADEON_YUV_TEMPERATURE_HOT (1 << 21)
731 # define RADEON_YUV_TEMPERATURE_MASK (1 << 21)
732 # define RADEON_WRAPEN_S (1 << 22)
733 # define RADEON_CLAMP_S_WRAP (0 << 23)
734 # define RADEON_CLAMP_S_MIRROR (1 << 23)
735 # define RADEON_CLAMP_S_CLAMP_LAST (2 << 23)
736 # define RADEON_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
737 # define RADEON_CLAMP_S_CLAMP_BORDER (4 << 23)
738 # define RADEON_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
739 # define RADEON_CLAMP_S_CLAMP_GL (6 << 23)
740 # define RADEON_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
741 # define RADEON_CLAMP_S_MASK (7 << 23)
742 # define RADEON_WRAPEN_T (1 << 26)
743 # define RADEON_CLAMP_T_WRAP (0 << 27)
744 # define RADEON_CLAMP_T_MIRROR (1 << 27)
745 # define RADEON_CLAMP_T_CLAMP_LAST (2 << 27)
746 # define RADEON_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
747 # define RADEON_CLAMP_T_CLAMP_BORDER (4 << 27)
748 # define RADEON_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
749 # define RADEON_CLAMP_T_CLAMP_GL (6 << 27)
750 # define RADEON_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
751 # define RADEON_CLAMP_T_MASK (7 << 27)
752 # define RADEON_BORDER_MODE_OGL (0 << 31)
753 # define RADEON_BORDER_MODE_D3D (1 << 31)
755 #define RADEON_REG_PP_TXFORMAT_0 0x1c58
756 #define RADEON_REG_PP_TXFORMAT_1 0x1c70
757 #define RADEON_REG_PP_TXFORMAT_2 0x1c88
758 # define RADEON_TXFORMAT_I8 (0 << 0)
759 # define RADEON_TXFORMAT_AI88 (1 << 0)
760 # define RADEON_TXFORMAT_RGB332 (2 << 0)
761 # define RADEON_TXFORMAT_ARGB1555 (3 << 0)
762 # define RADEON_TXFORMAT_RGB565 (4 << 0)
763 # define RADEON_TXFORMAT_ARGB4444 (5 << 0)
764 # define RADEON_TXFORMAT_ARGB8888 (6 << 0)
765 # define RADEON_TXFORMAT_RGBA8888 (7 << 0)
766 # define RADEON_TXFORMAT_Y8 (8 << 0)
767 # define RADEON_TXFORMAT_AYUV444 (9 << 0)
768 # define RADEON_TXFORMAT_VYUY422 (10 << 0)
769 # define RADEON_TXFORMAT_YVYU422 (11 << 0)
770 # define RADEON_TXFORMAT_DXT1 (12 << 0)
771 # define RADEON_TXFORMAT_DXT23 (14 << 0)
772 # define RADEON_TXFORMAT_DXT45 (15 << 0)
773 # define RADEON_TXFORMAT_FORMAT_MASK (31 << 0)
774 # define RADEON_TXFORMAT_FORMAT_SHIFT 0
775 # define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5)
776 # define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6)
777 # define RADEON_TXFORMAT_NON_POWER2 (1 << 7)
778 # define RADEON_TXFORMAT_WIDTH_MASK (15 << 8)
779 # define RADEON_TXFORMAT_WIDTH_SHIFT 8
780 # define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12)
781 # define RADEON_TXFORMAT_HEIGHT_SHIFT 12
782 # define RADEON_TXFORMAT_F5_WIDTH_MASK (15 << 16)
783 # define RADEON_TXFORMAT_F5_WIDTH_SHIFT 16
784 # define RADEON_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
785 # define RADEON_TXFORMAT_F5_HEIGHT_SHIFT 20
786 # define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
787 # define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
788 # define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
789 # define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24)
790 # define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26)
791 # define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26)
792 # define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26)
793 # define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26)
794 # define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
795 # define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
796 # define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
797 # define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31)
799 #define RADEON_REG_PP_TXOFFSET_0 0x1c5c
800 #define RADEON_REG_PP_TXOFFSET_1 0x1c74
801 #define RADEON_REG_PP_TXOFFSET_2 0x1c8c
802 # define RADEON_TXO_ENDIAN_NO_SWAP (0 << 0)
803 # define RADEON_TXO_ENDIAN_BYTE_SWAP (1 << 0)
804 # define RADEON_TXO_ENDIAN_WORD_SWAP (2 << 0)
805 # define RADEON_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
806 # define RADEON_TXO_MACRO_LINEAR (0 << 2)
807 # define RADEON_TXO_MACRO_TILE (1 << 2)
808 # define RADEON_TXO_MICRO_LINEAR (0 << 3)
809 # define RADEON_TXO_MICRO_TILE_X2 (1 << 3)
810 # define RADEON_TXO_MICRO_TILE_OPT (2 << 3)
811 # define RADEON_TXO_OFFSET_MASK 0xffffffe0
812 # define RADEON_TXO_OFFSET_SHIFT 5
814 #define RADEON_REG_PP_TXCBLEND_0 0x1c60
815 #define RADEON_REG_PP_TXCBLEND_1 0x1c78
816 #define RADEON_REG_PP_TXCBLEND_2 0x1c90
817 # define RADEON_COLOR_ARG_A_SHIFT 0
818 # define RADEON_COLOR_ARG_A_MASK (0x1f << 0)
819 # define RADEON_COLOR_ARG_A_ZERO (0 << 0)
820 # define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0)
821 # define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0)
822 # define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0)
823 # define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0)
824 # define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0)
825 # define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0)
826 # define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0)
827 # define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0)
828 # define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0)
829 # define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0)
830 # define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0)
831 # define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0)
832 # define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0)
833 # define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0)
834 # define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0)
835 # define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0)
836 # define RADEON_COLOR_ARG_B_SHIFT 5
837 # define RADEON_COLOR_ARG_B_MASK (0x1f << 5)
838 # define RADEON_COLOR_ARG_B_ZERO (0 << 5)
839 # define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5)
840 # define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5)
841 # define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5)
842 # define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5)
843 # define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5)
844 # define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5)
845 # define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5)
846 # define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5)
847 # define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5)
848 # define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5)
849 # define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5)
850 # define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5)
851 # define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5)
852 # define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5)
853 # define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5)
854 # define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5)
855 # define RADEON_COLOR_ARG_C_SHIFT 10
856 # define RADEON_COLOR_ARG_C_MASK (0x1f << 10)
857 # define RADEON_COLOR_ARG_C_ZERO (0 << 10)
858 # define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10)
859 # define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10)
860 # define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10)
861 # define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10)
862 # define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10)
863 # define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10)
864 # define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10)
865 # define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10)
866 # define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10)
867 # define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10)
868 # define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10)
869 # define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10)
870 # define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10)
871 # define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10)
872 # define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10)
873 # define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10)
874 # define RADEON_COMP_ARG_A (1 << 15)
875 # define RADEON_COMP_ARG_A_SHIFT 15
876 # define RADEON_COMP_ARG_B (1 << 16)
877 # define RADEON_COMP_ARG_B_SHIFT 16
878 # define RADEON_COMP_ARG_C (1 << 17)
879 # define RADEON_COMP_ARG_C_SHIFT 17
880 # define RADEON_BLEND_CTL_MASK (7 << 18)
881 # define RADEON_BLEND_CTL_ADD (0 << 18)
882 # define RADEON_BLEND_CTL_SUBTRACT (1 << 18)
883 # define RADEON_BLEND_CTL_ADDSIGNED (2 << 18)
884 # define RADEON_BLEND_CTL_BLEND (3 << 18)
885 # define RADEON_BLEND_CTL_DOT3 (4 << 18)
886 # define RADEON_SCALE_SHIFT 21
887 # define RADEON_SCALE_MASK (3 << 21)
888 # define RADEON_SCALE_1X (0 << 21)
889 # define RADEON_SCALE_2X (1 << 21)
890 # define RADEON_SCALE_4X (2 << 21)
891 # define RADEON_CLAMP_TX (1 << 23)
892 # define RADEON_T0_EQ_TCUR (1 << 24)
893 # define RADEON_T1_EQ_TCUR (1 << 25)
894 # define RADEON_T2_EQ_TCUR (1 << 26)
895 # define RADEON_T3_EQ_TCUR (1 << 27)
896 # define RADEON_COLOR_ARG_MASK 0x1f
897 # define RADEON_COMP_ARG_SHIFT 15
899 #define RADEON_REG_PP_TXABLEND_0 0x1c64
900 #define RADEON_REG_PP_TXABLEND_1 0x1c7c
901 #define RADEON_REG_PP_TXABLEND_2 0x1c94
902 # define RADEON_ALPHA_ARG_A_SHIFT 0
903 # define RADEON_ALPHA_ARG_A_MASK (0xf << 0)
904 # define RADEON_ALPHA_ARG_A_ZERO (0 << 0)
905 # define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0)
906 # define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0)
907 # define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0)
908 # define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0)
909 # define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0)
910 # define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0)
911 # define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0)
912 # define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0)
913 # define RADEON_ALPHA_ARG_B_SHIFT 4
914 # define RADEON_ALPHA_ARG_B_MASK (0xf << 4)
915 # define RADEON_ALPHA_ARG_B_ZERO (0 << 4)
916 # define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4)
917 # define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4)
918 # define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4)
919 # define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4)
920 # define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4)
921 # define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4)
922 # define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4)
923 # define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4)
924 # define RADEON_ALPHA_ARG_C_SHIFT 8
925 # define RADEON_ALPHA_ARG_C_MASK (0xf << 8)
926 # define RADEON_ALPHA_ARG_C_ZERO (0 << 8)
927 # define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8)
928 # define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8)
929 # define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8)
930 # define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8)
931 # define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8)
932 # define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8)
933 # define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8)
934 # define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8)
935 # define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9)
936 /* COMP_ARG, BLEND_CNTL, CLAMP_TX same as for CBLEND, T*_EQ_TCUR */
937 # define RADEON_ALPHA_ARG_MASK 0xf
939 #define RADEON_REG_PP_TFACTOR_0 0x1c68
940 #define RADEON_REG_PP_TFACTOR_1 0x1c80
941 #define RADEON_REG_PP_TFACTOR_2 0x1c98
943 #define R128_REG_TEX_CNTL_C 0x1c9c
944 # define R128_Z_ENABLE (1 << 0)
945 # define R128_Z_WRITE_ENABLE (1 << 1)
946 # define R128_STENCIL_ENABLE (1 << 3)
947 # define R128_SHADE_ENABLE (0 << 4)
948 # define R128_TEXMAP_ENABLE (1 << 4)
949 # define R128_SEC_TEXMAP_ENABLE (1 << 5)
950 # define R128_FOG_ENABLE (1 << 7)
951 # define R128_DITHER_ENABLE (1 << 8)
952 # define R128_ALPHA_ENABLE (1 << 9)
953 # define R128_ALPHA_TEST_ENABLE (1 << 10)
954 # define R128_SPEC_LIGHT_ENABLE (1 << 11)
955 # define R128_TEX_CHROMA_KEY_ENABLE (1 << 12)
956 # define R128_ALPHA_IN_TEX_COMPLETE_A (0 << 13)
957 # define R128_ALPHA_IN_TEX_LSB_A (1 << 13)
958 # define R128_LIGHT_DIS (0 << 14)
959 # define R128_LIGHT_COPY (1 << 14)
960 # define R128_LIGHT_MODULATE (2 << 14)
961 # define R128_LIGHT_ADD (3 << 14)
962 # define R128_LIGHT_BLEND_CONSTANT (4 << 14)
963 # define R128_LIGHT_BLEND_TEXTURE (5 << 14)
964 # define R128_LIGHT_BLEND_VERTEX (6 << 14)
965 # define R128_LIGHT_BLEND_CONST_COLOR (7 << 14)
966 # define R128_ALPHA_LIGHT_DIS (0 << 18)
967 # define R128_ALPHA_LIGHT_COPY (1 << 18)
968 # define R128_ALPHA_LIGHT_MODULATE (2 << 18)
969 # define R128_ALPHA_LIGHT_ADD (3 << 18)
970 # define R128_ANTI_ALIAS (1 << 21)
971 # define R128_TEX_CACHE_FLUSH (1 << 23)
972 # define R128_LOD_BIAS_SHIFT 24
973 # define R128_LOD_BIAS_MASK (0xff << 24)
975 #define R128_REG_MISC_3D_STATE_CNTL 0x1ca0
976 # define R128_REF_ALPHA_MASK 0xff
977 # define R128_MISC_SCALE_3D_NOOP (0 << 8)
978 # define R128_MISC_SCALE_3D_SCALE (1 << 8)
979 # define R128_MISC_SCALE_3D_TEXMAP_SHADE (2 << 8)
980 # define R128_MISC_SCALE_PIX_BLEND (0 << 10)
981 # define R128_MISC_SCALE_PIX_REPLICATE (1 << 10)
982 # define R128_ALPHA_COMB_ADD_CLAMP (0 << 12)
983 # define R128_ALPHA_COMB_ADD_NO_CLAMP (1 << 12)
984 # define R128_ALPHA_COMB_SUB_SRC_DST_CLAMP (2 << 12)
985 # define R128_ALPHA_COMB_SUB_SRC_DST_NO_CLAMP (3 << 12)
986 # define R128_FOG_VERTEX (0 << 14)
987 # define R128_FOG_TABLE (1 << 14)
988 # define R128_SBLEND_ZERO (0 << 16)
989 # define R128_SBLEND_ONE (1 << 16)
990 # define R128_SBLEND_SRCCOLOR (2 << 16)
991 # define R128_SBLEND_INVSRCCOLOR (3 << 16)
992 # define R128_SBLEND_SRC_ALPHA (4 << 16)
993 # define R128_SBLEND_INV_SRC_ALPHA (5 << 16)
994 # define R128_SBLEND_DST_ALPHA (6 << 16)
995 # define R128_SBLEND_INV_DST_ALPHA (7 << 16)
996 # define R128_SBLEND_DSTCOLOR (8 << 16)
997 # define R128_SBLEND_INVDSTCOLOR (9 << 16)
998 # define R128_SBLEND_SRC_ALPHASAT (10 << 16)
999 # define R128_SBLEND_BOTHSRC_ALPHA (11 << 16)
1000 # define R128_SBLEND_BOTHINV_SRC_ALPHA (12 << 16)
1001 # define R128_SBLEND_MASK (15 << 16)
1002 # define R128_DBLEND_ZERO (0 << 20)
1003 # define R128_DBLEND_ONE (1 << 20)
1004 # define R128_DBLEND_SRCCOLOR (2 << 20)
1005 # define R128_DBLEND_INVSRCCOLOR (3 << 20)
1006 # define R128_DBLEND_SRC_ALPHA (4 << 20)
1007 # define R128_DBLEND_INV_SRC_ALPHA (5 << 20)
1008 # define R128_DBLEND_DST_ALPHA (6 << 20)
1009 # define R128_DBLEND_INV_DST_ALPHA (7 << 20)
1010 # define R128_DBLEND_DSTCOLOR (8 << 20)
1011 # define R128_DBLEND_INVDSTCOLOR (9 << 20)
1012 # define R128_DBLEND_SRC_ALPHASAT (10 << 20)
1013 # define R128_DBLEND_MASK (15 << 20)
1014 # define R128_ALPHA_TEST_NEVER (0 << 24)
1015 # define R128_ALPHA_TEST_LESS (1 << 24)
1016 # define R128_ALPHA_TEST_LESSEQUAL (2 << 24)
1017 # define R128_ALPHA_TEST_EQUAL (3 << 24)
1018 # define R128_ALPHA_TEST_GREATEREQUAL (4 << 24)
1019 # define R128_ALPHA_TEST_GREATER (5 << 24)
1020 # define R128_ALPHA_TEST_NEQUAL (6 << 24)
1021 # define R128_ALPHA_TEST_ALWAYS (7 << 24)
1022 # define R128_ALPHA_TEST_MASK (7 << 24)
1024 #define R128_REG_PRIM_TEX_CNTL_C 0x1cb0
1025 #define R128_REG_SEC_TEX_CNTL_C 0x1d00
1026 # define R128_SEC_SELECT_PRIM_ST (0 << 0)
1027 # define R128_SEC_SELECT_SEC_ST (1 << 0)
1028 # define R128_MIN_BLEND_NEAREST (0 << 1)
1029 # define R128_MIN_BLEND_LINEAR (1 << 1)
1030 # define R128_MIN_BLEND_MIPNEAREST (2 << 1)
1031 # define R128_MIN_BLEND_MIPLINEAR (3 << 1)
1032 # define R128_MIN_BLEND_LINEARMIPNEAREST (4 << 1)
1033 # define R128_MIN_BLEND_LINEARMIPLINEAR (5 << 1)
1034 # define R128_MIN_BLEND_MASK (7 << 1)
1035 # define R128_MAG_BLEND_NEAREST (0 << 4)
1036 # define R128_MAG_BLEND_LINEAR (1 << 4)
1037 # define R128_MAG_BLEND_MASK (7 << 4)
1038 # define R128_MIP_MAP_DISABLE (1 << 7)
1039 # define R128_TEX_CLAMP_S_WRAP (0 << 8)
1040 # define R128_TEX_CLAMP_S_MIRROR (1 << 8)
1041 # define R128_TEX_CLAMP_S_CLAMP (2 << 8)
1042 # define R128_TEX_CLAMP_S_BORDER_COLOR (3 << 8)
1043 # define R128_TEX_CLAMP_S_MASK (3 << 8)
1044 # define R128_TEX_WRAP_S (1 << 10)
1045 # define R128_TEX_CLAMP_T_WRAP (0 << 11)
1046 # define R128_TEX_CLAMP_T_MIRROR (1 << 11)
1047 # define R128_TEX_CLAMP_T_CLAMP (2 << 11)
1048 # define R128_TEX_CLAMP_T_BORDER_COLOR (3 << 11)
1049 # define R128_TEX_CLAMP_T_MASK (3 << 11)
1050 # define R128_TEX_WRAP_T (1 << 13)
1051 # define R128_TEX_PERSPECTIVE_DISABLE (1 << 14)
1052 # define R128_TEX_DATATYPE_SHIFT 16
1053 # define R128_PALLETE_EITHER (0 << 20)
1054 # define R128_PALLETE_1 (1 << 20)
1055 # define R128_PALLETE_2 (2 << 20)
1056 # define R128_PSEUDOCOLOR_DT_RGB565 (0 << 24)
1057 # define R128_PSEUDOCOLOR_DT_ARGB1555 (1 << 24)
1058 # define R128_PSEUDOCOLOR_DT_ARGB4444 (2 << 24)
1060 #define R128_REG_PRIM_TEXTURE_COMBINE_CNTL_C 0x1cb4
1061 #define R128_REG_SEC_TEXTURE_COMBINE_CNTL_C 0x1d04
1062 # define R128_COMB_DIS (0 << 0)
1063 # define R128_COMB_COPY (1 << 0)
1064 # define R128_COMB_COPY_INP (2 << 0)
1065 # define R128_COMB_MODULATE (3 << 0)
1066 # define R128_COMB_MODULATE2X (4 << 0)
1067 # define R128_COMB_MODULATE4X (5 << 0)
1068 # define R128_COMB_ADD (6 << 0)
1069 # define R128_COMB_ADD_SIGNED (7 << 0)
1070 # define R128_COMB_BLEND_VERTEX (8 << 0)
1071 # define R128_COMB_BLEND_TEXTURE (9 << 0)
1072 # define R128_COMB_BLEND_CONST (10 << 0)
1073 # define R128_COMB_BLEND_PREMULT (11 << 0)
1074 # define R128_COMB_BLEND_PREV (12 << 0)
1075 # define R128_COMB_BLEND_PREMULT_INV (13 << 0)
1076 # define R128_COMB_ADD_SIGNED2X (14 << 0)
1077 # define R128_COMB_BLEND_CONST_COLOR (15 << 0)
1078 # define R128_COMB_MASK (15 << 0)
1079 # define R128_COLOR_FACTOR_CONST_COLOR (0 << 4)
1080 # define R128_COLOR_FACTOR_NCONST_COLOR (1 << 4)
1081 # define R128_COLOR_FACTOR_TEX (4 << 4)
1082 # define R128_COLOR_FACTOR_NTEX (5 << 4)
1083 # define R128_COLOR_FACTOR_ALPHA (6 << 4)
1084 # define R128_COLOR_FACTOR_NALPHA (7 << 4)
1085 # define R128_COLOR_FACTOR_PREV_COLOR (8 << 4)
1086 # define R128_COLOR_FACTOR_MASK (15 << 4)
1087 # define R128_COMB_FCN_MSB (1 << 8)
1088 # define R128_INPUT_FACTOR_CONST_COLOR (2 << 10)
1089 # define R128_INPUT_FACTOR_CONST_ALPHA (3 << 10)
1090 # define R128_INPUT_FACTOR_INT_COLOR (4 << 10)
1091 # define R128_INPUT_FACTOR_INT_ALPHA (5 << 10)
1092 # define R128_INPUT_FACTOR_PREV_COLOR (8 << 10) /* SEC only */
1093 # define R128_INPUT_FACTOR_PREV_ALPHA (9 << 10) /* SEC only */
1094 # define R128_INPUT_FACTOR_MASK (15 << 10)
1095 # define R128_COMB_ALPHA_DIS (0 << 14)
1096 # define R128_COMB_ALPHA_COPY (1 << 14)
1097 # define R128_COMB_ALPHA_COPY_INP (2 << 14)
1098 # define R128_COMB_ALPHA_MODULATE (3 << 14)
1099 # define R128_COMB_ALPHA_MODULATE2X (4 << 14)
1100 # define R128_COMB_ALPHA_MODULATE4X (5 << 14)
1101 # define R128_COMB_ALPHA_ADD (6 << 14)
1102 # define R128_COMB_ALPHA_ADD_SIGNED (7 << 14)
1103 # define R128_COMB_ALPHA_ADD_SIGNED2X (14 << 14)
1104 # define R128_COMB_ALPHA_MASK (15 << 14)
1105 # define R128_ALPHA_FACTOR_TEX_ALPHA (6 << 18)
1106 # define R128_ALPHA_FACTOR_NTEX_ALPHA (7 << 18)
1107 # define R128_ALPHA_FACTOR_MASK (15 << 18)
1108 # define R128_INP_FACTOR_A_CONST_ALPHA (1 << 25)
1109 # define R128_INP_FACTOR_A_INT_ALPHA (2 << 25)
1110 # define R128_INP_FACTOR_A_PREV_ALPHA (4 << 25) /* SEC only */
1111 # define R128_INP_FACTOR_A_MASK (7 << 25)
1113 #define R128_REG_TEX_SIZE_PITCH_C 0x1cb8
1114 # define R128_TEX_PITCH_SHIFT 0
1115 # define R128_TEX_SIZE_SHIFT 4
1116 # define R128_TEX_HEIGHT_SHIFT 8
1117 # define R128_TEX_MIN_SIZE_SHIFT 12
1118 # define R128_SEC_TEX_PITCH_SHIFT 16
1119 # define R128_SEC_TEX_SIZE_SHIFT 20
1120 # define R128_SEC_TEX_HEIGHT_SHIFT 24
1121 # define R128_SEC_TEX_MIN_SIZE_SHIFT 28
1122 # define R128_TEX_PITCH_MASK (0x0f << 0)
1123 # define R128_TEX_SIZE_MASK (0x0f << 4)
1124 # define R128_TEX_HEIGHT_MASK (0x0f << 8)
1125 # define R128_TEX_MIN_SIZE_MASK (0x0f << 12)
1126 # define R128_SEC_TEX_PITCH_MASK (0x0f << 16)
1127 # define R128_SEC_TEX_SIZE_MASK (0x0f << 20)
1128 # define R128_SEC_TEX_HEIGHT_MASK (0x0f << 24)
1129 # define R128_SEC_TEX_MIN_SIZE_MASK (0x0f << 28)
1130 # define R128_TEX_SIZE_PITCH_SHIFT 0
1131 # define R128_SEC_TEX_SIZE_PITCH_SHIFT 16
1132 # define R128_TEX_SIZE_PITCH_MASK (0xffff << 0)
1133 # define R128_SEC_TEX_SIZE_PITCH_MASK (0xffff << 16)
1135 #define R128_REG_PRIM_TEX_0_OFFSET_C 0x1cbc
1136 #define R128_REG_PRIM_TEX_1_OFFSET_C 0x1cc0
1137 #define R128_REG_PRIM_TEX_2_OFFSET_C 0x1cc4
1138 #define R128_REG_PRIM_TEX_3_OFFSET_C 0x1cc8
1139 #define R128_REG_PRIM_TEX_4_OFFSET_C 0x1ccc
1140 #define R128_REG_PRIM_TEX_5_OFFSET_C 0x1cd0
1141 #define R128_REG_PRIM_TEX_6_OFFSET_C 0x1cd4
1142 #define R128_REG_PRIM_TEX_7_OFFSET_C 0x1cd8
1143 #define R128_REG_PRIM_TEX_8_OFFSET_C 0x1cdc
1144 #define R128_REG_PRIM_TEX_9_OFFSET_C 0x1ce0
1145 #define R128_REG_PRIM_TEX_10_OFFSET_C 0x1ce4
1146 #define R128_REG_SEC_TEX_0_OFFSET_C 0x1d08
1147 #define R128_REG_SEC_TEX_1_OFFSET_C 0x1d0c
1148 #define R128_REG_SEC_TEX_2_OFFSET_C 0x1d10
1149 #define R128_REG_SEC_TEX_3_OFFSET_C 0x1d14
1150 #define R128_REG_SEC_TEX_4_OFFSET_C 0x1d18
1151 #define R128_REG_SEC_TEX_5_OFFSET_C 0x1d1c
1152 #define R128_REG_SEC_TEX_6_OFFSET_C 0x1d20
1153 #define R128_REG_SEC_TEX_7_OFFSET_C 0x1d24
1154 #define R128_REG_SEC_TEX_8_OFFSET_C 0x1d28
1155 #define R128_REG_SEC_TEX_9_OFFSET_C 0x1d2c
1156 #define R128_REG_SEC_TEX_10_OFFSET_C 0x1d30
1157 # define R128_TEX_NO_TILE (0 << 30)
1158 # define R128_TEX_TILED_BY_HOST (1 << 30)
1159 # define R128_TEX_TILED_BY_STORAGE (2 << 30)
1160 # define R128_TEX_TILED_BY_STORAGE2 (3 << 30)
1161 #define R128_REG_CONSTANT_COLOR_C 0x1d34
1162 # define R128_CONSTANT_BLUE_SHIFT 0
1163 # define R128_CONSTANT_GREEN_SHIFT 8
1164 # define R128_CONSTANT_RED_SHIFT 16
1165 # define R128_CONSTANT_ALPHA_SHIFT 24
1167 #define RADEON_REG_PP_TEX_SIZE_0 0x1d04 /* NPOT */
1168 #define RADEON_REG_PP_TEX_SIZE_1 0x1d0c /* NPOT */
1169 #define RADEON_REG_PP_TEX_SIZE_2 0x1d14 /* NPOT */
1170 # define RADEON_TEX_USIZE_MASK (0x7ff << 0)
1171 # define RADEON_TEX_USIZE_SHIFT 0
1172 # define RADEON_TEX_VSIZE_MASK (0x7ff << 16)
1173 # define RADEON_TEX_VSIZE_SHIFT 16
1174 # define RADEON_SIGNED_RGB_MASK (1 << 30)
1175 # define RADEON_SIGNED_RGB_SHIFT 30
1176 # define RADEON_SIGNED_ALPHA_MASK (1 << 31)
1177 # define RADEON_SIGNED_ALPHA_SHIFT 31
1179 #define RADEON_REG_PP_TEX_PITCH_0 0x1d08 /* NPOT */
1180 #define RADEON_REG_PP_TEX_PITCH_1 0x1d10 /* NPOT */
1181 #define RADEON_REG_PP_TEX_PITCH_2 0x1d18 /* NPOT */
1182 /* note: bits 13-5: 32 byte aligned stride of texture map */
1184 #define R128_REG_PLANE_3D_MASK_C 0x1d44
1186 #define RADEON_REG_RB3D_PLANEMASK 0x1d84
1188 #define R200_REG_SE_VAP_CNTL 0x2080
1189 # define R200_VAP_TCL_ENABLE 0x00000001
1190 # define R200_VAP_SINGLE_BUF_STATE_ENABLE 0x00000010
1191 # define R200_VAP_FORCE_W_TO_ONE 0x00010000
1192 # define R200_VAP_D3D_TEX_DEFAULT 0x00020000
1193 # define R200_VAP_VF_MAX_VTX_NUM__SHIFT 18
1194 # define R200_VAP_VF_MAX_VTX_NUM (9 << 18)
1195 # define R200_VAP_DX_CLIP_SPACE_DEF 0x00400000
1197 #define R200_REG_SE_VTX_FMT_0 0x2088
1198 # define R200_VTX_XY 0 /* always have xy */
1199 # define R200_VTX_Z0 (1 << 0)
1200 # define R200_VTX_W0 (1 << 1)
1201 # define R200_VTX_WEIGHT_COUNT_SHIFT (2)
1202 # define R200_VTX_PV_MATRIX_SEL (1 << 5)
1203 # define R200_VTX_N0 (1 << 6)
1204 # define R200_VTX_POINT_SIZE (1 << 7)
1205 # define R200_VTX_DISCRETE_FOG (1 << 8)
1206 # define R200_VTX_SHININESS_0 (1 << 9)
1207 # define R200_VTX_SHININESS_1 (1 << 10)
1208 # define R200_VTX_COLOR_NOT_PRESENT 0
1209 # define R200_VTX_PK_RGBA 1
1210 # define R200_VTX_FP_RGB 2
1211 # define R200_VTX_FP_RGBA 3
1212 # define R200_VTX_COLOR_MASK 3
1213 # define R200_VTX_COLOR_0_SHIFT 11
1214 # define R200_VTX_COLOR_1_SHIFT 13
1215 # define R200_VTX_COLOR_2_SHIFT 15
1216 # define R200_VTX_COLOR_3_SHIFT 17
1217 # define R200_VTX_COLOR_4_SHIFT 19
1218 # define R200_VTX_COLOR_5_SHIFT 21
1219 # define R200_VTX_COLOR_6_SHIFT 23
1220 # define R200_VTX_COLOR_7_SHIFT 25
1221 # define R200_VTX_XY1 (1 << 28)
1222 # define R200_VTX_Z1 (1 << 29)
1223 # define R200_VTX_W1 (1 << 30)
1224 # define R200_VTX_N1 (1 << 31)
1226 #define R200_REG_SE_VTX_FMT_1 0x208c
1227 # define R200_VTX_TEX0_COMP_CNT_SHIFT 0
1228 # define R200_VTX_TEX1_COMP_CNT_SHIFT 3
1229 # define R200_VTX_TEX2_COMP_CNT_SHIFT 6
1230 # define R200_VTX_TEX3_COMP_CNT_SHIFT 9
1231 # define R200_VTX_TEX4_COMP_CNT_SHIFT 12
1232 # define R200_VTX_TEX5_COMP_CNT_SHIFT 15
1234 #define R200_REG_SE_VTE_CNTL 0x20b0
1235 # define R200_VPORT_X_SCALE_ENA 0x00000001
1236 # define R200_VPORT_X_OFFSET_ENA 0x00000002
1237 # define R200_VPORT_Y_SCALE_ENA 0x00000004
1238 # define R200_VPORT_Y_OFFSET_ENA 0x00000008
1239 # define R200_VPORT_Z_SCALE_ENA 0x00000010
1240 # define R200_VPORT_Z_OFFSET_ENA 0x00000020
1241 # define R200_VTX_XY_FMT 0x00000100
1242 # define R200_VTX_Z_FMT 0x00000200
1243 # define R200_VTX_W0_FMT 0x00000400
1244 # define R200_VTX_W0_NORMALIZE 0x00000800
1245 # define R200_VTX_ST_DENORMALIZED 0x00001000
1247 #define R200_REG_SE_VAP_CNTL_STATUS 0x2140
1248 #define RADEON_REG_SE_CNTL_STATUS 0x2140
1249 # define RADEON_VC_NO_SWAP (0 << 0)
1250 # define RADEON_VC_16BIT_SWAP (1 << 0)
1251 # define RADEON_VC_32BIT_SWAP (2 << 0)
1252 # define RADEON_VC_HALF_DWORD_SWAP (3 << 0)
1253 # define RADEON_TCL_BYPASS (1 << 8)
1255 #define R200_REG_SE_VTX_STATE_CNTL 0x2180
1257 #define RADEON_REG_RE_TOP_LEFT 0x26c0
1259 #define R200_REG_RE_AUX_SCISSOR_CNTL 0x26f0
1261 #define R200_REG_PP_TXFILTER_0 0x2c00
1262 #define R200_REG_PP_TXFILTER_1 0x2c20
1263 #define R200_REG_PP_TXFILTER_2 0x2c40
1264 #define R200_REG_PP_TXFILTER_3 0x2c60
1265 #define R200_REG_PP_TXFILTER_4 0x2c80
1266 #define R200_REG_PP_TXFILTER_5 0x2ca0
1267 # define R200_MAG_FILTER_NEAREST (0 << 0)
1268 # define R200_MAG_FILTER_LINEAR (1 << 0)
1269 # define R200_MAG_FILTER_MASK (1 << 0)
1270 # define R200_MIN_FILTER_NEAREST (0 << 1)
1271 # define R200_MIN_FILTER_LINEAR (1 << 1)
1272 # define R200_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1)
1273 # define R200_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1)
1274 # define R200_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1)
1275 # define R200_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1)
1276 # define R200_MIN_FILTER_ANISO_NEAREST (8 << 1)
1277 # define R200_MIN_FILTER_ANISO_LINEAR (9 << 1)
1278 # define R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1)
1279 # define R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1)
1280 # define R200_MIN_FILTER_MASK (15 << 1)
1281 # define R200_MAX_ANISO_1_TO_1 (0 << 5)
1282 # define R200_MAX_ANISO_2_TO_1 (1 << 5)
1283 # define R200_MAX_ANISO_4_TO_1 (2 << 5)
1284 # define R200_MAX_ANISO_8_TO_1 (3 << 5)
1285 # define R200_MAX_ANISO_16_TO_1 (4 << 5)
1286 # define R200_MAX_ANISO_MASK (7 << 5)
1287 # define R200_MAX_MIP_LEVEL_MASK (0x0f << 16)
1288 # define R200_MAX_MIP_LEVEL_SHIFT 16
1289 # define R200_YUV_TO_RGB (1 << 20)
1290 # define R200_YUV_TEMPERATURE_COOL (0 << 21)
1291 # define R200_YUV_TEMPERATURE_HOT (1 << 21)
1292 # define R200_YUV_TEMPERATURE_MASK (1 << 21)
1293 # define R200_WRAPEN_S (1 << 22)
1294 # define R200_CLAMP_S_WRAP (0 << 23)
1295 # define R200_CLAMP_S_MIRROR (1 << 23)
1296 # define R200_CLAMP_S_CLAMP_LAST (2 << 23)
1297 # define R200_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23)
1298 # define R200_CLAMP_S_CLAMP_BORDER (4 << 23)
1299 # define R200_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23)
1300 # define R200_CLAMP_S_CLAMP_GL (6 << 23)
1301 # define R200_CLAMP_S_MIRROR_CLAMP_GL (7 << 23)
1302 # define R200_CLAMP_S_MASK (7 << 23)
1303 # define R200_WRAPEN_T (1 << 26)
1304 # define R200_CLAMP_T_WRAP (0 << 27)
1305 # define R200_CLAMP_T_MIRROR (1 << 27)
1306 # define R200_CLAMP_T_CLAMP_LAST (2 << 27)
1307 # define R200_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27)
1308 # define R200_CLAMP_T_CLAMP_BORDER (4 << 27)
1309 # define R200_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27)
1310 # define R200_CLAMP_T_CLAMP_GL (6 << 27)
1311 # define R200_CLAMP_T_MIRROR_CLAMP_GL (7 << 27)
1312 # define R200_CLAMP_T_MASK (7 << 27)
1313 # define R200_KILL_LT_ZERO (1 << 30)
1314 # define R200_BORDER_MODE_OGL (0 << 31)
1315 # define R200_BORDER_MODE_D3D (1 << 31)
1317 #define R200_REG_PP_TXFORMAT_0 0x2c04
1318 #define R200_REG_PP_TXFORMAT_1 0x2c24
1319 #define R200_REG_PP_TXFORMAT_2 0x2c44
1320 #define R200_REG_PP_TXFORMAT_3 0x2c64
1321 #define R200_REG_PP_TXFORMAT_4 0x2c84
1322 #define R200_REG_PP_TXFORMAT_5 0x2ca4
1323 # define R200_TXFORMAT_I8 (0 << 0)
1324 # define R200_TXFORMAT_AI88 (1 << 0)
1325 # define R200_TXFORMAT_RGB332 (2 << 0)
1326 # define R200_TXFORMAT_ARGB1555 (3 << 0)
1327 # define R200_TXFORMAT_RGB565 (4 << 0)
1328 # define R200_TXFORMAT_ARGB4444 (5 << 0)
1329 # define R200_TXFORMAT_ARGB8888 (6 << 0)
1330 # define R200_TXFORMAT_RGBA8888 (7 << 0)
1331 # define R200_TXFORMAT_Y8 (8 << 0)
1332 # define R200_TXFORMAT_AVYU4444 (9 << 0)
1333 # define R200_TXFORMAT_VYUY422 (10 << 0)
1334 # define R200_TXFORMAT_YVYU422 (11 << 0)
1335 # define R200_TXFORMAT_DXT1 (12 << 0)
1336 # define R200_TXFORMAT_DXT23 (14 << 0)
1337 # define R200_TXFORMAT_DXT45 (15 << 0)
1338 # define R200_TXFORMAT_FORMAT_MASK (31 << 0)
1339 # define R200_TXFORMAT_FORMAT_SHIFT 0
1340 # define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6)
1341 # define R200_TXFORMAT_NON_POWER2 (1 << 7)
1342 # define R200_TXFORMAT_WIDTH_MASK (15 << 8)
1343 # define R200_TXFORMAT_WIDTH_SHIFT 8
1344 # define R200_TXFORMAT_HEIGHT_MASK (15 << 12)
1345 # define R200_TXFORMAT_HEIGHT_SHIFT 12
1346 # define R200_TXFORMAT_F5_WIDTH_MASK (15 << 16) /* cube face 5 */
1347 # define R200_TXFORMAT_F5_WIDTH_SHIFT 16
1348 # define R200_TXFORMAT_F5_HEIGHT_MASK (15 << 20)
1349 # define R200_TXFORMAT_F5_HEIGHT_SHIFT 20
1350 # define R200_TXFORMAT_ST_ROUTE_STQ0 (0 << 24)
1351 # define R200_TXFORMAT_ST_ROUTE_STQ1 (1 << 24)
1352 # define R200_TXFORMAT_ST_ROUTE_STQ2 (2 << 24)
1353 # define R200_TXFORMAT_ST_ROUTE_STQ3 (3 << 24)
1354 # define R200_TXFORMAT_ST_ROUTE_STQ4 (4 << 24)
1355 # define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
1356 # define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
1357 # define R200_TXFORMAT_ST_ROUTE_SHIFT 24
1358 # define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
1359 # define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
1360 # define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
1362 #define R200_REG_PP_TXFORMAT_X_0 0x2c08
1363 #define R200_REG_PP_TXFORMAT_X_1 0x2c28
1364 #define R200_REG_PP_TXFORMAT_X_2 0x2c48
1365 #define R200_REG_PP_TXFORMAT_X_3 0x2c68
1366 #define R200_REG_PP_TXFORMAT_X_4 0x2c88
1367 #define R200_REG_PP_TXFORMAT_X_5 0x2ca8
1368 # define R200_DEPTH_LOG2_MASK (0xf << 0)
1369 # define R200_DEPTH_LOG2_SHIFT 0
1370 # define R200_VOLUME_FILTER_SHIFT 4
1371 # define R200_VOLUME_FILTER_MASK (1 << 4)
1372 # define R200_VOLUME_FILTER_NEAREST (0 << 4)
1373 # define R200_VOLUME_FILTER_LINEAR (1 << 4)
1374 # define R200_WRAPEN_Q (1 << 8)
1375 # define R200_CLAMP_Q_WRAP (0 << 9)
1376 # define R200_CLAMP_Q_MIRROR (1 << 9)
1377 # define R200_CLAMP_Q_CLAMP_LAST (2 << 9)
1378 # define R200_CLAMP_Q_MIRROR_CLAMP_LAST (3 << 9)
1379 # define R200_CLAMP_Q_CLAMP_BORDER (4 << 9)
1380 # define R200_CLAMP_Q_MIRROR_CLAMP_BORDER (5 << 9)
1381 # define R200_CLAMP_Q_CLAMP_GL (6 << 9)
1382 # define R200_CLAMP_Q_MIRROR_CLAMP_GL (7 << 9)
1383 # define R200_CLAMP_Q_MASK (7 << 9)
1384 # define R200_MIN_MIP_LEVEL_MASK (0xff << 12)
1385 # define R200_MIN_MIP_LEVEL_SHIFT 12
1386 # define R200_TEXCOORD_NONPROJ (0 << 16)
1387 # define R200_TEXCOORD_CUBIC_ENV (1 << 16)
1388 # define R200_TEXCOORD_VOLUME (2 << 16)
1389 # define R200_TEXCOORD_PROJ (3 << 16)
1390 # define R200_TEXCOORD_DEPTH (4 << 16)
1391 # define R200_TEXCOORD_1D_PROJ (5 << 16)
1392 # define R200_TEXCOORD_1D (6 << 16)
1393 # define R200_TEXCOORD_ZERO (7 << 16)
1394 # define R200_TEXCOORD_MASK (7 << 16)
1395 # define R200_LOD_BIAS_MASK (0xfff80000)
1396 # define R200_LOD_BIAS_SHIFT 19
1398 #define R200_REG_PP_TXSIZE_0 0x2c0c /* NPOT only */
1399 #define R200_REG_PP_TXSIZE_1 0x2c2c /* NPOT only */
1400 #define R200_REG_PP_TXSIZE_2 0x2c4c /* NPOT only */
1401 #define R200_REG_PP_TXSIZE_3 0x2c6c /* NPOT only */
1402 #define R200_REG_PP_TXSIZE_4 0x2c8c /* NPOT only */
1403 #define R200_REG_PP_TXSIZE_5 0x2cac /* NPOT only */
1405 #define R200_REG_PP_TXPITCH_0 0x2c10 /* NPOT only */
1406 #define R200_REG_PP_TXPITCH_1 0x2c30 /* NPOT only */
1407 #define R200_REG_PP_TXPITCH_2 0x2c50 /* NPOT only */
1408 #define R200_REG_PP_TXPITCH_3 0x2c70 /* NPOT only */
1409 #define R200_REG_PP_TXPITCH_4 0x2c90 /* NPOT only */
1410 #define R200_REG_PP_TXPITCH_5 0x2cb0 /* NPOT only */
1412 #define R200_REG_PP_BORDER_COLOR_0 0x2c14
1413 #define R200_REG_PP_TXMULTI_CTL_0 0x2c1c
1415 #define R200_REG_PP_CNTL_X 0x2cc4
1417 #define R200_PP_TXOFFSET_0 0x2d00
1418 #define R200_PP_TXOFFSET_1 0x2d18
1419 #define R200_PP_TXOFFSET_2 0x2d30
1420 #define R200_PP_TXOFFSET_3 0x2d48
1421 #define R200_PP_TXOFFSET_4 0x2d60
1422 #define R200_PP_TXOFFSET_5 0x2d78
1423 # define R200_TXO_ENDIAN_NO_SWAP (0 << 0)
1424 # define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0)
1425 # define R200_TXO_ENDIAN_WORD_SWAP (2 << 0)
1426 # define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
1427 # define R200_TXO_OFFSET_MASK 0xffffffe0
1428 # define R200_TXO_OFFSET_SHIFT 5
1430 #define R200_PP_CUBIC_OFFSET_F1_0 0x2d04
1431 #define R200_PP_CUBIC_OFFSET_F2_0 0x2d08
1432 #define R200_PP_CUBIC_OFFSET_F3_0 0x2d0c
1433 #define R200_PP_CUBIC_OFFSET_F4_0 0x2d10
1434 #define R200_PP_CUBIC_OFFSET_F5_0 0x2d14
1435 #define R200_PP_CUBIC_OFFSET_F1_1 0x2d1c
1436 #define R200_PP_CUBIC_OFFSET_F2_1 0x2d20
1437 #define R200_PP_CUBIC_OFFSET_F3_1 0x2d24
1438 #define R200_PP_CUBIC_OFFSET_F4_1 0x2d28
1439 #define R200_PP_CUBIC_OFFSET_F5_1 0x2d2c
1440 #define R200_PP_CUBIC_OFFSET_F1_2 0x2d34
1441 #define R200_PP_CUBIC_OFFSET_F2_2 0x2d38
1442 #define R200_PP_CUBIC_OFFSET_F3_2 0x2d3c
1443 #define R200_PP_CUBIC_OFFSET_F4_2 0x2d40
1444 #define R200_PP_CUBIC_OFFSET_F5_2 0x2d44
1445 #define R200_PP_CUBIC_OFFSET_F1_3 0x2d4c
1446 #define R200_PP_CUBIC_OFFSET_F2_3 0x2d50
1447 #define R200_PP_CUBIC_OFFSET_F3_3 0x2d54
1448 #define R200_PP_CUBIC_OFFSET_F4_3 0x2d58
1449 #define R200_PP_CUBIC_OFFSET_F5_3 0x2d5c
1450 #define R200_PP_CUBIC_OFFSET_F1_4 0x2d64
1451 #define R200_PP_CUBIC_OFFSET_F2_4 0x2d68
1452 #define R200_PP_CUBIC_OFFSET_F3_4 0x2d6c
1453 #define R200_PP_CUBIC_OFFSET_F4_4 0x2d70
1454 #define R200_PP_CUBIC_OFFSET_F5_4 0x2d74
1455 #define R200_PP_CUBIC_OFFSET_F1_5 0x2d7c
1456 #define R200_PP_CUBIC_OFFSET_F2_5 0x2d80
1457 #define R200_PP_CUBIC_OFFSET_F3_5 0x2d84
1458 #define R200_PP_CUBIC_OFFSET_F4_5 0x2d88
1459 #define R200_PP_CUBIC_OFFSET_F5_5 0x2d8c
1461 /* AKA PIXSHADER_I0_C0 */
1462 #define R200_REG_PP_TXCBLEND_0 0x2f00
1463 # define R200_TXC_ARG_A_ZERO (0)
1464 # define R200_TXC_ARG_A_CURRENT_COLOR (2)
1465 # define R200_TXC_ARG_A_CURRENT_ALPHA (3)
1466 # define R200_TXC_ARG_A_DIFFUSE_COLOR (4)
1467 # define R200_TXC_ARG_A_DIFFUSE_ALPHA (5)
1468 # define R200_TXC_ARG_A_SPECULAR_COLOR (6)
1469 # define R200_TXC_ARG_A_SPECULAR_ALPHA (7)
1470 # define R200_TXC_ARG_A_TFACTOR_COLOR (8)
1471 # define R200_TXC_ARG_A_TFACTOR_ALPHA (9)
1472 # define R200_TXC_ARG_A_R0_COLOR (10)
1473 # define R200_TXC_ARG_A_R0_ALPHA (11)
1474 # define R200_TXC_ARG_A_R1_COLOR (12)
1475 # define R200_TXC_ARG_A_R1_ALPHA (13)
1476 # define R200_TXC_ARG_A_R2_COLOR (14)
1477 # define R200_TXC_ARG_A_R2_ALPHA (15)
1478 # define R200_TXC_ARG_A_R3_COLOR (16)
1479 # define R200_TXC_ARG_A_R3_ALPHA (17)
1480 # define R200_TXC_ARG_A_R4_COLOR (18)
1481 # define R200_TXC_ARG_A_R4_ALPHA (19)
1482 # define R200_TXC_ARG_A_R5_COLOR (20)
1483 # define R200_TXC_ARG_A_R5_ALPHA (21)
1484 # define R200_TXC_ARG_A_TFACTOR1_COLOR (26)
1485 # define R200_TXC_ARG_A_TFACTOR1_ALPHA (27)
1486 # define R200_TXC_ARG_A_MASK (31 << 0)
1487 # define R200_TXC_ARG_A_SHIFT 0
1488 # define R200_TXC_ARG_B_ZERO (0 << 5)
1489 # define R200_TXC_ARG_B_CURRENT_COLOR (2 << 5)
1490 # define R200_TXC_ARG_B_CURRENT_ALPHA (3 << 5)
1491 # define R200_TXC_ARG_B_DIFFUSE_COLOR (4 << 5)
1492 # define R200_TXC_ARG_B_DIFFUSE_ALPHA (5 << 5)
1493 # define R200_TXC_ARG_B_SPECULAR_COLOR (6 << 5)
1494 # define R200_TXC_ARG_B_SPECULAR_ALPHA (7 << 5)
1495 # define R200_TXC_ARG_B_TFACTOR_COLOR (8 << 5)
1496 # define R200_TXC_ARG_B_TFACTOR_ALPHA (9 << 5)
1497 # define R200_TXC_ARG_B_R0_COLOR (10 << 5)
1498 # define R200_TXC_ARG_B_R0_ALPHA (11 << 5)
1499 # define R200_TXC_ARG_B_R1_COLOR (12 << 5)
1500 # define R200_TXC_ARG_B_R1_ALPHA (13 << 5)
1501 # define R200_TXC_ARG_B_R2_COLOR (14 << 5)
1502 # define R200_TXC_ARG_B_R2_ALPHA (15 << 5)
1503 # define R200_TXC_ARG_B_R3_COLOR (16 << 5)
1504 # define R200_TXC_ARG_B_R3_ALPHA (17 << 5)
1505 # define R200_TXC_ARG_B_R4_COLOR (18 << 5)
1506 # define R200_TXC_ARG_B_R4_ALPHA (19 << 5)
1507 # define R200_TXC_ARG_B_R5_COLOR (20 << 5)
1508 # define R200_TXC_ARG_B_R5_ALPHA (21 << 5)
1509 # define R200_TXC_ARG_B_TFACTOR1_COLOR (26 << 5)
1510 # define R200_TXC_ARG_B_TFACTOR1_ALPHA (27 << 5)
1511 # define R200_TXC_ARG_B_MASK (31 << 5)
1512 # define R200_TXC_ARG_B_SHIFT 5
1513 # define R200_TXC_ARG_C_ZERO (0 << 10)
1514 # define R200_TXC_ARG_C_CURRENT_COLOR (2 << 10)
1515 # define R200_TXC_ARG_C_CURRENT_ALPHA (3 << 10)
1516 # define R200_TXC_ARG_C_DIFFUSE_COLOR (4 << 10)
1517 # define R200_TXC_ARG_C_DIFFUSE_ALPHA (5 << 10)
1518 # define R200_TXC_ARG_C_SPECULAR_COLOR (6 << 10)
1519 # define R200_TXC_ARG_C_SPECULAR_ALPHA (7 << 10)
1520 # define R200_TXC_ARG_C_TFACTOR_COLOR (8 << 10)
1521 # define R200_TXC_ARG_C_TFACTOR_ALPHA (9 << 10)
1522 # define R200_TXC_ARG_C_R0_COLOR (10 << 10)
1523 # define R200_TXC_ARG_C_R0_ALPHA (11 << 10)
1524 # define R200_TXC_ARG_C_R1_COLOR (12 << 10)
1525 # define R200_TXC_ARG_C_R1_ALPHA (13 << 10)
1526 # define R200_TXC_ARG_C_R2_COLOR (14 << 10)
1527 # define R200_TXC_ARG_C_R2_ALPHA (15 << 10)
1528 # define R200_TXC_ARG_C_R3_COLOR (16 << 10)
1529 # define R200_TXC_ARG_C_R3_ALPHA (17 << 10)
1530 # define R200_TXC_ARG_C_R4_COLOR (18 << 10)
1531 # define R200_TXC_ARG_C_R4_ALPHA (19 << 10)
1532 # define R200_TXC_ARG_C_R5_COLOR (20 << 10)
1533 # define R200_TXC_ARG_C_R5_ALPHA (21 << 10)
1534 # define R200_TXC_ARG_C_TFACTOR1_COLOR (26 << 10)
1535 # define R200_TXC_ARG_C_TFACTOR1_ALPHA (27 << 10)
1536 # define R200_TXC_ARG_C_MASK (31 << 10)
1537 # define R200_TXC_ARG_C_SHIFT 10
1538 # define R200_TXC_COMP_ARG_A (1 << 16)
1539 # define R200_TXC_COMP_ARG_A_SHIFT (16)
1540 # define R200_TXC_BIAS_ARG_A (1 << 17)
1541 # define R200_TXC_SCALE_ARG_A (1 << 18)
1542 # define R200_TXC_NEG_ARG_A (1 << 19)
1543 # define R200_TXC_COMP_ARG_B (1 << 20)
1544 # define R200_TXC_COMP_ARG_B_SHIFT (20)
1545 # define R200_TXC_BIAS_ARG_B (1 << 21)
1546 # define R200_TXC_SCALE_ARG_B (1 << 22)
1547 # define R200_TXC_NEG_ARG_B (1 << 23)
1548 # define R200_TXC_COMP_ARG_C (1 << 24)
1549 # define R200_TXC_COMP_ARG_C_SHIFT (24)
1550 # define R200_TXC_BIAS_ARG_C (1 << 25)
1551 # define R200_TXC_SCALE_ARG_C (1 << 26)
1552 # define R200_TXC_NEG_ARG_C (1 << 27)
1553 # define R200_TXC_OP_MADD (0 << 28)
1554 # define R200_TXC_OP_CND0 (2 << 28)
1555 # define R200_TXC_OP_LERP (3 << 28)
1556 # define R200_TXC_OP_DOT3 (4 << 28)
1557 # define R200_TXC_OP_DOT4 (5 << 28)
1558 # define R200_TXC_OP_CONDITIONAL (6 << 28)
1559 # define R200_TXC_OP_DOT2_ADD (7 << 28)
1560 # define R200_TXC_OP_MASK (7 << 28)
1562 /* AKA PIXSHADER_I0_C1 */
1563 #define R200_REG_PP_TXCBLEND2_0 0x2f04
1564 # define R200_TXC_TFACTOR_SEL_SHIFT 0
1565 # define R200_TXC_TFACTOR_SEL_MASK 0x7
1566 # define R200_TXC_TFACTOR1_SEL_SHIFT 4
1567 # define R200_TXC_TFACTOR1_SEL_MASK (0x7 << 4)
1568 # define R200_TXC_SCALE_SHIFT 8
1569 # define R200_TXC_SCALE_MASK (7 << 8)
1570 # define R200_TXC_SCALE_1X (0 << 8)
1571 # define R200_TXC_SCALE_2X (1 << 8)
1572 # define R200_TXC_SCALE_4X (2 << 8)
1573 # define R200_TXC_SCALE_8X (3 << 8)
1574 # define R200_TXC_SCALE_INV2 (5 << 8)
1575 # define R200_TXC_SCALE_INV4 (6 << 8)
1576 # define R200_TXC_SCALE_INV8 (7 << 8)
1577 # define R200_TXC_CLAMP_SHIFT 12
1578 # define R200_TXC_CLAMP_MASK (3 << 12)
1579 # define R200_TXC_CLAMP_WRAP (0 << 12)
1580 # define R200_TXC_CLAMP_0_1 (1 << 12)
1581 # define R200_TXC_CLAMP_8_8 (2 << 12)
1582 # define R200_TXC_OUTPUT_REG_MASK (7 << 16)
1583 # define R200_TXC_OUTPUT_REG_NONE (0 << 16)
1584 # define R200_TXC_OUTPUT_REG_R0 (1 << 16)
1585 # define R200_TXC_OUTPUT_REG_R1 (2 << 16)
1586 # define R200_TXC_OUTPUT_REG_R2 (3 << 16)
1587 # define R200_TXC_OUTPUT_REG_R3 (4 << 16)
1588 # define R200_TXC_OUTPUT_REG_R4 (5 << 16)
1589 # define R200_TXC_OUTPUT_REG_R5 (6 << 16)
1590 # define R200_TXC_OUTPUT_MASK_MASK (7 << 20)
1591 # define R200_TXC_OUTPUT_MASK_RGB (0 << 20)
1592 # define R200_TXC_OUTPUT_MASK_RG (1 << 20)
1593 # define R200_TXC_OUTPUT_MASK_RB (2 << 20)
1594 # define R200_TXC_OUTPUT_MASK_R (3 << 20)
1595 # define R200_TXC_OUTPUT_MASK_GB (4 << 20)
1596 # define R200_TXC_OUTPUT_MASK_G (5 << 20)
1597 # define R200_TXC_OUTPUT_MASK_B (6 << 20)
1598 # define R200_TXC_OUTPUT_MASK_NONE (7 << 20)
1599 # define R200_TXC_REPL_NORMAL 0
1600 # define R200_TXC_REPL_RED 1
1601 # define R200_TXC_REPL_GREEN 2
1602 # define R200_TXC_REPL_BLUE 3
1603 # define R200_TXC_REPL_ARG_A_SHIFT 26
1604 # define R200_TXC_REPL_ARG_A_MASK (3 << 26)
1605 # define R200_TXC_REPL_ARG_B_SHIFT 28
1606 # define R200_TXC_REPL_ARG_B_MASK (3 << 28)
1607 # define R200_TXC_REPL_ARG_C_SHIFT 30
1608 # define R200_TXC_REPL_ARG_C_MASK (3 << 30)
1610 /* AKA PIXSHADER_I0_A0 */
1611 #define R200_REG_PP_TXABLEND_0 0x2f08
1612 # define R200_TXA_ARG_A_ZERO (0)
1613 # define R200_TXA_ARG_A_CURRENT_ALPHA (2) /* guess */
1614 # define R200_TXA_ARG_A_CURRENT_BLUE (3) /* guess */
1615 # define R200_TXA_ARG_A_DIFFUSE_ALPHA (4)
1616 # define R200_TXA_ARG_A_DIFFUSE_BLUE (5)
1617 # define R200_TXA_ARG_A_SPECULAR_ALPHA (6)
1618 # define R200_TXA_ARG_A_SPECULAR_BLUE (7)
1619 # define R200_TXA_ARG_A_TFACTOR_ALPHA (8)
1620 # define R200_TXA_ARG_A_TFACTOR_BLUE (9)
1621 # define R200_TXA_ARG_A_R0_ALPHA (10)
1622 # define R200_TXA_ARG_A_R0_BLUE (11)
1623 # define R200_TXA_ARG_A_R1_ALPHA (12)
1624 # define R200_TXA_ARG_A_R1_BLUE (13)
1625 # define R200_TXA_ARG_A_R2_ALPHA (14)
1626 # define R200_TXA_ARG_A_R2_BLUE (15)
1627 # define R200_TXA_ARG_A_R3_ALPHA (16)
1628 # define R200_TXA_ARG_A_R3_BLUE (17)
1629 # define R200_TXA_ARG_A_R4_ALPHA (18)
1630 # define R200_TXA_ARG_A_R4_BLUE (19)
1631 # define R200_TXA_ARG_A_R5_ALPHA (20)
1632 # define R200_TXA_ARG_A_R5_BLUE (21)
1633 # define R200_TXA_ARG_A_TFACTOR1_ALPHA (26)
1634 # define R200_TXA_ARG_A_TFACTOR1_BLUE (27)
1635 # define R200_TXA_ARG_A_MASK (31 << 0)
1636 # define R200_TXA_ARG_A_SHIFT 0
1637 # define R200_TXA_ARG_B_ZERO (0 << 5)
1638 # define R200_TXA_ARG_B_CURRENT_ALPHA (2 << 5) /* guess */
1639 # define R200_TXA_ARG_B_CURRENT_BLUE (3 << 5) /* guess */
1640 # define R200_TXA_ARG_B_DIFFUSE_ALPHA (4 << 5)
1641 # define R200_TXA_ARG_B_DIFFUSE_BLUE (5 << 5)
1642 # define R200_TXA_ARG_B_SPECULAR_ALPHA (6 << 5)
1643 # define R200_TXA_ARG_B_SPECULAR_BLUE (7 << 5)
1644 # define R200_TXA_ARG_B_TFACTOR_ALPHA (8 << 5)
1645 # define R200_TXA_ARG_B_TFACTOR_BLUE (9 << 5)
1646 # define R200_TXA_ARG_B_R0_ALPHA (10 << 5)
1647 # define R200_TXA_ARG_B_R0_BLUE (11 << 5)
1648 # define R200_TXA_ARG_B_R1_ALPHA (12 << 5)
1649 # define R200_TXA_ARG_B_R1_BLUE (13 << 5)
1650 # define R200_TXA_ARG_B_R2_ALPHA (14 << 5)
1651 # define R200_TXA_ARG_B_R2_BLUE (15 << 5)
1652 # define R200_TXA_ARG_B_R3_ALPHA (16 << 5)
1653 # define R200_TXA_ARG_B_R3_BLUE (17 << 5)
1654 # define R200_TXA_ARG_B_R4_ALPHA (18 << 5)
1655 # define R200_TXA_ARG_B_R4_BLUE (19 << 5)
1656 # define R200_TXA_ARG_B_R5_ALPHA (20 << 5)
1657 # define R200_TXA_ARG_B_R5_BLUE (21 << 5)
1658 # define R200_TXA_ARG_B_TFACTOR1_ALPHA (26 << 5)
1659 # define R200_TXA_ARG_B_TFACTOR1_BLUE (27 << 5)
1660 # define R200_TXA_ARG_B_MASK (31 << 5)
1661 # define R200_TXA_ARG_B_SHIFT 5
1662 # define R200_TXA_ARG_C_ZERO (0 << 10)
1663 # define R200_TXA_ARG_C_CURRENT_ALPHA (2 << 10) /* guess */
1664 # define R200_TXA_ARG_C_CURRENT_BLUE (3 << 10) /* guess */
1665 # define R200_TXA_ARG_C_DIFFUSE_ALPHA (4 << 10)
1666 # define R200_TXA_ARG_C_DIFFUSE_BLUE (5 << 10)
1667 # define R200_TXA_ARG_C_SPECULAR_ALPHA (6 << 10)
1668 # define R200_TXA_ARG_C_SPECULAR_BLUE (7 << 10)
1669 # define R200_TXA_ARG_C_TFACTOR_ALPHA (8 << 10)
1670 # define R200_TXA_ARG_C_TFACTOR_BLUE (9 << 10)
1671 # define R200_TXA_ARG_C_R0_ALPHA (10 << 10)
1672 # define R200_TXA_ARG_C_R0_BLUE (11 << 10)
1673 # define R200_TXA_ARG_C_R1_ALPHA (12 << 10)
1674 # define R200_TXA_ARG_C_R1_BLUE (13 << 10)
1675 # define R200_TXA_ARG_C_R2_ALPHA (14 << 10)
1676 # define R200_TXA_ARG_C_R2_BLUE (15 << 10)
1677 # define R200_TXA_ARG_C_R3_ALPHA (16 << 10)
1678 # define R200_TXA_ARG_C_R3_BLUE (17 << 10)
1679 # define R200_TXA_ARG_C_R4_ALPHA (18 << 10)
1680 # define R200_TXA_ARG_C_R4_BLUE (19 << 10)
1681 # define R200_TXA_ARG_C_R5_ALPHA (20 << 10)
1682 # define R200_TXA_ARG_C_R5_BLUE (21 << 10)
1683 # define R200_TXA_ARG_C_TFACTOR1_ALPHA (26 << 10)
1684 # define R200_TXA_ARG_C_TFACTOR1_BLUE (27 << 10)
1685 # define R200_TXA_ARG_C_MASK (31 << 10)
1686 # define R200_TXA_ARG_C_SHIFT 10
1687 # define R200_TXA_COMP_ARG_A (1 << 16)
1688 # define R200_TXA_COMP_ARG_A_SHIFT (16)
1689 # define R200_TXA_BIAS_ARG_A (1 << 17)
1690 # define R200_TXA_SCALE_ARG_A (1 << 18)
1691 # define R200_TXA_NEG_ARG_A (1 << 19)
1692 # define R200_TXA_COMP_ARG_B (1 << 20)
1693 # define R200_TXA_COMP_ARG_B_SHIFT (20)
1694 # define R200_TXA_BIAS_ARG_B (1 << 21)
1695 # define R200_TXA_SCALE_ARG_B (1 << 22)
1696 # define R200_TXA_NEG_ARG_B (1 << 23)
1697 # define R200_TXA_COMP_ARG_C (1 << 24)
1698 # define R200_TXA_COMP_ARG_C_SHIFT (24)
1699 # define R200_TXA_BIAS_ARG_C (1 << 25)
1700 # define R200_TXA_SCALE_ARG_C (1 << 26)
1701 # define R200_TXA_NEG_ARG_C (1 << 27)
1702 # define R200_TXA_OP_MADD (0 << 28)
1703 # define R200_TXA_OP_CND0 (2 << 28)
1704 # define R200_TXA_OP_LERP (3 << 28)
1705 # define R200_TXA_OP_CONDITIONAL (6 << 28)
1706 # define R200_TXA_OP_MASK (7 << 28)
1708 /* AKA PIXSHADER_I0_A1 */
1709 #define R200_REG_PP_TXABLEND2_0 0x2f0c
1710 # define R200_TXA_TFACTOR_SEL_SHIFT 0
1711 # define R200_TXA_TFACTOR_SEL_MASK 0x7
1712 # define R200_TXA_TFACTOR1_SEL_SHIFT 4
1713 # define R200_TXA_TFACTOR1_SEL_MASK (0x7 << 4)
1714 # define R200_TXA_SCALE_SHIFT 8
1715 # define R200_TXA_SCALE_MASK (7 << 8)
1716 # define R200_TXA_SCALE_1X (0 << 8)
1717 # define R200_TXA_SCALE_2X (1 << 8)
1718 # define R200_TXA_SCALE_4X (2 << 8)
1719 # define R200_TXA_SCALE_8X (3 << 8)
1720 # define R200_TXA_SCALE_INV2 (5 << 8)
1721 # define R200_TXA_SCALE_INV4 (6 << 8)
1722 # define R200_TXA_SCALE_INV8 (7 << 8)
1723 # define R200_TXA_CLAMP_SHIFT 12
1724 # define R200_TXA_CLAMP_MASK (3 << 12)
1725 # define R200_TXA_CLAMP_WRAP (0 << 12)
1726 # define R200_TXA_CLAMP_0_1 (1 << 12)
1727 # define R200_TXA_CLAMP_8_8 (2 << 12)
1728 # define R200_TXA_OUTPUT_REG_MASK (7 << 16)
1729 # define R200_TXA_OUTPUT_REG_NONE (0 << 16)
1730 # define R200_TXA_OUTPUT_REG_R0 (1 << 16)
1731 # define R200_TXA_OUTPUT_REG_R1 (2 << 16)
1732 # define R200_TXA_OUTPUT_REG_R2 (3 << 16)
1733 # define R200_TXA_OUTPUT_REG_R3 (4 << 16)
1734 # define R200_TXA_OUTPUT_REG_R4 (5 << 16)
1735 # define R200_TXA_OUTPUT_REG_R5 (6 << 16)
1736 # define R200_TXA_DOT_ALPHA (1 << 20)
1737 # define R200_TXA_REPL_NORMAL 0
1738 # define R200_TXA_REPL_RED 1
1739 # define R200_TXA_REPL_GREEN 2
1740 # define R200_TXA_REPL_ARG_A_SHIFT 26
1741 # define R200_TXA_REPL_ARG_A_MASK (3 << 26)
1742 # define R200_TXA_REPL_ARG_B_SHIFT 28
1743 # define R200_TXA_REPL_ARG_B_MASK (3 << 28)
1744 # define R200_TXA_REPL_ARG_C_SHIFT 30
1745 # define R200_TXA_REPL_ARG_C_MASK (3 << 30)
1747 #define RADEON_REG_RB2D_DSTCACHE_MODE 0x3428
1748 /* This is a read-only mirror of RADEON_REG_RB3D_DSTCACHE_MODE */
1750 #define RADEON_REG_RB2D_DSTCACHE_CTLSTAT 0x342C
1751 /* This is a read-only mirror of RADEON_REG_RB3D_DSTCACHE_CTLSTAT */
1753 #define RADEON_REG_RB3D_DSTCACHE_MODE 0x3258
1754 # define RADEON_RB3D_DC_CACHE_ENABLE (0)
1755 # define RADEON_RB3D_DC_2D_CACHE_DISABLE (1)
1756 # define RADEON_RB3D_DC_3D_CACHE_DISABLE (2)
1757 # define RADEON_RB3D_DC_CACHE_DISABLE (3)
1758 # define RADEON_RB3D_DC_2D_CACHE_LINESIZE_128 (1 << 2)
1759 # define RADEON_RB3D_DC_3D_CACHE_LINESIZE_128 (2 << 2)
1760 # define RADEON_RB3D_DC_2D_CACHE_AUTOFLUSH (1 << 8)
1761 # define RADEON_RB3D_DC_3D_CACHE_AUTOFLUSH (2 << 8)
1762 # define R200_RB3D_DC_2D_CACHE_AUTOFREE (1 << 10)
1763 # define R200_RB3D_DC_3D_CACHE_AUTOFREE (2 << 10)
1764 # define RADEON_RB3D_DC_FORCE_RMW (1 << 16)
1765 # define RADEON_RB3D_DC_DISABLE_RI_FILL (1 << 24)
1766 # define RADEON_RB3D_DC_DISABLE_RI_READ (1 << 25)
1767 # define RADEON_RB3D_DC_DISABLE_MASK_CHK (1 << 26)
1769 #define RADEON_REG_RB3D_DSTCACHE_CTLSTAT 0x325C
1770 # define RADEON_RB3D_DC_FLUSH (3 << 0)
1771 # define RADEON_RB3D_DC_FREE (3 << 2)
1772 # define RADEON_RB3D_DC_FLUSH_ALL 0xf
1773 # define RADEON_RB3D_DC_BUSY (1 << 31)
1775 /* PLL register defines */
1776 #define R128_REG_MCLK_CNTL 0x000f
1777 # define R128_FORCE_GCP (1 << 16)
1778 # define R128_FORCE_PIPE3D_CP (1 << 17)
1779 # define R128_FORCE_RCP (1 << 18)
1780 #define RADEON_REG_MCLK_CNTL 0x0012
1781 # define RADEON_FORCEON_MCLKA (1 << 16)
1782 # define RADEON_FORCEON_MCLKB (1 << 17)
1783 # define RADEON_FORCEON_YCLKA (1 << 18)
1784 # define RADEON_FORCEON_YCLKB (1 << 19)
1785 # define RADEON_FORCEON_MC (1 << 20)
1786 # define RADEON_FORCEON_AIC (1 << 21)
1788 /* CCE packet defines */
1790 #define ATI_CCE_PACKETTYPE_MASK 0xc0000000
1791 #define ATI_CCE_PACKET0 0x00000000
1792 #define ATI_CCE_PACKET0_COUNT_MASK 0x3fff0000
1793 #define ATI_CCE_PACKET0_ONE_REG_WR 0x00008000
1794 #define ATI_CCE_PACKET0_REG_MASK 0x000007ff
1795 #define ATI_CCE_PACKET1 0x40000000
1796 #define ATI_CCE_PACKET1_REG_1 0x000007ff
1797 #define ATI_CCE_PACKET1_REG_2 0x003ff800
1798 #define ATI_CCE_PACKET1_REG_2_SHIFT 10
1799 #define ATI_CCE_PACKET2 0x80000000
1800 #define ATI_CCE_PACKET3 0xc0000000
1801 #define ATI_CCE_PACKET3_COUNT_MASK 0x3fff0000
1802 #define ATI_CCE_PACKET3_IT_OPCODE_MASK 0x0000ff00
1803 #define ATI_CCE_PACKET3_NOP 0xc0001000
1804 #define ATI_CCE_PACKET3_NEXT_CHAR 0xc0001900
1805 #define ATI_CCE_PACKET3_PLY_NEXTSCAN 0xc0001d00
1806 #define ATI_CCE_PACKET3_SET_SCISSORS 0xc0001e00
1807 #define R128_CCE_PACKET3_SET_MODE_24BPP 0xc0001f00
1808 #define R128_CCE_PACKET3_3D_SAVE_CONTEXT 0xc0002000
1809 #define R128_CCE_PACKET3_3D_PLAY_CONTEXT 0xc0002100
1810 #define ATI_CCE_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xc0002300
1811 #define RADEON_CP_PACKET3_LOAD_MICROCODE 0xc0002400
1812 #define ATI_CCE_PACKET3_3D_RNDR_GEN_PRIM 0xc0002500
1813 #define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xc0002600
1814 #define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xc0002800
1815 #define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xc0002900
1816 #define RADEON_CP_PACKET3_3D_DRAW_INDX 0xc0002a00
1817 #define ATI_CCE_PACKET3_LOAD_PALETTE 0xc0002c00
1818 #define R128_CCE_PACKET3_PURGE 0xc0002d00
1819 #define R128_CCE_PACKET3_NEXT_VERTEX_BUNDLE 0xc0002e00
1820 #define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xc0002f00
1821 #define RADEON_CP_PACKET3_3D_CLEAR_ZMASK 0xc0003200
1822 #define R200_CP_PACKET3_3D_DRAW_IMMD_2 0xc0003500
1823 #define ATI_CCE_PACKET3_CNTL_PAINT 0xc0009100
1824 #define ATI_CCE_PACKET3_CNTL_BITBLT 0xc0009200
1825 #define ATI_CCE_PACKET3_CNTL_SMALLTEXT 0xc0009300
1826 #define ATI_CCE_PACKET3_HOSTDATA_BLT 0xc0009400
1827 #define ATI_CCE_PACKET3_CNTL_POLYLINE 0xc0009500
1828 #define R128_CCE_PACKET3_SCALE 0xc0009600
1829 #define R128_CCE_PACKET3_TRANS_SCALE 0xc0009700
1830 #define ATI_CCE_PACKET3_CNTL_POLYSCANLINES 0xc0009800
1831 #define ATI_CCE_PACKET3_PAINT_MULTI 0xc0009a00
1832 #define ATI_CCE_PACKET3_BITBLT_MULTI 0xc0009b00
1833 #define ATI_CCE_PACKET3_CNTL_TRANS_BITBLT 0xc0009c00
1835 #define RADEON_CP_VC_FRMT_XY 0x00000000
1836 #define RADEON_CP_VC_FRMT_W0 0x00000001
1837 #define RADEON_CP_VC_FRMT_FPCOLOR 0x00000002
1838 #define RADEON_CP_VC_FRMT_FPALPHA 0x00000004
1839 #define RADEON_CP_VC_FRMT_PKCOLOR 0x00000008
1840 #define RADEON_CP_VC_FRMT_FPSPEC 0x00000010
1841 #define RADEON_CP_VC_FRMT_FPFOG 0x00000020
1842 #define RADEON_CP_VC_FRMT_PKSPEC 0x00000040
1843 #define RADEON_CP_VC_FRMT_ST0 0x00000080
1844 #define RADEON_CP_VC_FRMT_ST1 0x00000100
1845 #define RADEON_CP_VC_FRMT_Q1 0x00000200
1846 #define RADEON_CP_VC_FRMT_ST2 0x00000400
1847 #define RADEON_CP_VC_FRMT_Q2 0x00000800
1848 #define RADEON_CP_VC_FRMT_ST3 0x00001000
1849 #define RADEON_CP_VC_FRMT_Q3 0x00002000
1850 #define RADEON_CP_VC_FRMT_Q0 0x00004000
1851 #define RADEON_CP_VC_FRMT_BLND_WEIGHT_CNT_MASK 0x00038000
1852 #define RADEON_CP_VC_FRMT_N0 0x00040000
1853 #define RADEON_CP_VC_FRMT_XY1 0x08000000
1854 #define RADEON_CP_VC_FRMT_Z1 0x10000000
1855 #define RADEON_CP_VC_FRMT_W1 0x20000000
1856 #define RADEON_CP_VC_FRMT_N1 0x40000000
1857 #define RADEON_CP_VC_FRMT_Z 0x80000000
1859 #define RADEON_CP_VC_CNTL_PRIM_TYPE_NONE 0x00000000
1860 #define RADEON_CP_VC_CNTL_PRIM_TYPE_POINT 0x00000001
1861 #define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE 0x00000002
1862 #define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP 0x00000003
1863 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004
1864 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005
1865 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006
1866 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE_2 0x00000007
1867 #define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST 0x00000008
1868 #define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009
1869 #define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST 0x0000000a
1870 #define RADEON_CP_VC_CNTL_PRIM_WALK_IND 0x00000010
1871 #define RADEON_CP_VC_CNTL_PRIM_WALK_LIST 0x00000020
1872 #define RADEON_CP_VC_CNTL_PRIM_WALK_RING 0x00000030
1873 #define RADEON_CP_VC_CNTL_COLOR_ORDER_BGRA 0x00000000
1874 #define RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA 0x00000040
1875 #define RADEON_CP_VC_CNTL_MAOS_ENABLE 0x00000080
1876 #define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE 0x00000000
1877 #define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE 0x00000100
1878 #define RADEON_CP_VC_CNTL_TCL_DISABLE 0x00000000
1879 #define RADEON_CP_VC_CNTL_TCL_ENABLE 0x00000200
1880 #define RADEON_CP_VC_CNTL_NUM_SHIFT 16
1882 #define R128_CCE_VC_FRMT_RHW 0x00000001
1883 #define R128_CCE_VC_FRMT_DIFFUSE_BGR 0x00000002
1884 #define R128_CCE_VC_FRMT_DIFFUSE_A 0x00000004
1885 #define R128_CCE_VC_FRMT_DIFFUSE_ARGB 0x00000008
1886 #define R128_CCE_VC_FRMT_SPEC_BGR 0x00000010
1887 #define R128_CCE_VC_FRMT_SPEC_F 0x00000020
1888 #define R128_CCE_VC_FRMT_SPEC_FRGB 0x00000040
1889 #define R128_CCE_VC_FRMT_S_T 0x00000080
1890 #define R128_CCE_VC_FRMT_S2_T2 0x00000100
1891 #define R128_CCE_VC_FRMT_RHW2 0x00000200
1893 #define R128_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000
1894 #define R128_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001
1895 #define R128_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002
1896 #define R128_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003
1897 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004
1898 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005
1899 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006
1900 #define R128_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007
1901 #define R128_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010
1902 #define R128_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020
1903 #define R128_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030
1904 #define R128_CCE_VC_CNTL_NUM_SHIFT 16
1906 #define R128_DATATYPE_VQ 0
1907 #define R128_DATATYPE_CI4 1
1908 #define R128_DATATYPE_CI8 2
1909 #define R128_DATATYPE_ARGB1555 3
1910 #define R128_DATATYPE_RGB565 4
1911 #define R128_DATATYPE_RGB888 5
1912 #define R128_DATATYPE_ARGB8888 6
1913 #define R128_DATATYPE_RGB332 7
1914 #define R128_DATATYPE_Y8 8
1915 #define R128_DATATYPE_RGB8 9
1916 #define R128_DATATYPE_CI16 10
1917 #define R128_DATATYPE_VYUY_422 11
1918 #define R128_DATATYPE_YVYU_422 12
1919 #define R128_DATATYPE_AYUV_444 14
1920 #define R128_DATATYPE_ARGB4444 15
1922 #define R128_AGP_OFFSET 0x02000000
1924 #define R128_WATERMARK_L 16
1925 #define R128_WATERMARK_M 8
1926 #define R128_WATERMARK_N 8
1927 #define R128_WATERMARK_K 128