i915: Texture instructions use r/t/oC/oD register as texture coordinate.
[mesa.git] / src / mesa / drivers / dri / s3v / s3v_regs.h
1 /*
2 * Author: Max Lingua <sunmax@libero.it>
3 */
4
5 #ifndef _S3V_REG_H
6 #define _S3V_REG_H
7
8 #define S3V_REGS_NUM 256
9
10 /************
11 * DMA REGS *
12 ************/
13
14 #define S3V_DMA_ID 0
15 #define S3V_DMA_REG 0x8590
16 #define S3V_DMA_WRITEP_ID 1
17 #define S3V_DMA_WRITEP_REG 0x8594
18 #define S3V_DMA_READP_ID 2
19 #define S3V_DMA_READP_REG 0x8598
20 #define S3V_DMA_ENABLE_ID 3
21 #define S3V_DMA_ENABLE_REG 0x859C
22 #define S3V_DMA_UPDATE_ID 4
23 #define S3V_DMA_UPDATE_REG 0x10000
24
25 /***************
26 * STATUS REGS *
27 ***************/
28
29 #define S3V_STAT_ID 10
30 #define S3V_STAT_REG 0x8504
31 #define S3V_STAT_VSYNC_ID 11
32 #define S3V_STAT_VSYNC_REG 0x8505
33 #define S3V_STAT_3D_DONE_ID 12
34 #define S3V_STAT_3D_DONE_REG 0x8506
35 #define S3V_STAT_FIFO_OVER_ID 13
36 #define S3V_STAT_FIFO_OVER_REG 0x8508
37 #define S3V_STAT_FIFO_EMPTY_ID 14
38 #define S3V_STAT_FIFO_EMPTY_REG 0x850C
39 #define S3V_STAT_HDMA_DONE_ID 15
40 #define S3V_STAT_HDMA_DONE_REG 0x8514
41 #define S3V_STAT_CDMA_DONE_ID 16
42 #define S3V_STAT_CDMA_DONE_REG 0x8524
43 #define S3V_STAT_3D_FIFO_EMPTY_ID 17
44 #define S3V_STAT_3D_FIFO_EMPTY_REG 0x8544
45 #define S3V_STAT_LPB_ID 18
46 #define S3V_STAT_LPB_REG 0x8584
47 #define S3V_STAT_3D_BUSY_ID 19
48 #define S3V_STAT_3D_BUSY_REG 0x8704
49
50 /***********
51 * 2D REGS *
52 ***********/
53
54 #define S3V_BITBLT_ID 30
55 #define S3V_BITBLT_REG 0xA400
56 #define S3V_BITBLT_SRC_BASE_ID 31
57 #define S3V_BITBLT_SRC_BASE_REG 0xA4D4
58 #define S3V_BITBLT_DEST_BASE_ID 32
59 #define S3V_BITBLT_DEST_BASE_REG 0xA4D8
60 #define S3V_BITBLT_CLIP_L_R_ID 33
61 #define S3V_BITBLT_CLIP_L_R_REG 0xA4DC
62 #define S3V_BITBLT_CLIP_T_B_ID 34
63 #define S3V_BITBLT_CLIP_T_B_REG 0xA4E0
64 #define S3V_BITBLT_DEST_SRC_STRIDE_ID 35
65 #define S3V_BITBLT_DEST_SRC_STRIDE_REG 0xA4E4
66 #define S3V_BITBLT_MONO_PAT0_ID 36
67 #define S3V_BITBLT_MONO_PAT0_REG 0xA4E8
68 #define S3V_BITBLT_MONO_PAT1_ID 37
69 #define S3V_BITBLT_MONO_PAT1_REG 0xA4EC
70 #define S3V_BITBLT_PAT_BG_COLOR_ID 38
71 #define S3V_BITBLT_PAT_BG_COLOR_REG 0xA4F0
72 #define S3V_BITBLT_PAT_FG_COLOR_ID 39
73 #define S3V_BITBLT_PAT_FG_COLOR_REG 0xA4F4
74 #define S3V_BITBLT_CMDSET_ID 40
75 #define S3V_BITBLT_CMDSET_REG 0xA500
76 #define S3V_BITBLT_WIDTH_HEIGHT_ID 41
77 #define S3V_BITBLT_WIDTH_HEIGHT_REG 0xA504
78 #define S3V_BITBLT_SRC_X_Y_ID 42
79 #define S3V_BITBLT_SRC_X_Y_REG 0xA508
80 #define S3V_BITBLT_DEST_X_Y_ID 43
81 #define S3V_BITBLT_DEST_X_Y_REG 0xA50C
82 #define S3V_2DLINE_ID 44
83 #define S3V_2DLINE_REG 0xA800
84 #define S3V_2DPOLY_ID 45
85 #define S3V_2DPOLY_REG 0xAC00
86
87 /***************
88 * 3DLINE REGS *
89 ***************/
90 /* base regs */
91 #define S3V_3DLINE_ID 50
92 #define S3V_3DLINE_REG 0xB000
93 #define S3V_3DLINE_Z_BASE_ID 51
94 #define S3V_3DLINE_Z_BASE_REG 0xB0D4
95 #define S3V_3DLINE_SRC_BASE_ID 52 /* it is the same reg */
96 #define S3V_3DLINE_SRC_BASE_REG 0xB0D4
97 #define S3V_3DLINE_DEST_BASE_ID 53
98 #define S3V_3DLINE_DEST_BASE_REG 0xB0D8
99 #define S3V_3DLINE_CLIP_L_R_ID 54
100 #define S3V_3DLINE_CLIP_L_R_REG 0xB0DC
101 #define S3V_3DLINE_CLIP_T_B_ID 55
102 #define S3V_3DLINE_CLIP_T_B_REG 0xB0E0
103 #define S3V_3DLINE_DEST_SRC_STRIDE_ID 56
104 #define S3V_3DLINE_DEST_SRC_STRIDE_REG 0xB0E4
105 #define S3V_3DLINE_Z_STRIDE_ID 57
106 #define S3V_3DLINE_Z_STRIDE_REG 0xB0E8
107 #define S3V_3DLINE_TEX_BASE_ID 58
108 #define S3V_3DLINE_TEX_BASE_REG 0xB0EC
109 #define S3V_3DLINE_TEX_B_COLOR_ID 59
110 #define S3V_3DLINE_TEX_B_COLOR_REG 0xB0F0
111 #define S3V_3DLINE_FOG_COLOR_ID 60
112 #define S3V_3DLINE_FOG_COLOR_REG 0xB0F4
113 #define S3V_3DLINE_COLOR0_ID 61
114 #define S3V_3DLINE_COLOR0_REG 0xB0F8
115 #define S3V_3DLINE_COLOR1_ID 62
116 #define S3V_3DLINE_COLOR1_REG 0xB0FC
117 #define S3V_3DLINE_CMDSET_ID 63
118 #define S3V_3DLINE_CMDSET_REG 0xB100 /* special */
119 /* tex regs */
120 /* FIXME: shouldn't it be a 1D tex for lines? */
121 #define S3V_3DLINE_BASEV_ID 64
122 #define S3V_3DLINE_BASEV_REG 0xB104
123 #define S3V_3DLINE_BASEU_ID 65
124 #define S3V_3DLINE_BASEU_REG 0xB108
125 #define S3V_3DLINE_WXD_ID 66
126 #define S3V_3DLINE_WXD_REG 0xB10C
127 #define S3V_3DLINE_WYD_ID 67
128 #define S3V_3DLINE_WYD_REG 0xB110
129 #define S3V_3DLINE_WSTART_ID 68
130 #define S3V_3DLINE_WSTART_REG 0xB114
131 #define S3V_3DLINE_DXD_ID 69
132 #define S3V_3DLINE_DXD_REG 0xB118
133 #define S3V_3DLINE_VXD_ID 70
134 #define S3V_3DLINE_VXD_REG 0xB11C
135 #define S3V_3DLINE_UXD_ID 71
136 #define S3V_3DLINE_UXD_REG 0xB120
137 #define S3V_3DLINE_DYD_ID 72
138 #define S3V_3DLINE_DYD_REG 0xB124
139 #define S3V_3DLINE_VYD_ID 73
140 #define S3V_3DLINE_VYD_REG 0xB128
141 #define S3V_3DLINE_UYD_ID 74
142 #define S3V_3DLINE_UYD_REG 0xB12C
143 #define S3V_3DLINE_DSTART_ID 75
144 #define S3V_3DLINE_DSTART_REG 0xB130
145 #define S3V_3DLINE_VSTART_ID 76
146 #define S3V_3DLINE_VSTART_REG 0xB134
147 #define S3V_3DLINE_USTART_ID 77
148 #define S3V_3DLINE_USTART_REG 0xB138
149 /* gourad regs */
150 #define S3V_3DLINE_GBD_ID 78
151 #define S3V_3DLINE_GBD_REG 0xB144
152 #define S3V_3DLINE_ARD_ID 79
153 #define S3V_3DLINE_ARD_REG 0xB148
154 #define S3V_3DLINE_GS_BS_ID 80
155 #define S3V_3DLINE_GS_BS_REG 0xB14C
156 #define S3V_3DLINE_AS_RS_ID 81
157 #define S3V_3DLINE_AS_RS_REG 0xB150
158 /* vertex regs */
159 #define S3V_3DLINE_DZ_ID 82
160 #define S3V_3DLINE_DZ_REG 0xB158
161 #define S3V_3DLINE_ZSTART_ID 83
162 #define S3V_3DLINE_ZSTART_REG 0xB15C
163 #define S3V_3DLINE_XEND0_END1_ID 84
164 #define S3V_3DLINE_XEND0_END1_REG 0xB16C
165 #define S3V_3DLINE_DX_ID 85
166 #define S3V_3DLINE_DX_REG 0xB170
167 #define S3V_3DLINE_XSTART_ID 86
168 #define S3V_3DLINE_XSTART_REG 0xB174
169 #define S3V_3DLINE_YSTART_ID 87
170 #define S3V_3DLINE_YSTART_REG 0xB178
171 #define S3V_3DLINE_YCNT_ID 88
172 #define S3V_3DLINE_YCNT_REG 0xB17C
173
174 /**************
175 * 3DTRI REGS *
176 **************/
177 /* base regs */
178 #define S3V_3DTRI_ID 100
179 #define S3V_3DTRI_REG 0xB400
180 #define S3V_3DTRI_Z_BASE_ID 101
181 #define S3V_3DTRI_Z_BASE_REG 0xB4D4
182 #define S3V_3DTRI_SRC_BASE_ID 102 /* it is the same reg */
183 #define S3V_3DTRI_SRC_BASE_REG 0xB4D4
184 #define S3V_3DTRI_DEST_BASE_ID 103
185 #define S3V_3DTRI_DEST_BASE_REG 0xB4D8
186 #define S3V_3DTRI_CLIP_L_R_ID 104
187 #define S3V_3DTRI_CLIP_L_R_REG 0xB4DC
188 #define S3V_3DTRI_CLIP_T_B_ID 105
189 #define S3V_3DTRI_CLIP_T_B_REG 0xB4E0
190 #define S3V_3DTRI_DEST_SRC_STRIDE_ID 106
191 #define S3V_3DTRI_DEST_SRC_STRIDE_REG 0xB4E4
192 #define S3V_3DTRI_Z_STRIDE_ID 107
193 #define S3V_3DTRI_Z_STRIDE_REG 0xB4E8
194 #define S3V_3DTRI_TEX_BASE_ID 108
195 #define S3V_3DTRI_TEX_BASE_REG 0xB4EC
196 #define S3V_3DTRI_TEX_B_COLOR_ID 109
197 #define S3V_3DTRI_TEX_B_COLOR_REG 0xB4F0
198 #define S3V_3DTRI_FOG_COLOR_ID 110
199 #define S3V_3DTRI_FOG_COLOR_REG 0xB4F4
200 #define S3V_3DTRI_COLOR0_ID 111
201 #define S3V_3DTRI_COLOR0_REG 0xB4F8
202 #define S3V_3DTRI_COLOR1_ID 112
203 #define S3V_3DTRI_COLOR1_REG 0xB4FC
204 #define S3V_3DTRI_CMDSET_ID 113 /* special */
205 #define S3V_3DTRI_CMDSET_REG 0xB500
206 /* tex regs */
207 #define S3V_3DTRI_BASEV_ID 114
208 #define S3V_3DTRI_BASEV_REG 0xB504
209 #define S3V_3DTRI_BASEU_ID 115
210 #define S3V_3DTRI_BASEU_REG 0xB508
211 #define S3V_3DTRI_WXD_ID 116
212 #define S3V_3DTRI_WXD_REG 0xB50C
213 #define S3V_3DTRI_WYD_ID 117
214 #define S3V_3DTRI_WYD_REG 0xB510
215 #define S3V_3DTRI_WSTART_ID 118
216 #define S3V_3DTRI_WSTART_REG 0xB514
217 #define S3V_3DTRI_DXD_ID 119
218 #define S3V_3DTRI_DXD_REG 0xB518
219 #define S3V_3DTRI_VXD_ID 120
220 #define S3V_3DTRI_VXD_REG 0xB51C
221 #define S3V_3DTRI_UXD_ID 121
222 #define S3V_3DTRI_UXD_REG 0xB520
223 #define S3V_3DTRI_DYD_ID 122
224 #define S3V_3DTRI_DYD_REG 0xB524
225 #define S3V_3DTRI_VYD_ID 123
226 #define S3V_3DTRI_VYD_REG 0xB528
227 #define S3V_3DTRI_UYD_ID 124
228 #define S3V_3DTRI_UYD_REG 0xB52C
229 #define S3V_3DTRI_DSTART_ID 125
230 #define S3V_3DTRI_DSTART_REG 0xB530
231 #define S3V_3DTRI_VSTART_ID 126
232 #define S3V_3DTRI_VSTART_REG 0xB534
233 #define S3V_3DTRI_USTART_ID 127
234 #define S3V_3DTRI_USTART_REG 0xB538
235 /* gourad regs */
236 #define S3V_3DTRI_GBX_ID 128
237 #define S3V_3DTRI_GBX_REG 0xB53C
238 #define S3V_3DTRI_ARX_ID 129
239 #define S3V_3DTRI_ARX_REG 0xB540
240 #define S3V_3DTRI_GBY_ID 130
241 #define S3V_3DTRI_GBY_REG 0xB544
242 #define S3V_3DTRI_ARY_ID 131
243 #define S3V_3DTRI_ARY_REG 0xB548
244 #define S3V_3DTRI_GS_BS_ID 132
245 #define S3V_3DTRI_GS_BS_REG 0xB54C
246 #define S3V_3DTRI_AS_RS_ID 133
247 #define S3V_3DTRI_AS_RS_REG 0xB550
248 /* vertex regs */
249 #define S3V_3DTRI_ZXD_ID 134
250 #define S3V_3DTRI_ZXD_REG 0xB554
251 #define S3V_3DTRI_ZYD_ID 135
252 #define S3V_3DTRI_ZYD_REG 0xB558
253 #define S3V_3DTRI_ZSTART_ID 136
254 #define S3V_3DTRI_ZSTART_REG 0xB55C
255 #define S3V_3DTRI_TXDELTA12_ID 137
256 #define S3V_3DTRI_TXDELTA12_REG 0xB560
257 #define S3V_3DTRI_TXEND12_ID 138
258 #define S3V_3DTRI_TXEND12_REG 0xB564
259 #define S3V_3DTRI_TXDELTA01_ID 139
260 #define S3V_3DTRI_TXDELTA01_REG 0xB568
261 #define S3V_3DTRI_TXEND01_ID 140
262 #define S3V_3DTRI_TXEND01_REG 0xB56C
263 #define S3V_3DTRI_TXDELTA02_ID 141
264 #define S3V_3DTRI_TXDELTA02_REG 0xB570
265 #define S3V_3DTRI_TXSTART02_ID 142
266 #define S3V_3DTRI_TXSTART02_REG 0xB574
267 #define S3V_3DTRI_TYS_ID 143
268 #define S3V_3DTRI_TYS_REG 0xB578
269 #define S3V_3DTRI_TY01_Y12_ID 144
270 #define S3V_3DTRI_TY01_Y12_REG 0xB57C
271
272 /* COMMANDS (to 0xB100 [lines] or 0xB500 [tris]) */
273
274 /* Auto execute */
275 #define AUTO_EXEC_MASK 0x00000001
276 #define AUTO_EXEC_OFF (0x0)
277 #define AUTO_EXEC_ON (0x1)
278 /* HW clipping */
279 #define HW_CLIP_MASK 0x00000002
280 #define HW_CLIP_OFF (0x0 << 1)
281 #define HW_CLIP_ON (0x1 << 1)
282 /* Destination color */
283 #define DEST_COL_MASK 0x0000001c
284 #define DEST_COL_PAL (0x0 << 2) /* 8 bpp - palettized */
285 #define DEST_COL_1555 (0x1 << 2) /* 16 bpp - ZRGB */
286 #define DEST_COL_888 (0x2 << 2) /* 24 bpp - RGB */
287 /* Texture color */
288 #define TEX_COL_MASK 0x000000e0
289 #define TEX_COL_ARGB8888 (0x0 << 5) /* 32 bpp - ARGB */
290 #define TEX_COL_ARGB4444 (0x1 << 5) /* 16 bpp - ARGB */
291 #define TEX_COL_ARGB1555 (0x2 << 5) /* 16 bpp - ARGB */
292 #define TEX_COL_ALPHA4 (0x3 << 5) /* 8 bpp - ALPHA4 */
293 #define TEX_COL_BLEND4_LOW (0x4 << 5) /* 4 bpp - BLEND4 low nibble */
294 #define TEX_COL_BLEND4_HIGH (0x5 << 5) /* 4 bpp - BLEND4 high nibble */
295 #define TEX_COL_PAL (0x6 << 5) /* 8 bpp - palettized */
296 #define TEX_COL_YUV (0x7 << 5) /* 16 bpp - YUV */
297 /* Mipmap level */
298 #define MIP_MASK 0x00000f00
299 #define MIPMAP_LEVEL(s) (s << 8) /* 8 -> 11 bits */
300 /* Texture filtering */
301 #define TEX_FILTER_MASK 0x00007000
302 #define MIP_NEAREST (0x0 << 12)
303 #define LINEAR_MIP_NEAREST (0x1 << 12)
304 #define MIP_LINEAR (0x2 << 12)
305 #define LINEAR_MIP_LINEAR (0x3 << 12)
306 #define NEAREST (0x4 << 12)
307 #define FAST_BILINEAR (0x5 << 12)
308 #define LINEAR (0x6 << 12)
309 /* Texture blending */
310 #define TEX_BLEND_MAKS 0x00018000
311 #define TEX_REFLECT (0x0 << 15)
312 #define TEX_MODULATE (0x1 << 15)
313 #define TEX_DECAL (0x2 << 15)
314 /* Fog */
315 #define FOG_MASK 0x00020000
316 #define FOG_OFF (0x0 << 17)
317 #define FOG_ON (0x1 << 17)
318 /* Alpha blending */
319 #define ALPHA_BLEND_MASK 0x000c0000
320 #define ALPHA_OFF (0x0 << 18) | (0x0 << 19)
321 #define ALPHA_TEX (0x2 << 18)
322 #define ALPHA_SRC (0x3 << 18)
323 /* Depth compare mode */
324 #define Z_MODE_MASK 0x00700000
325 #define Z_NEVER (0x0 << 20)
326 #define Z_GREATER (0x1 << 20)
327 #define Z_EQUAL (0x2 << 20)
328 #define Z_GEQUAL (0x3 << 20)
329 #define Z_LESS (0x4 << 20)
330 #define Z_NOTEQUAL (0x5 << 20)
331 #define Z_LEQUAL (0x6 << 20)
332 #define Z_ALWAYS (0x7 << 20)
333 /* Depth update */
334 #define Z_UPDATE_MASK 0x00800000
335 #define Z_UPDATE_OFF (0x0 << 23) /* disable z update */
336 #define Z_UPDATE_ON (0x1 << 23)
337 /* Depth buffering mode */
338 #define Z_BUFFER_MASK 0x03000000
339 #define Z_BUFFER (0x0 << 24) | (0x0 << 25)
340 #define Z_MUX_BUF (0x1 << 24) | (0x0 << 25)
341 #define Z_MUX_DRAW (0x2 << 24)
342 #define Z_OFF (0x3 << 24) /* no z buffering */
343 /* Texture wrapping */
344 #define TEX_WRAP_MASK 0x04000000
345 #define TEX_WRAP_OFF (0x0 << 26)
346 #define TEX_WRAP_ON (0x1 << 26)
347 /* 3d command */
348 #define DO_MASK 0x78000000
349 #define DO_GOURAUD_TRI (0x0 << 27)
350 #define DO_TEX_LIT_TRI_OLD (0x1 << 27)
351 #define DO_TEX_UNLIT_TRI_OLD (0x2 << 27)
352 #define DO_TEX_LIT_TRI (0x5 << 27)
353 #define DO_TEX_UNLIT_TRI (0x6 << 27)
354 #define DO_3D_LINE (0x8 << 27)
355 #define DO_NOP (0xf << 27) /* turn on autoexec */
356 /* status */
357 #define CMD_MASK 0x80000000
358 #define CMD_2D (0x0 << 31) /* execute a 2d cmd */
359 #define CMD_3D (0x1 << 31) /* execute a 3d cmd */
360
361 /* global masks */
362 #define TEX_MASK ( TEX_COL_MASK | TEX_WRAP_MASK | MIP_MASK \
363 | TEX_FILTER_MASK | TEX_BLEND_MAKS \
364 | TEX_WRAP_MASK )
365 #define Z_MASK ( Z_MODE_MASK | Z_UPDATE_MASK | Z_BUFFER_MASK )
366
367 #endif /* _S3V_REG_H */