xref: /haiku/headers/private/graphics/radeon/3d_regs.h (revision 893988af824e65e49e55f517b157db8386e8002b)
1 /*
2 	Copyright (c) 2002, Thomas Kurschel
3 
4 
5 	Part of Radeon driver
6 
7 	3D registers
8 */
9 
10 
11 #ifndef _3D_REGS_H
12 #define _3D_REGS_H
13 
14 
15 #define RADEON_PP_BORDER_COLOR_0            0x1d40
16 #define RADEON_PP_BORDER_COLOR_1            0x1d44
17 #define RADEON_PP_BORDER_COLOR_2            0x1d48
18 #define RADEON_PP_CNTL                      0x1c38
19 #       define RADEON_STIPPLE_ENABLE        (1 <<  0)
20 #       define RADEON_SCISSOR_ENABLE        (1 <<  1)
21 #       define RADEON_PATTERN_ENABLE        (1 <<  2)
22 #       define RADEON_SHADOW_ENABLE         (1 <<  3)
23 #       define RADEON_TEX_ENABLE_MASK       (0xf << 4)
24 #       define RADEON_TEX_0_ENABLE          (1 <<  4)
25 #       define RADEON_TEX_1_ENABLE          (1 <<  5)
26 #       define RADEON_TEX_2_ENABLE          (1 <<  6)
27 #       define RADEON_TEX_3_ENABLE          (1 <<  7)
28 #       define RADEON_TEX_BLEND_ENABLE_MASK (0xf << 12)
29 #       define RADEON_TEX_BLEND_0_ENABLE    (1 << 12)
30 #       define RADEON_TEX_BLEND_1_ENABLE    (1 << 13)
31 #       define RADEON_TEX_BLEND_2_ENABLE    (1 << 14)
32 #       define RADEON_TEX_BLEND_3_ENABLE    (1 << 15)
33 #       define RADEON_PLANAR_YUV_ENABLE     (1 << 20)
34 #       define RADEON_SPECULAR_ENABLE       (1 << 21)
35 #       define RADEON_FOG_ENABLE            (1 << 22)
36 #       define RADEON_ALPHA_TEST_ENABLE     (1 << 23)
37 #       define RADEON_ANTI_ALIAS_NONE       (0 << 24)
38 #       define RADEON_ANTI_ALIAS_LINE       (1 << 24)
39 #       define RADEON_ANTI_ALIAS_POLY       (2 << 24)
40 #       define RADEON_ANTI_ALIAS_LINE_POLY  (3 << 24)
41 #       define RADEON_BUMP_MAP_ENABLE       (1 << 26)
42 #       define RADEON_BUMPED_MAP_T0         (0 << 27)
43 #       define RADEON_BUMPED_MAP_T1         (1 << 27)
44 #       define RADEON_BUMPED_MAP_T2         (2 << 27)
45 #       define RADEON_TEX_3D_ENABLE_0       (1 << 29)
46 #       define RADEON_TEX_3D_ENABLE_1       (1 << 30)
47 #       define RADEON_MC_ENABLE             (1 << 31)
48 #define RADEON_PP_FOG_COLOR                 0x1c18
49 #       define RADEON_FOG_COLOR_MASK        0x00ffffff
50 #       define RADEON_FOG_VERTEX            (0 << 24)
51 #       define RADEON_FOG_TABLE             (1 << 24)
52 #       define RADEON_FOG_USE_DEPTH         (0 << 25)
53 #       define RADEON_FOG_USE_DIFFUSE_ALPHA (2 << 25)
54 #       define RADEON_FOG_USE_SPEC_ALPHA    (3 << 25)
55 #define RADEON_PP_LUM_MATRIX                0x1d00
56 #define RADEON_PP_MISC                      0x1c14
57 #       define RADEON_REF_ALPHA_MASK        0x000000ff
58 #       define RADEON_ALPHA_TEST_FAIL       (0 << 8)
59 #       define RADEON_ALPHA_TEST_LESS       (1 << 8)
60 #       define RADEON_ALPHA_TEST_LEQUAL     (2 << 8)
61 #       define RADEON_ALPHA_TEST_EQUAL      (3 << 8)
62 #       define RADEON_ALPHA_TEST_GEQUAL     (4 << 8)
63 #       define RADEON_ALPHA_TEST_GREATER    (5 << 8)
64 #       define RADEON_ALPHA_TEST_NEQUAL     (6 << 8)
65 #       define RADEON_ALPHA_TEST_PASS       (7 << 8)
66 #       define RADEON_ALPHA_TEST_OP_MASK    (7 << 8)
67 #       define RADEON_CHROMA_FUNC_FAIL      (0 << 16)
68 #       define RADEON_CHROMA_FUNC_PASS      (1 << 16)
69 #       define RADEON_CHROMA_FUNC_NEQUAL    (2 << 16)
70 #       define RADEON_CHROMA_FUNC_EQUAL     (3 << 16)
71 #       define RADEON_CHROMA_KEY_NEAREST    (0 << 18)
72 #       define RADEON_CHROMA_KEY_ZERO       (1 << 18)
73 #       define RADEON_SHADOW_ID_AUTO_INC    (1 << 20)
74 #       define RADEON_SHADOW_FUNC_EQUAL     (0 << 21)
75 #       define RADEON_SHADOW_FUNC_NEQUAL    (1 << 21)
76 #       define RADEON_SHADOW_PASS_1         (0 << 22)
77 #       define RADEON_SHADOW_PASS_2         (1 << 22)
78 #       define RADEON_RIGHT_HAND_CUBE_D3D   (0 << 24)
79 #       define RADEON_RIGHT_HAND_CUBE_OGL   (1 << 24)
80 #define RADEON_PP_ROT_MATRIX_0              0x1d58
81 #define RADEON_PP_ROT_MATRIX_1              0x1d5c
82 #define RADEON_PP_TXFILTER_0                0x1c54
83 #define RADEON_PP_TXFILTER_1                0x1c6c
84 #define RADEON_PP_TXFILTER_2                0x1c84
85 #       define RADEON_MAG_FILTER_NEAREST                   (0  <<  0)
86 #       define RADEON_MAG_FILTER_LINEAR                    (1  <<  0)
87 #       define RADEON_MAG_FILTER_MASK                      (1  <<  0)
88 #       define RADEON_MIN_FILTER_NEAREST                   (0  <<  1)
89 #       define RADEON_MIN_FILTER_LINEAR                    (1  <<  1)
90 #       define RADEON_MIN_FILTER_NEAREST_MIP_NEAREST       (2  <<  1)
91 #       define RADEON_MIN_FILTER_NEAREST_MIP_LINEAR        (3  <<  1)
92 #       define RADEON_MIN_FILTER_LINEAR_MIP_NEAREST        (6  <<  1)
93 #       define RADEON_MIN_FILTER_LINEAR_MIP_LINEAR         (7  <<  1)
94 #       define RADEON_MIN_FILTER_ANISO_NEAREST             (8  <<  1)
95 #       define RADEON_MIN_FILTER_ANISO_LINEAR              (9  <<  1)
96 #       define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 <<  1)
97 #       define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR  (11 <<  1)
98 #       define RADEON_MIN_FILTER_MASK                      (15 <<  1)
99 #       define RADEON_LOD_BIAS_MASK                        (0xffff <<  8)
100 #       define RADEON_LOD_BIAS_SHIFT                       8
101 #       define RADEON_MAX_MIP_LEVEL_MASK                   (0x0f << 16)
102 #       define RADEON_MAX_MIP_LEVEL_SHIFT                  16
103 #       define RADEON_WRAPEN_S                             (1  << 22)
104 #       define RADEON_CLAMP_S_WRAP                         (0  << 23)
105 #       define RADEON_CLAMP_S_MIRROR                       (1  << 23)
106 #       define RADEON_CLAMP_S_CLAMP_LAST                   (2  << 23)
107 #       define RADEON_CLAMP_S_MIRROR_CLAMP_LAST            (3  << 23)
108 #       define RADEON_CLAMP_S_CLAMP_BORDER                 (4  << 23)
109 #       define RADEON_CLAMP_S_MIRROR_CLAMP_BORDER          (5  << 23)
110 #       define RADEON_CLAMP_S_MASK                         (7  << 23)
111 #       define RADEON_WRAPEN_T                             (1  << 26)
112 #       define RADEON_CLAMP_T_WRAP                         (0  << 27)
113 #       define RADEON_CLAMP_T_MIRROR                       (1  << 27)
114 #       define RADEON_CLAMP_T_CLAMP_LAST                   (2  << 27)
115 #       define RADEON_CLAMP_T_MIRROR_CLAMP_LAST            (3  << 27)
116 #       define RADEON_CLAMP_T_CLAMP_BORDER                 (4  << 27)
117 #       define RADEON_CLAMP_T_MIRROR_CLAMP_BORDER          (5  << 27)
118 #       define RADEON_CLAMP_T_MASK                         (7  << 27)
119 #       define RADEON_BORDER_MODE_OGL                      (0  << 31)
120 #       define RADEON_BORDER_MODE_D3D                      (1  << 31)
121 #define RADEON_PP_TXFORMAT_0                0x1c58
122 #define RADEON_PP_TXFORMAT_1                0x1c70
123 #define RADEON_PP_TXFORMAT_2                0x1c88
124 #       define RADEON_TXFORMAT_I8                 (0  <<  0)
125 #       define RADEON_TXFORMAT_AI88               (1  <<  0)
126 #       define RADEON_TXFORMAT_RGB332             (2  <<  0)
127 #       define RADEON_TXFORMAT_ARGB1555           (3  <<  0)
128 #       define RADEON_TXFORMAT_RGB565             (4  <<  0)
129 #       define RADEON_TXFORMAT_ARGB4444           (5  <<  0)
130 #       define RADEON_TXFORMAT_ARGB8888           (6  <<  0)
131 #       define RADEON_TXFORMAT_RGBA8888           (7  <<  0)
132 #       define RADEON_TXFORMAT_Y8                 (8  <<  0)
133 #       define RADEON_TXFORMAT_FORMAT_MASK        (31 <<  0)
134 #       define RADEON_TXFORMAT_FORMAT_SHIFT       0
135 #       define RADEON_TXFORMAT_APPLE_YUV_MODE     (1  <<  5)
136 #       define RADEON_TXFORMAT_ALPHA_IN_MAP       (1  <<  6)
137 #       define RADEON_TXFORMAT_NON_POWER2         (1  <<  7)
138 #       define RADEON_TXFORMAT_WIDTH_MASK         (15 <<  8)
139 #       define RADEON_TXFORMAT_WIDTH_SHIFT        8
140 #       define RADEON_TXFORMAT_HEIGHT_MASK        (15 << 12)
141 #       define RADEON_TXFORMAT_HEIGHT_SHIFT       12
142 #       define RADEON_TXFORMAT_ST_ROUTE_STQ0      (0  << 24)
143 #       define RADEON_TXFORMAT_ST_ROUTE_MASK      (3  << 24)
144 #       define RADEON_TXFORMAT_ST_ROUTE_STQ1      (1  << 24)
145 #       define RADEON_TXFORMAT_ST_ROUTE_STQ2      (2  << 24)
146 #       define RADEON_TXFORMAT_ENDIAN_NO_SWAP     (0  << 26)
147 #       define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP  (1  << 26)
148 #       define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP  (2  << 26)
149 #       define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3  << 26)
150 #       define RADEON_TXFORMAT_ALPHA_MASK_ENABLE  (1  << 28)
151 #       define RADEON_TXFORMAT_CHROMA_KEY_ENABLE  (1  << 29)
152 #       define RADEON_TXFORMAT_CUBIC_MAP_ENABLE   (1  << 30)
153 #       define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1  << 31)
154 #define RADEON_PP_TXOFFSET_0                0x1c5c
155 #define RADEON_PP_TXOFFSET_1                0x1c74
156 #define RADEON_PP_TXOFFSET_2                0x1c8c
157 #       define RADEON_TXO_ENDIAN_NO_SWAP     (0 << 0)
158 #       define RADEON_TXO_ENDIAN_BYTE_SWAP   (1 << 0)
159 #       define RADEON_TXO_ENDIAN_WORD_SWAP   (2 << 0)
160 #       define RADEON_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
161 #       define RADEON_TXO_MACRO_LINEAR       (0 << 2)
162 #       define RADEON_TXO_MACRO_TILE         (1 << 2)
163 #       define RADEON_TXO_MICRO_LINEAR       (0 << 3)
164 #       define RADEON_TXO_MICRO_TILE_X2      (1 << 3)
165 #       define RADEON_TXO_MICRO_TILE_OPT     (2 << 3)
166 #       define RADEON_TXO_OFFSET_MASK        0xffffffe0
167 #       define RADEON_TXO_OFFSET_SHIFT       5
168 #define RADEON_PP_TXCBLEND_0                0x1c60
169 #define RADEON_PP_TXCBLEND_1                0x1c78
170 #define RADEON_PP_TXCBLEND_2                0x1c90
171 #	define RADEON_COLOR_ARG_A_SHIFT			0
172 #	define RADEON_COLOR_ARG_A_MASK			(0x1f << 0)
173 #	define RADEON_COLOR_ARG_A_ZERO			(0 << 0)
174 #	define RADEON_COLOR_ARG_A_CURRENT_COLOR		(2 << 0)
175 #	define RADEON_COLOR_ARG_A_CURRENT_ALPHA		(3 << 0)
176 #	define RADEON_COLOR_ARG_A_DIFFUSE_COLOR		(4 << 0)
177 #	define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA		(5 << 0)
178 #	define RADEON_COLOR_ARG_A_SPECULAR_COLOR	(6 << 0)
179 #	define RADEON_COLOR_ARG_A_SPECULAR_ALPHA	(7 << 0)
180 #	define RADEON_COLOR_ARG_A_TFACTOR_COLOR		(8 << 0)
181 #	define RADEON_COLOR_ARG_A_TFACTOR_ALPHA		(9 << 0)
182 #	define RADEON_COLOR_ARG_A_T0_COLOR		(10 << 0)
183 #	define RADEON_COLOR_ARG_A_T0_ALPHA		(11 << 0)
184 #	define RADEON_COLOR_ARG_A_T1_COLOR		(12 << 0)
185 #	define RADEON_COLOR_ARG_A_T1_ALPHA		(13 << 0)
186 #	define RADEON_COLOR_ARG_A_T2_COLOR		(14 << 0)
187 #	define RADEON_COLOR_ARG_A_T2_ALPHA		(15 << 0)
188 #	define RADEON_COLOR_ARG_A_T3_COLOR		(16 << 0)
189 #	define RADEON_COLOR_ARG_A_T3_ALPHA		(17 << 0)
190 #	define RADEON_COLOR_ARG_B_SHIFT			5
191 #	define RADEON_COLOR_ARG_B_MASK			(0x1f << 5)
192 #	define RADEON_COLOR_ARG_B_ZERO			(0 << 5)
193 #	define RADEON_COLOR_ARG_B_CURRENT_COLOR		(2 << 5)
194 #	define RADEON_COLOR_ARG_B_CURRENT_ALPHA		(3 << 5)
195 #	define RADEON_COLOR_ARG_B_DIFFUSE_COLOR		(4 << 5)
196 #	define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA		(5 << 5)
197 #	define RADEON_COLOR_ARG_B_SPECULAR_COLOR	(6 << 5)
198 #	define RADEON_COLOR_ARG_B_SPECULAR_ALPHA	(7 << 5)
199 #	define RADEON_COLOR_ARG_B_TFACTOR_COLOR		(8 << 5)
200 #	define RADEON_COLOR_ARG_B_TFACTOR_ALPHA		(9 << 5)
201 #	define RADEON_COLOR_ARG_B_T0_COLOR		(10 << 5)
202 #	define RADEON_COLOR_ARG_B_T0_ALPHA		(11 << 5)
203 #	define RADEON_COLOR_ARG_B_T1_COLOR		(12 << 5)
204 #	define RADEON_COLOR_ARG_B_T1_ALPHA		(13 << 5)
205 #	define RADEON_COLOR_ARG_B_T2_COLOR		(14 << 5)
206 #	define RADEON_COLOR_ARG_B_T2_ALPHA		(15 << 5)
207 #	define RADEON_COLOR_ARG_B_T3_COLOR		(16 << 5)
208 #	define RADEON_COLOR_ARG_B_T3_ALPHA		(17 << 5)
209 #	define RADEON_COLOR_ARG_C_SHIFT			10
210 #	define RADEON_COLOR_ARG_C_MASK			(0x1f << 10)
211 #	define RADEON_COLOR_ARG_C_ZERO			(0 << 10)
212 #	define RADEON_COLOR_ARG_C_CURRENT_COLOR		(2 << 10)
213 #	define RADEON_COLOR_ARG_C_CURRENT_ALPHA		(3 << 10)
214 #	define RADEON_COLOR_ARG_C_DIFFUSE_COLOR		(4 << 10)
215 #	define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA		(5 << 10)
216 #	define RADEON_COLOR_ARG_C_SPECULAR_COLOR	(6 << 10)
217 #	define RADEON_COLOR_ARG_C_SPECULAR_ALPHA	(7 << 10)
218 #	define RADEON_COLOR_ARG_C_TFACTOR_COLOR		(8 << 10)
219 #	define RADEON_COLOR_ARG_C_TFACTOR_ALPHA		(9 << 10)
220 #	define RADEON_COLOR_ARG_C_T0_COLOR		(10 << 10)
221 #	define RADEON_COLOR_ARG_C_T0_ALPHA		(11 << 10)
222 #	define RADEON_COLOR_ARG_C_T1_COLOR		(12 << 10)
223 #	define RADEON_COLOR_ARG_C_T1_ALPHA		(13 << 10)
224 #	define RADEON_COLOR_ARG_C_T2_COLOR		(14 << 10)
225 #	define RADEON_COLOR_ARG_C_T2_ALPHA		(15 << 10)
226 #	define RADEON_COLOR_ARG_C_T3_COLOR		(16 << 10)
227 #	define RADEON_COLOR_ARG_C_T3_ALPHA		(17 << 10)
228 #	define RADEON_COMP_ARG_A			(1 << 15)
229 #	define RADEON_COMP_ARG_A_SHIFT			15
230 #	define RADEON_COMP_ARG_B			(1 << 16)
231 #	define RADEON_COMP_ARG_B_SHIFT			16
232 #	define RADEON_COMP_ARG_C			(1 << 17)
233 #	define RADEON_COMP_ARG_C_SHIFT			17
234 #	define RADEON_BLEND_CTL_MASK			(7 << 18)
235 #	define RADEON_BLEND_CTL_ADD			(0 << 18)
236 #	define RADEON_BLEND_CTL_SUBTRACT		(1 << 18)
237 #	define RADEON_BLEND_CTL_ADDSIGNED		(2 << 18)
238 #	define RADEON_BLEND_CTL_BLEND			(3 << 18)
239 #	define RADEON_BLEND_CTL_DOT3			(4 << 18)
240 #	define RADEON_SCALE_SHIFT			21
241 #	define RADEON_SCALE_MASK			(3 << 21)
242 #	define RADEON_SCALE_1X				(0 << 21)
243 #	define RADEON_SCALE_2X				(1 << 21)
244 #	define RADEON_SCALE_4X				(2 << 21)
245 #	define RADEON_CLAMP_TX				(1 << 23)
246 #	define RADEON_T0_EQ_TCUR			(1 << 24)
247 #	define RADEON_T1_EQ_TCUR			(1 << 25)
248 #	define RADEON_T2_EQ_TCUR			(1 << 26)
249 #	define RADEON_T3_EQ_TCUR			(1 << 27)
250 #	define RADEON_COLOR_ARG_MASK			0x1f
251 #	define RADEON_COMP_ARG_SHIFT			15
252 #define RADEON_PP_TXABLEND_0                0x1c64
253 #define RADEON_PP_TXABLEND_1                0x1c7c
254 #define RADEON_PP_TXABLEND_2                0x1c94
255 #	define RADEON_ALPHA_ARG_A_SHIFT			0
256 #	define RADEON_ALPHA_ARG_A_MASK			(0xf << 0)
257 #	define RADEON_ALPHA_ARG_A_ZERO			(0 << 0)
258 #	define RADEON_ALPHA_ARG_A_CURRENT_ALPHA		(1 << 0)
259 #	define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA		(2 << 0)
260 #	define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA	(3 << 0)
261 #	define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA		(4 << 0)
262 #	define RADEON_ALPHA_ARG_A_T0_ALPHA		(5 << 0)
263 #	define RADEON_ALPHA_ARG_A_T1_ALPHA		(6 << 0)
264 #	define RADEON_ALPHA_ARG_A_T2_ALPHA		(7 << 0)
265 #	define RADEON_ALPHA_ARG_A_T3_ALPHA		(8 << 0)
266 #	define RADEON_ALPHA_ARG_B_SHIFT			4
267 #	define RADEON_ALPHA_ARG_B_MASK			(0xf << 4)
268 #	define RADEON_ALPHA_ARG_B_ZERO			(0 << 4)
269 #	define RADEON_ALPHA_ARG_B_CURRENT_ALPHA		(1 << 4)
270 #	define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA		(2 << 4)
271 #	define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA	(3 << 4)
272 #	define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA		(4 << 4)
273 #	define RADEON_ALPHA_ARG_B_T0_ALPHA		(5 << 4)
274 #	define RADEON_ALPHA_ARG_B_T1_ALPHA		(6 << 4)
275 #	define RADEON_ALPHA_ARG_B_T2_ALPHA		(7 << 4)
276 #	define RADEON_ALPHA_ARG_B_T3_ALPHA		(8 << 4)
277 #	define RADEON_ALPHA_ARG_C_SHIFT			8
278 #	define RADEON_ALPHA_ARG_C_MASK			(0xf << 8)
279 #	define RADEON_ALPHA_ARG_C_ZERO			(0 << 8)
280 #	define RADEON_ALPHA_ARG_C_CURRENT_ALPHA		(1 << 8)
281 #	define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA		(2 << 8)
282 #	define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA	(3 << 8)
283 #	define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA		(4 << 8)
284 #	define RADEON_ALPHA_ARG_C_T0_ALPHA		(5 << 8)
285 #	define RADEON_ALPHA_ARG_C_T1_ALPHA		(6 << 8)
286 #	define RADEON_ALPHA_ARG_C_T2_ALPHA		(7 << 8)
287 #	define RADEON_ALPHA_ARG_C_T3_ALPHA		(8 << 8)
288 #	define RADEON_DOT_ALPHA_DONT_REPLICATE		(1 << 9)
289 #	define RADEON_ALPHA_ARG_MASK			0xf
290 
291 #define RADEON_PP_TFACTOR_0                 0x1c68
292 #define RADEON_PP_TFACTOR_1                 0x1c80
293 #define RADEON_PP_TFACTOR_2                 0x1c98
294 
295 #define RADEON_RB3D_BLENDCNTL               0x1c20
296 #       define RADEON_COMB_FCN_ADD_CLAMP               (0  << 12)
297 #       define RADEON_COMB_FCN_ADD_NOCLAMP             (1  << 12)
298 #       define RADEON_COMB_FCN_SUB_CLAMP               (2  << 12)
299 #       define RADEON_COMB_FCN_SUB_NOCLAMP             (3  << 12)
300 #       define RADEON_SRC_BLEND_GL_ZERO                (32 << 16)
301 #       define RADEON_SRC_BLEND_GL_ONE                 (33 << 16)
302 #       define RADEON_SRC_BLEND_GL_SRC_COLOR           (34 << 16)
303 #       define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16)
304 #       define RADEON_SRC_BLEND_GL_DST_COLOR           (36 << 16)
305 #       define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16)
306 #       define RADEON_SRC_BLEND_GL_SRC_ALPHA           (38 << 16)
307 #       define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16)
308 #       define RADEON_SRC_BLEND_GL_DST_ALPHA           (40 << 16)
309 #       define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16)
310 #       define RADEON_SRC_BLEND_GL_SRC_ALPHA_SATURATE  (42 << 16)
311 #       define RADEON_SRC_BLEND_MASK                   (63 << 16)
312 #       define RADEON_DST_BLEND_GL_ZERO                (32 << 24)
313 #       define RADEON_DST_BLEND_GL_ONE                 (33 << 24)
314 #       define RADEON_DST_BLEND_GL_SRC_COLOR           (34 << 24)
315 #       define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24)
316 #       define RADEON_DST_BLEND_GL_DST_COLOR           (36 << 24)
317 #       define RADEON_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24)
318 #       define RADEON_DST_BLEND_GL_SRC_ALPHA           (38 << 24)
319 #       define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24)
320 #       define RADEON_DST_BLEND_GL_DST_ALPHA           (40 << 24)
321 #       define RADEON_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24)
322 #       define RADEON_DST_BLEND_MASK                   (63 << 24)
323 #define RADEON_RB3D_CNTL                    0x1c3c
324 #       define RADEON_ALPHA_BLEND_ENABLE       (1  <<  0)
325 #       define RADEON_PLANE_MASK_ENABLE        (1  <<  1)
326 #       define RADEON_DITHER_ENABLE            (1  <<  2)
327 #       define RADEON_ROUND_ENABLE             (1  <<  3)
328 #       define RADEON_SCALE_DITHER_ENABLE      (1  <<  4)
329 #       define RADEON_DITHER_INIT              (1  <<  5)
330 #       define RADEON_ROP_ENABLE               (1  <<  6)
331 #       define RADEON_STENCIL_ENABLE           (1  <<  7)
332 #       define RADEON_Z_ENABLE                 (1  <<  8)
333 #       define RADEON_DEPTH_XZ_OFFEST_ENABLE   (1  <<  9)
334 #       define RADEON_COLOR_FORMAT_ARGB1555    (3  << 10)
335 #       define RADEON_COLOR_FORMAT_RGB565      (4  << 10)
336 #       define RADEON_COLOR_FORMAT_ARGB8888    (6  << 10)
337 #       define RADEON_COLOR_FORMAT_RGB332      (7  << 10)
338 #       define RADEON_COLOR_FORMAT_Y8          (8  << 10)
339 #       define RADEON_COLOR_FORMAT_RGB8        (9  << 10)
340 #       define RADEON_COLOR_FORMAT_YUV422_VYUY (11 << 10)
341 #       define RADEON_COLOR_FORMAT_YUV422_YVYU (12 << 10)
342 #       define RADEON_COLOR_FORMAT_aYUV444     (14 << 10)
343 #       define RADEON_COLOR_FORMAT_ARGB4444    (15 << 10)
344 #       define RADEON_CLRCMP_FLIP_ENABLE       (1  << 14)
345 #       define RADEON_ZBLOCK8                  (0  << 15)
346 #       define RADEON_ZBLOCK16                 (1  << 15)
347 #define RADEON_RB3D_COLOROFFSET             0x1c40
348 #       define RADEON_COLOROFFSET_MASK      0xfffffff0
349 #define RADEON_RB3D_COLORPITCH              0x1c48
350 #       define RADEON_COLORPITCH_MASK         0x000001ff8
351 #       define RADEON_COLOR_TILE_ENABLE       (1 << 16)
352 #       define RADEON_COLOR_MICROTILE_ENABLE  (1 << 17)
353 #       define RADEON_COLOR_ENDIAN_NO_SWAP    (0 << 18)
354 #       define RADEON_COLOR_ENDIAN_WORD_SWAP  (1 << 18)
355 #       define RADEON_COLOR_ENDIAN_DWORD_SWAP (2 << 18)
356 #define RADEON_RB3D_DEPTHOFFSET             0x1c24
357 #define RADEON_RB3D_DEPTHPITCH              0x1c28
358 #       define RADEON_DEPTHPITCH_MASK         0x00001ff8
359 #       define RADEON_DEPTH_ENDIAN_NO_SWAP    (0 << 18)
360 #       define RADEON_DEPTH_ENDIAN_WORD_SWAP  (1 << 18)
361 #       define RADEON_DEPTH_ENDIAN_DWORD_SWAP (2 << 18)
362 #define RADEON_RB3D_PLANEMASK               0x1d84
363 #define RADEON_RB3D_ROPCNTL                 0x1d80
364 #define RADEON_RB3D_STENCILREFMASK          0x1d7c
365 #       define RADEON_STENCIL_REF_SHIFT       0
366 #       define RADEON_STENCIL_MASK_SHIFT      16
367 #       define RADEON_STENCIL_WRITEMASK_SHIFT 24
368 #define RADEON_RB3D_ZSTENCILCNTL            0x1c2c
369 #       define RADEON_DEPTH_FORMAT_MASK          (0xf << 0)
370 #       define RADEON_DEPTH_FORMAT_16BIT_INT_Z   (0  <<  0)
371 #       define RADEON_DEPTH_FORMAT_24BIT_INT_Z   (2  <<  0)
372 #       define RADEON_DEPTH_FORMAT_24BIT_FLOAT_Z (3  <<  0)
373 #       define RADEON_DEPTH_FORMAT_32BIT_INT_Z   (4  <<  0)
374 #       define RADEON_DEPTH_FORMAT_32BIT_FLOAT_Z (5  <<  0)
375 #       define RADEON_DEPTH_FORMAT_16BIT_FLOAT_W (7  <<  0)
376 #       define RADEON_DEPTH_FORMAT_24BIT_FLOAT_W (9  <<  0)
377 #       define RADEON_DEPTH_FORMAT_32BIT_FLOAT_W (11 <<  0)
378 #       define RADEON_Z_TEST_NEVER               (0  <<  4)
379 #       define RADEON_Z_TEST_LESS                (1  <<  4)
380 #       define RADEON_Z_TEST_LEQUAL              (2  <<  4)
381 #       define RADEON_Z_TEST_EQUAL               (3  <<  4)
382 #       define RADEON_Z_TEST_GEQUAL              (4  <<  4)
383 #       define RADEON_Z_TEST_GREATER             (5  <<  4)
384 #       define RADEON_Z_TEST_NEQUAL              (6  <<  4)
385 #       define RADEON_Z_TEST_ALWAYS              (7  <<  4)
386 #       define RADEON_Z_TEST_MASK                (7  <<  4)
387 #       define RADEON_HIERARCHICAL_Z_ENABLE      (1  <<  8)
388 #       define RADEON_STENCIL_TEST_NEVER         (0  << 12)
389 #       define RADEON_STENCIL_TEST_LESS          (1  << 12)
390 #       define RADEON_STENCIL_TEST_LEQUAL        (2  << 12)
391 #       define RADEON_STENCIL_TEST_EQUAL         (3  << 12)
392 #       define RADEON_STENCIL_TEST_GEQUAL        (4  << 12)
393 #       define RADEON_STENCIL_TEST_GREATER       (5  << 12)
394 #       define RADEON_STENCIL_TEST_NEQUAL        (6  << 12)
395 #       define RADEON_STENCIL_TEST_ALWAYS        (7  << 12)
396 #       define RADEON_STENCIL_S_FAIL_KEEP        (0  << 16)
397 #       define RADEON_STENCIL_S_FAIL_ZERO        (1  << 16)
398 #       define RADEON_STENCIL_S_FAIL_REPLACE     (2  << 16)
399 #       define RADEON_STENCIL_S_FAIL_INC         (3  << 16)
400 #       define RADEON_STENCIL_S_FAIL_DEC         (4  << 16)
401 #       define RADEON_STENCIL_S_FAIL_INVERT      (5  << 16)
402 #       define RADEON_STENCIL_ZPASS_KEEP         (0  << 20)
403 #       define RADEON_STENCIL_ZPASS_ZERO         (1  << 20)
404 #       define RADEON_STENCIL_ZPASS_REPLACE      (2  << 20)
405 #       define RADEON_STENCIL_ZPASS_INC          (3  << 20)
406 #       define RADEON_STENCIL_ZPASS_DEC          (4  << 20)
407 #       define RADEON_STENCIL_ZPASS_INVERT       (5  << 20)
408 #       define RADEON_STENCIL_ZFAIL_KEEP         (0  << 20)
409 #       define RADEON_STENCIL_ZFAIL_ZERO         (1  << 20)
410 #       define RADEON_STENCIL_ZFAIL_REPLACE      (2  << 20)
411 #       define RADEON_STENCIL_ZFAIL_INC          (3  << 20)
412 #       define RADEON_STENCIL_ZFAIL_DEC          (4  << 20)
413 #       define RADEON_STENCIL_ZFAIL_INVERT       (5  << 20)
414 #       define RADEON_Z_COMPRESSION_ENABLE       (1  << 28)
415 #       define RADEON_FORCE_Z_DIRTY              (1  << 29)
416 #       define RADEON_Z_WRITE_ENABLE             (1  << 30)
417 #       define RADEON_Z_DECOMPRESSION_ENABLE     (1  << 31)
418 #define RADEON_RE_LINE_PATTERN              0x1cd0
419 #       define RADEON_LINE_PATTERN_MASK             0x0000ffff
420 #       define RADEON_LINE_REPEAT_COUNT_SHIFT       16
421 #       define RADEON_LINE_PATTERN_START_SHIFT      24
422 #       define RADEON_LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28)
423 #       define RADEON_LINE_PATTERN_BIG_BIT_ORDER    (1 << 28)
424 #       define RADEON_LINE_PATTERN_AUTO_RESET       (1 << 29)
425 #define RADEON_RE_LINE_STATE                0x1cd4
426 #       define RADEON_LINE_CURRENT_PTR_SHIFT   0
427 #       define RADEON_LINE_CURRENT_COUNT_SHIFT 8
428 #define RADEON_RE_MISC                      0x26c4
429 #       define RADEON_STIPPLE_COORD_MASK       0x1f
430 #       define RADEON_STIPPLE_X_OFFSET_SHIFT   0
431 #       define RADEON_STIPPLE_X_OFFSET_MASK    (0x1f << 0)
432 #       define RADEON_STIPPLE_Y_OFFSET_SHIFT   8
433 #       define RADEON_STIPPLE_Y_OFFSET_MASK    (0x1f << 8)
434 #       define RADEON_STIPPLE_LITTLE_BIT_ORDER (0 << 16)
435 #       define RADEON_STIPPLE_BIG_BIT_ORDER    (1 << 16)
436 #define RADEON_RE_SOLID_COLOR               0x1c1c
437 #define RADEON_RE_TOP_LEFT                  0x26c0
438 #       define RADEON_RE_LEFT_SHIFT         0
439 #       define RADEON_RE_TOP_SHIFT          16
440 #define RADEON_RE_WIDTH_HEIGHT              0x1c44
441 #       define RADEON_RE_WIDTH_SHIFT        0
442 #       define RADEON_RE_HEIGHT_SHIFT       16
443 
444 #define RADEON_SE_CNTL                      0x1c4c
445 #       define RADEON_FFACE_CULL_CW          (0 <<  0)
446 #       define RADEON_FFACE_CULL_CCW         (1 <<  0)
447 #       define RADEON_FFACE_CULL_DIR_MASK    (1 <<  0)
448 #       define RADEON_BFACE_CULL             (0 <<  1)
449 #       define RADEON_BFACE_SOLID            (3 <<  1)
450 #       define RADEON_FFACE_CULL             (0 <<  3)
451 #       define RADEON_FFACE_SOLID            (3 <<  3)
452 #       define RADEON_FFACE_CULL_MASK        (3 <<  3)
453 #       define RADEON_BADVTX_CULL_DISABLE    (1 <<  5)
454 #       define RADEON_FLAT_SHADE_VTX_0       (0 <<  6)
455 #       define RADEON_FLAT_SHADE_VTX_1       (1 <<  6)
456 #       define RADEON_FLAT_SHADE_VTX_2       (2 <<  6)
457 #       define RADEON_FLAT_SHADE_VTX_LAST    (3 <<  6)
458 #       define RADEON_DIFFUSE_SHADE_SOLID    (0 <<  8)
459 #       define RADEON_DIFFUSE_SHADE_FLAT     (1 <<  8)
460 #       define RADEON_DIFFUSE_SHADE_GOURAUD  (2 <<  8)
461 #       define RADEON_DIFFUSE_SHADE_MASK     (3 <<  8)
462 #       define RADEON_ALPHA_SHADE_SOLID      (0 << 10)
463 #       define RADEON_ALPHA_SHADE_FLAT       (1 << 10)
464 #       define RADEON_ALPHA_SHADE_GOURAUD    (2 << 10)
465 #       define RADEON_ALPHA_SHADE_MASK       (3 << 10)
466 #       define RADEON_SPECULAR_SHADE_SOLID   (0 << 12)
467 #       define RADEON_SPECULAR_SHADE_FLAT    (1 << 12)
468 #       define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12)
469 #       define RADEON_SPECULAR_SHADE_MASK    (3 << 12)
470 #       define RADEON_FOG_SHADE_SOLID        (0 << 14)
471 #       define RADEON_FOG_SHADE_FLAT         (1 << 14)
472 #       define RADEON_FOG_SHADE_GOURAUD      (2 << 14)
473 #       define RADEON_FOG_SHADE_MASK         (3 << 14)
474 #       define RADEON_ZBIAS_ENABLE_POINT     (1 << 16)
475 #       define RADEON_ZBIAS_ENABLE_LINE      (1 << 17)
476 #       define RADEON_ZBIAS_ENABLE_TRI       (1 << 18)
477 #       define RADEON_WIDELINE_ENABLE        (1 << 20)
478 #       define RADEON_VPORT_XY_XFORM_ENABLE  (1 << 24)
479 #       define RADEON_VPORT_Z_XFORM_ENABLE   (1 << 25)
480 #       define RADEON_VTX_PIX_CENTER_D3D     (0 << 27)
481 #       define RADEON_VTX_PIX_CENTER_OGL     (1 << 27)
482 #       define RADEON_ROUND_MODE_TRUNC       (0 << 28)
483 #       define RADEON_ROUND_MODE_ROUND       (1 << 28)
484 #       define RADEON_ROUND_MODE_ROUND_EVEN  (2 << 28)
485 #       define RADEON_ROUND_MODE_ROUND_ODD   (3 << 28)
486 #       define RADEON_ROUND_PREC_16TH_PIX    (0 << 30)
487 #       define RADEON_ROUND_PREC_8TH_PIX     (1 << 30)
488 #       define RADEON_ROUND_PREC_4TH_PIX     (2 << 30)
489 #       define RADEON_ROUND_PREC_HALF_PIX    (3 << 30)
490 #define RADEON_SE_CNTL_STATUS               0x2140
491 #       define RADEON_VC_NO_SWAP            (0 << 0)
492 #       define RADEON_VC_16BIT_SWAP         (1 << 0)
493 #       define RADEON_VC_32BIT_SWAP         (2 << 0)
494 #       define RADEON_VC_HALF_DWORD_SWAP    (3 << 0)
495 #       define RADEON_TCL_BYPASS            (1 << 8)
496 #define RADEON_SE_COORD_FMT                 0x15c0
497 #       define RADEON_VTX_XY_PRE_MULT_1_OVER_W0  (1 <<  0)
498 #       define RADEON_VTX_Z_PRE_MULT_1_OVER_W0   (1 <<  1)
499 #       define RADEON_VTX_ST0_NONPARAMETRIC      (1 <<  8)
500 #       define RADEON_VTX_ST1_NONPARAMETRIC      (1 <<  9)
501 #       define RADEON_VTX_ST2_NONPARAMETRIC      (1 << 10)
502 #       define RADEON_VTX_ST3_NONPARAMETRIC      (1 << 11)
503 #       define RADEON_VTX_W0_NORMALIZE           (1 << 12)
504 #       define RADEON_VTX_W0_IS_NOT_1_OVER_W0    (1 << 16)
505 #       define RADEON_VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17)
506 #       define RADEON_VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19)
507 #       define RADEON_VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21)
508 #       define RADEON_VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23)
509 #       define RADEON_TEX1_W_ROUTING_USE_W0      (0 << 26)
510 #       define RADEON_TEX1_W_ROUTING_USE_Q1      (1 << 26)
511 #define RADEON_SE_LINE_WIDTH                0x1db8
512 #define RADEON_SE_TCL_LIGHT_MODEL_CTL       0x226c
513 #define RADEON_SE_TCL_MATERIAL_AMBIENT_RED     0x2220
514 #define RADEON_SE_TCL_MATERIAL_AMBIENT_GREEN   0x2224
515 #define RADEON_SE_TCL_MATERIAL_AMBIENT_BLUE    0x2228
516 #define RADEON_SE_TCL_MATERIAL_AMBIENT_ALPHA   0x222c
517 #define RADEON_SE_TCL_MATERIAL_DIFFUSE_RED     0x2230
518 #define RADEON_SE_TCL_MATERIAL_DIFFUSE_GREEN   0x2234
519 #define RADEON_SE_TCL_MATERIAL_DIFFUSE_BLUE    0x2238
520 #define RADEON_SE_TCL_MATERIAL_DIFFUSE_ALPHA   0x223c
521 #define RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED   0x2210
522 #define RADEON_SE_TCL_MATERIAL_EMMISSIVE_GREEN 0x2214
523 #define RADEON_SE_TCL_MATERIAL_EMMISSIVE_BLUE  0x2218
524 #define RADEON_SE_TCL_MATERIAL_EMMISSIVE_ALPHA 0x221c
525 #define RADEON_SE_TCL_MATERIAL_SPECULAR_RED    0x2240
526 #define RADEON_SE_TCL_MATERIAL_SPECULAR_GREEN  0x2244
527 #define RADEON_SE_TCL_MATERIAL_SPECULAR_BLUE   0x2248
528 #define RADEON_SE_TCL_MATERIAL_SPECULAR_ALPHA  0x224c
529 #define RADEON_SE_TCL_MATRIX_SELECT_0       0x225c
530 #define RADEON_SE_TCL_MATRIX_SELECT_1       0x2260
531 #define RADEON_SE_TCL_OUTPUT_VTX_FMT        0x2254
532 #define RADEON_SE_TCL_OUTPUT_VTX_SEL        0x2258
533 #define RADEON_SE_TCL_PER_LIGHT_CTL_0       0x2270
534 #define RADEON_SE_TCL_PER_LIGHT_CTL_1       0x2274
535 #define RADEON_SE_TCL_PER_LIGHT_CTL_2       0x2278
536 #define RADEON_SE_TCL_PER_LIGHT_CTL_3       0x227c
537 #define RADEON_SE_TCL_SHININESS             0x2250
538 #define RADEON_SE_TCL_TEXTURE_PROC_CTL      0x2268
539 #define RADEON_SE_TCL_UCP_VERT_BLEND_CTL    0x2264
540 #define RADEON_SE_VPORT_XSCALE              0x1d98
541 #define RADEON_SE_VPORT_XOFFSET             0x1d9c
542 #define RADEON_SE_VPORT_YSCALE              0x1da0
543 #define RADEON_SE_VPORT_YOFFSET             0x1da4
544 #define RADEON_SE_VPORT_ZSCALE              0x1da8
545 #define RADEON_SE_VPORT_ZOFFSET             0x1dac
546 
547 #define RADEON_CP_VC_FRMT_XY                        0x00000000
548 #define RADEON_CP_VC_FRMT_W0                        0x00000001
549 #define RADEON_CP_VC_FRMT_FPCOLOR                   0x00000002
550 #define RADEON_CP_VC_FRMT_FPALPHA                   0x00000004
551 #define RADEON_CP_VC_FRMT_PKCOLOR                   0x00000008
552 #define RADEON_CP_VC_FRMT_FPSPEC                    0x00000010
553 #define RADEON_CP_VC_FRMT_FPFOG                     0x00000020
554 #define RADEON_CP_VC_FRMT_PKSPEC                    0x00000040
555 #define RADEON_CP_VC_FRMT_ST0                       0x00000080
556 #define RADEON_CP_VC_FRMT_ST1                       0x00000100
557 #define RADEON_CP_VC_FRMT_Q1                        0x00000200
558 #define RADEON_CP_VC_FRMT_ST2                       0x00000400
559 #define RADEON_CP_VC_FRMT_Q2                        0x00000800
560 #define RADEON_CP_VC_FRMT_ST3                       0x00001000
561 #define RADEON_CP_VC_FRMT_Q3                        0x00002000
562 #define RADEON_CP_VC_FRMT_Q0                        0x00004000
563 #define RADEON_CP_VC_FRMT_BLND_WEIGHT_CNT_MASK      0x00038000
564 #define RADEON_CP_VC_FRMT_N0                        0x00040000
565 #define RADEON_CP_VC_FRMT_XY1                       0x08000000
566 #define RADEON_CP_VC_FRMT_Z1                        0x10000000
567 #define RADEON_CP_VC_FRMT_W1                        0x20000000
568 #define RADEON_CP_VC_FRMT_N1                        0x40000000
569 #define RADEON_CP_VC_FRMT_Z                         0x80000000
570 
571 #define RADEON_CP_VC_CNTL_PRIM_TYPE_NONE            0x00000000
572 #define RADEON_CP_VC_CNTL_PRIM_TYPE_POINT           0x00000001
573 #define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE            0x00000002
574 #define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP      0x00000003
575 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST        0x00000004
576 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN         0x00000005
577 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP       0x00000006
578 #define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE2       0x00000007
579 #define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST       0x00000008
580 #define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009
581 #define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST  0x0000000a
582 #define RADEON_CP_VC_CNTL_PRIM_WALK_IND             0x00000010
583 #define RADEON_CP_VC_CNTL_PRIM_WALK_LIST            0x00000020
584 #define RADEON_CP_VC_CNTL_PRIM_WALK_RING            0x00000030
585 #define RADEON_CP_VC_CNTL_COLOR_ORDER_BGRA          0x00000000
586 #define RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA          0x00000040
587 #define RADEON_CP_VC_CNTL_MAOS_ENABLE               0x00000080
588 #define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE   0x00000000
589 #define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE       0x00000100
590 #define RADEON_CP_VC_CNTL_NUM_SHIFT                 16
591 
592 
593 #endif
594