2 * Copyright 2008 Ben Skeggs
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 #include "nv_include.h"
24 #include "nvc0_accel.h"
26 #define NOUVEAU_BO(a, b, m) (NOUVEAU_BO_##a | NOUVEAU_BO_##b | NOUVEAU_BO_##m)
29 NVAccelInitM2MF_NVC0(ScrnInfoPtr pScrn
)
31 NVPtr pNv
= NVPTR(pScrn
);
32 struct nouveau_channel
*chan
= pNv
->chan
;
35 ret
= nouveau_grobj_alloc(chan
, 0x9039, 0x9039, &pNv
->NvMemFormat
);
43 NVAccelInit2D_NVC0(ScrnInfoPtr pScrn
)
45 NVPtr pNv
= NVPTR(pScrn
);
46 struct nouveau_channel
*chan
= pNv
->chan
;
49 ret
= nouveau_grobj_alloc(chan
, 0x902d, 0x902d, &pNv
->Nv2D
);
53 BEGIN_RING(chan
, pNv
->Nv2D
, NV50_2D_CLIP_ENABLE
, 1);
55 BEGIN_RING(chan
, pNv
->Nv2D
, NV50_2D_COLOR_KEY_ENABLE
, 1);
57 BEGIN_RING(chan
, pNv
->Nv2D
, 0x0884, 1);
58 OUT_RING (chan
, 0x3f);
59 BEGIN_RING(chan
, pNv
->Nv2D
, 0x0888, 1);
61 BEGIN_RING(chan
, pNv
->Nv2D
, NV50_2D_ROP
, 1);
62 OUT_RING (chan
, 0x55);
63 BEGIN_RING(chan
, pNv
->Nv2D
, NV50_2D_OPERATION
, 1);
64 OUT_RING (chan
, NV50_2D_OPERATION_SRCCOPY
);
66 BEGIN_RING(chan
, pNv
->Nv2D
, NV50_2D_BLIT_DU_DX_FRACT
, 4);
71 BEGIN_RING(chan
, pNv
->Nv2D
, NV50_2D_DRAW_SHAPE
, 2);
73 OUT_RING (chan
, NV50_SURFACE_FORMAT_R5G6B5_UNORM
);
74 BEGIN_RING(chan
, pNv
->Nv2D
, NV50_2D_PATTERN_FORMAT
, 2);
79 #if !defined(__AROS__)
80 pNv
->currentRop
= 0xfffffffa;
86 NVAccelInit3D_NVC0(ScrnInfoPtr pScrn
)
88 NVPtr pNv
= NVPTR(pScrn
);
89 struct nouveau_channel
*chan
= pNv
->chan
;
90 struct nouveau_grobj
*fermi
, *m2mf
;
91 struct nouveau_bo
*bo
;
95 ret
= nouveau_grobj_alloc(chan
, 0x9097, 0x9097, &pNv
->Nv3D
);
99 ret
= nouveau_bo_new(pNv
->dev
, NOUVEAU_BO_VRAM
,
100 (128 << 10), 0x20000,
101 &pNv
->tesla_scratch
);
103 nouveau_grobj_free(&pNv
->Nv3D
);
107 bo
= pNv
->tesla_scratch
;
108 m2mf
= pNv
->NvMemFormat
;
111 if (MARK_RING(chan
, 512, 32))
114 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_NOTIFY_ADDRESS_HIGH
, 3);
115 OUT_RELOCh(chan
, bo
, NTFY_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RDWR
);
116 OUT_RELOCl(chan
, bo
, NTFY_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RDWR
);
119 BEGIN_RING(chan
, fermi
, NVC0_GRAPH_NOTIFY_ADDRESS_HIGH
, 3);
120 OUT_RELOCh(chan
, bo
, NTFY_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RDWR
);
121 OUT_RELOCl(chan
, bo
, NTFY_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RDWR
);
124 BEGIN_RING(chan
, fermi
, NVC0_3D_MULTISAMPLE_COLOR_ENABLE
, 1);
126 BEGIN_RING(chan
, fermi
, NVC0_3D_MULTISAMPLE_ZETA_ENABLE
, 1);
128 BEGIN_RING(chan
, fermi
, NVC0_3D_MULTISAMPLE_MODE
, 1);
129 OUT_RING (chan
, NVC0_3D_MULTISAMPLE_MODE_1X
);
131 BEGIN_RING(chan
, fermi
, NVC0_3D_COND_MODE
, 1);
132 OUT_RING (chan
, NVC0_3D_COND_MODE_ALWAYS
);
133 BEGIN_RING(chan
, fermi
, NVC0_3D_RT_CONTROL
, 1);
135 BEGIN_RING(chan
, fermi
, NVC0_3D_ZETA_ENABLE
, 1);
137 BEGIN_RING(chan
, fermi
, NVC0_3D_VIEWPORT_CLIP_RECTS_EN
, 2);
140 BEGIN_RING(chan
, fermi
, NVC0_3D_CLIPID_ENABLE
, 1);
142 BEGIN_RING(chan
, fermi
, NVC0_3D_VERTEX_TWO_SIDE_ENABLE
, 1);
144 BEGIN_RING(chan
, fermi
, 0x0fac, 1);
146 BEGIN_RING(chan
, fermi
, NVC0_3D_COLOR_MASK(0), 8);
147 OUT_RING (chan
, 0x1111);
148 for (i
= 1; i
< 8; ++i
)
152 BEGIN_RING(chan
, fermi
, NVC0_3D_SCREEN_SCISSOR_HORIZ
, 2);
153 OUT_RING (chan
, (8192 << 16) | 0);
154 OUT_RING (chan
, (8192 << 16) | 0);
155 BEGIN_RING(chan
, fermi
, NVC0_3D_Y_ORIGIN_BOTTOM
, 1);
157 BEGIN_RING(chan
, fermi
, NVC0_3D_WINDOW_OFFSET_X
, 2);
160 BEGIN_RING(chan
, fermi
, 0x1590, 1);
163 BEGIN_RING(chan
, fermi
, NVC0_3D_LINKED_TSC
, 1);
166 BEGIN_RING(chan
, fermi
, NVC0_3D_VIEWPORT_TRANSFORM_EN
, 1);
168 BEGIN_RING(chan
, fermi
, NVC0_3D_VIEW_VOLUME_CLIP_CTRL
, 1);
170 BEGIN_RING(chan
, fermi
, NVC0_3D_DEPTH_RANGE_NEAR(0), 2);
171 OUT_RINGf (chan
, 0.0f
);
172 OUT_RINGf (chan
, 1.0f
);
174 BEGIN_RING(chan
, fermi
, NVC0_3D_TEX_LIMITS(4), 1);
175 OUT_RING (chan
, 0x54);
177 BEGIN_RING(chan
, fermi
, NVC0_3D_BLEND_ENABLE(0), 8);
179 for (i
= 1; i
< 8; ++i
)
181 BEGIN_RING(chan
, fermi
, NVC0_3D_BLEND_INDEPENDENT
, 1);
184 BEGIN_RING(chan
, fermi
, 0x17bc, 3);
185 OUT_RELOCh(chan
, bo
, MISC_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RDWR
);
186 OUT_RELOCl(chan
, bo
, MISC_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RDWR
);
190 BEGIN_RING(chan
, fermi
, NVC0_3D_CODE_ADDRESS_HIGH
, 2);
191 OUT_RELOCh(chan
, bo
, CODE_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RD
);
192 OUT_RELOCl(chan
, bo
, CODE_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_RD
);
194 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
195 if (OUT_RELOCh(chan
, bo
, PVP_PASS
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
196 OUT_RELOCl(chan
, bo
, PVP_PASS
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
200 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
201 OUT_RING (chan
, 7 * 8 + 20 * 4);
203 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
204 OUT_RING (chan
, 0x100111);
205 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 7 * 2 + 20);
206 OUT_RING (chan
, 0x00020461);
210 OUT_RING (chan
, 0xff000);
211 OUT_RING (chan
, 0x00000000); /* VP_ATTR_EN[0x000] */
212 OUT_RING (chan
, 0x0001033f); /* VP_ATTR_EN[0x080] */
213 OUT_RING (chan
, 0x00000000); /* VP_ATTR_EN[0x100] */
214 OUT_RING (chan
, 0x00000000);
215 OUT_RING (chan
, 0x00000000); /* VP_ATTR_EN[0x200] */
216 OUT_RING (chan
, 0x00000000);
217 OUT_RING (chan
, 0x00000000); /* VP_ATTR_EN[0x300] */
218 OUT_RING (chan
, 0x00000000);
219 OUT_RING (chan
, 0x0033f000); /* VP_EXPORT_EN[0x040] */
220 OUT_RING (chan
, 0x00000000); /* VP_EXPORT_EN[0x0c0] */
221 OUT_RING (chan
, 0x00000000);
222 OUT_RING (chan
, 0x00000000);
223 OUT_RING (chan
, 0x00000000);
224 OUT_RING (chan
, 0x00000000); /* VP_EXPORT_EN[0x2c0] */
225 OUT_RING (chan
, 0x00000000);
226 OUT_RING (chan
, 0xfff01c66);
227 OUT_RING (chan
, 0x06000080); /* vfetch { $r0,1,2,3 } b128 a[0x80] */
228 OUT_RING (chan
, 0xfff11c26);
229 OUT_RING (chan
, 0x06000090); /* vfetch { $r4,5 } b64 a[0x90] */
230 OUT_RING (chan
, 0xfff19c26);
231 OUT_RING (chan
, 0x060000a0); /* vfetch { $r6,7 } b64 a[0xa0] */
232 OUT_RING (chan
, 0x03f01c66);
233 OUT_RING (chan
, 0x0a7e0070); /* export v[0x70] { $r0 $r1 $r2 $r3 } */
234 OUT_RING (chan
, 0x13f01c26);
235 OUT_RING (chan
, 0x0a7e0080); /* export v[0x80] { $r4 $r5 } */
236 OUT_RING (chan
, 0x1bf01c26);
237 OUT_RING (chan
, 0x0a7e0090); /* export v[0x90] { $r6 $r7 } */
238 OUT_RING (chan
, 0x00001de7);
239 OUT_RING (chan
, 0x80000000); /* exit */
241 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_SELECT(1), 2);
242 OUT_RING (chan
, 0x11);
243 OUT_RING (chan
, PVP_PASS
);
244 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_GPR_ALLOC(1), 1);
246 BEGIN_RING(chan
, fermi
, 0x163c, 1);
248 BEGIN_RING(chan
, fermi
, 0x2600, 1);
252 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
253 if (OUT_RELOCh(chan
, bo
, PFP_S
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
254 OUT_RELOCl(chan
, bo
, PFP_S
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
258 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
259 OUT_RING (chan
, 6 * 8 + 20 * 4);
261 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
262 OUT_RING (chan
, 0x100111);
263 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 6 * 2 + 20);
264 OUT_RING (chan
, 0x00021462);
265 OUT_RING (chan
, 0x00000000);
266 OUT_RING (chan
, 0x00000000);
267 OUT_RING (chan
, 0x00000000);
268 OUT_RING (chan
, 0x00000000);
269 OUT_RING (chan
, 0x80000000);
270 OUT_RING (chan
, 0x0000000a);
271 OUT_RING (chan
, 0x00000000);
272 OUT_RING (chan
, 0x00000000);
273 OUT_RING (chan
, 0x00000000);
274 OUT_RING (chan
, 0x00000000);
275 OUT_RING (chan
, 0x00000000);
276 OUT_RING (chan
, 0x00000000);
277 OUT_RING (chan
, 0x00000000);
278 OUT_RING (chan
, 0x00000000);
279 OUT_RING (chan
, 0x00000000);
280 OUT_RING (chan
, 0x00000000);
281 OUT_RING (chan
, 0x00000000);
282 OUT_RING (chan
, 0x0000000f);
283 OUT_RING (chan
, 0x00000000);
284 OUT_RING (chan
, 0xfff01c00);
285 OUT_RING (chan
, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
286 OUT_RING (chan
, 0x10001c00);
287 OUT_RING (chan
, 0xc8000000); /* rcp f32 $r0 $r0 */
288 OUT_RING (chan
, 0x03f05c40);
289 OUT_RING (chan
, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
290 OUT_RING (chan
, 0x03f01c40);
291 OUT_RING (chan
, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
292 OUT_RING (chan
, 0xfc001e86);
293 OUT_RING (chan
, 0x8013c000); /* tex { $r0,1,2,3 } $t0 { $r0,1 } */
294 OUT_RING (chan
, 0x00001de7);
295 OUT_RING (chan
, 0x80000000); /* exit */
297 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
298 if (OUT_RELOCh(chan
, bo
, PFP_C
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
299 OUT_RELOCl(chan
, bo
, PFP_C
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
303 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
304 OUT_RING (chan
, 13 * 8 + 20 * 4);
306 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
307 OUT_RING (chan
, 0x100111);
308 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 13 * 2 + 20);
309 OUT_RING (chan
, 0x00021462);
310 OUT_RING (chan
, 0x00000000);
311 OUT_RING (chan
, 0x00000000);
312 OUT_RING (chan
, 0x00000000);
313 OUT_RING (chan
, 0x00000000);
314 OUT_RING (chan
, 0x80000000);
315 OUT_RING (chan
, 0x00000a0a);
316 OUT_RING (chan
, 0x00000000);
317 OUT_RING (chan
, 0x00000000);
318 OUT_RING (chan
, 0x00000000);
319 OUT_RING (chan
, 0x00000000);
320 OUT_RING (chan
, 0x00000000);
321 OUT_RING (chan
, 0x00000000);
322 OUT_RING (chan
, 0x00000000);
323 OUT_RING (chan
, 0x00000000);
324 OUT_RING (chan
, 0x00000000);
325 OUT_RING (chan
, 0x00000000);
326 OUT_RING (chan
, 0x00000000);
327 OUT_RING (chan
, 0x0000000f);
328 OUT_RING (chan
, 0x00000000);
329 OUT_RING (chan
, 0xfff01c00);
330 OUT_RING (chan
, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
331 OUT_RING (chan
, 0x10001c00);
332 OUT_RING (chan
, 0xc8000000); /* rcp f32 $r0 $r0 */
333 OUT_RING (chan
, 0x03f0dc40);
334 OUT_RING (chan
, 0xc07e0094); /* pinterp f32 $r3 $r0 v[$r63+0x94] */
335 OUT_RING (chan
, 0x03f09c40);
336 OUT_RING (chan
, 0xc07e0090); /* pinterp f32 $r2 $r0 v[$r63+0x90] */
337 OUT_RING (chan
, 0xfc211e86);
338 OUT_RING (chan
, 0x80120001); /* tex { _,_,_,$r4 } $t1 { $r2,3 } */
339 OUT_RING (chan
, 0x03f05c40);
340 OUT_RING (chan
, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
341 OUT_RING (chan
, 0x03f01c40);
342 OUT_RING (chan
, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
343 OUT_RING (chan
, 0xfc001e86);
344 OUT_RING (chan
, 0x8013c000); /* tex { $r0,1,2,3 } $t0 { $r0,1 } */
345 OUT_RING (chan
, 0x1030dc40);
346 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r3 $r3 $r4 */
347 OUT_RING (chan
, 0x10209c40);
348 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r2 $r2 $r4 */
349 OUT_RING (chan
, 0x10105c40);
350 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r1 $r1 $r4 */
351 OUT_RING (chan
, 0x10001c40);
352 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r0 $r0 $r4 */
353 OUT_RING (chan
, 0x00001de7);
354 OUT_RING (chan
, 0x80000000); /* exit */
356 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
357 if (OUT_RELOCh(chan
, bo
, PFP_CCA
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
358 OUT_RELOCl(chan
, bo
, PFP_CCA
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
362 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
363 OUT_RING (chan
, 13 * 8 + 20 * 4);
365 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
366 OUT_RING (chan
, 0x100111);
367 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 13 * 2 + 20);
368 OUT_RING (chan
, 0x00021462); /* 0x0000c000 = USES_KIL, MULTI_COLORS */
369 OUT_RING (chan
, 0x00000000);
370 OUT_RING (chan
, 0x00000000);
371 OUT_RING (chan
, 0x00000000);
372 OUT_RING (chan
, 0x00000000);
373 OUT_RING (chan
, 0x80000000); /* FRAG_COORD_UMASK = 0x8 */
374 OUT_RING (chan
, 0x00000a0a); /* FP_INTERP[0x080], 0022 0022 */
375 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x0c0], 0 = OFF */
376 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x100], 1 = FLAT */
377 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x140], 2 = PERSPECTIVE */
378 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x180], 3 = LINEAR */
379 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x1c0] */
380 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x200] */
381 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x240] */
382 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x280] */
383 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x2c0] */
384 OUT_RING (chan
, 0x00000000); /* FP_INTERP[0x300] */
385 OUT_RING (chan
, 0x00000000);
386 OUT_RING (chan
, 0x0000000f); /* FP_RESULT_MASK (0x8000 Face ?) */
387 OUT_RING (chan
, 0x00000000); /* 0x2 = FragDepth, 0x1 = SampleMask */
388 OUT_RING (chan
, 0xfff01c00);
389 OUT_RING (chan
, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
390 OUT_RING (chan
, 0x10001c00);
391 OUT_RING (chan
, 0xc8000000); /* rcp f32 $r0 $r0 */
392 OUT_RING (chan
, 0x03f0dc40);
393 OUT_RING (chan
, 0xc07e0094); /* pinterp f32 $r3 $r0 v[$r63+0x94] */
394 OUT_RING (chan
, 0x03f09c40);
395 OUT_RING (chan
, 0xc07e0090); /* pinterp f32 $r2 $r0 v[$r63+0x90] */
396 OUT_RING (chan
, 0xfc211e86);
397 OUT_RING (chan
, 0x8013c001); /* tex { $r4,5,6,7 } $t1 { $r2,3 } */
398 OUT_RING (chan
, 0x03f05c40);
399 OUT_RING (chan
, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
400 OUT_RING (chan
, 0x03f01c40);
401 OUT_RING (chan
, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
402 OUT_RING (chan
, 0xfc001e86);
403 OUT_RING (chan
, 0x8013c000); /* tex { $r0,1,2,3 } $t0 { $r0,1 } */
404 OUT_RING (chan
, 0x1c30dc40);
405 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r3 $r3 $r7 */
406 OUT_RING (chan
, 0x18209c40);
407 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r2 $r2 $r6 */
408 OUT_RING (chan
, 0x14105c40);
409 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r1 $r1 $r5 */
410 OUT_RING (chan
, 0x10001c40);
411 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r0 $r0 $r4 */
412 OUT_RING (chan
, 0x00001de7);
413 OUT_RING (chan
, 0x80000000); /* exit */
415 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
416 if (OUT_RELOCh(chan
, bo
, PFP_CCASA
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
417 OUT_RELOCl(chan
, bo
, PFP_CCASA
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
421 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
422 OUT_RING (chan
, 13 * 8 + 20 * 4);
424 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
425 OUT_RING (chan
, 0x100111);
426 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 13 * 2 + 20);
427 OUT_RING (chan
, 0x00021462);
428 OUT_RING (chan
, 0x00000000);
429 OUT_RING (chan
, 0x00000000);
430 OUT_RING (chan
, 0x00000000);
431 OUT_RING (chan
, 0x00000000);
432 OUT_RING (chan
, 0x80000000);
433 OUT_RING (chan
, 0x00000a0a);
434 OUT_RING (chan
, 0x00000000);
435 OUT_RING (chan
, 0x00000000);
436 OUT_RING (chan
, 0x00000000);
437 OUT_RING (chan
, 0x00000000);
438 OUT_RING (chan
, 0x00000000);
439 OUT_RING (chan
, 0x00000000);
440 OUT_RING (chan
, 0x00000000);
441 OUT_RING (chan
, 0x00000000);
442 OUT_RING (chan
, 0x00000000);
443 OUT_RING (chan
, 0x00000000);
444 OUT_RING (chan
, 0x00000000);
445 OUT_RING (chan
, 0x0000000f);
446 OUT_RING (chan
, 0x00000000);
447 OUT_RING (chan
, 0xfff01c00);
448 OUT_RING (chan
, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
449 OUT_RING (chan
, 0x10001c00);
450 OUT_RING (chan
, 0xc8000000); /* rcp f32 $r0 $r0 */
451 OUT_RING (chan
, 0x03f0dc40);
452 OUT_RING (chan
, 0xc07e0084); /* pinterp f32 $r3 $r0 v[$r63+0x84] */
453 OUT_RING (chan
, 0x03f09c40);
454 OUT_RING (chan
, 0xc07e0080); /* pinterp f32 $r2 $r0 v[$r63+0x80] */
455 OUT_RING (chan
, 0xfc211e86);
456 OUT_RING (chan
, 0x80120000); /* tex { _,_,_,$r4 } $t0 { $r2,3 } */
457 OUT_RING (chan
, 0x03f05c40);
458 OUT_RING (chan
, 0xc07e0094); /* pinterp f32 $r1 $r0 v[$r63+0x94] */
459 OUT_RING (chan
, 0x03f01c40);
460 OUT_RING (chan
, 0xc07e0090); /* pinterp f32 $r0 $r0 v[$r63+0x90] */
461 OUT_RING (chan
, 0xfc001e86);
462 OUT_RING (chan
, 0x8013c001); /* tex { $r0,1,2,3 } $t1 { $r0,1 } */
463 OUT_RING (chan
, 0x1030dc40);
464 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r3 $r3 $r4 */
465 OUT_RING (chan
, 0x10209c40);
466 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r2 $r2 $r4 */
467 OUT_RING (chan
, 0x10105c40);
468 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r1 $r1 $r4 */
469 OUT_RING (chan
, 0x10001c40);
470 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r0 $r0 $r4 */
471 OUT_RING (chan
, 0x00001de7);
472 OUT_RING (chan
, 0x80000000); /* exit */
474 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
475 if (OUT_RELOCh(chan
, bo
, PFP_S_A8
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
476 OUT_RELOCl(chan
, bo
, PFP_S_A8
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
480 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
481 OUT_RING (chan
, 9 * 8 + 20 * 4);
483 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
484 OUT_RING (chan
, 0x100111);
485 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 9 * 2 + 20);
486 OUT_RING (chan
, 0x00021462);
487 OUT_RING (chan
, 0x00000000);
488 OUT_RING (chan
, 0x00000000);
489 OUT_RING (chan
, 0x00000000);
490 OUT_RING (chan
, 0x00000000);
491 OUT_RING (chan
, 0x80000000);
492 OUT_RING (chan
, 0x0000000a);
493 OUT_RING (chan
, 0x00000000);
494 OUT_RING (chan
, 0x00000000);
495 OUT_RING (chan
, 0x00000000);
496 OUT_RING (chan
, 0x00000000);
497 OUT_RING (chan
, 0x00000000);
498 OUT_RING (chan
, 0x00000000);
499 OUT_RING (chan
, 0x00000000);
500 OUT_RING (chan
, 0x00000000);
501 OUT_RING (chan
, 0x00000000);
502 OUT_RING (chan
, 0x00000000);
503 OUT_RING (chan
, 0x00000000);
504 OUT_RING (chan
, 0x0000000f);
505 OUT_RING (chan
, 0x00000000);
506 OUT_RING (chan
, 0xfff01c00);
507 OUT_RING (chan
, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
508 OUT_RING (chan
, 0x10001c00);
509 OUT_RING (chan
, 0xc8000000); /* rcp f32 $r0 $r0 */
510 OUT_RING (chan
, 0x03f05c40);
511 OUT_RING (chan
, 0xc07e0084); /* pinterp f32 $r1 $r0 v[$r63+0x84] */
512 OUT_RING (chan
, 0x03f01c40);
513 OUT_RING (chan
, 0xc07e0080); /* pinterp f32 $r0 $r0 v[$r63+0x80] */
514 OUT_RING (chan
, 0xfc001e86);
515 OUT_RING (chan
, 0x80120000); /* tex { _ _ _ $r0 } $t0 { $r0 $r1 } */
516 OUT_RING (chan
, 0x0000dde4);
517 OUT_RING (chan
, 0x28000000); /* mov b32 $r3 $r0 */
518 OUT_RING (chan
, 0x00009de4);
519 OUT_RING (chan
, 0x28000000); /* mov b32 $r2 $r0 */
520 OUT_RING (chan
, 0x00005de4);
521 OUT_RING (chan
, 0x28000000); /* mov b32 $r1 $r0 */
522 OUT_RING (chan
, 0x00001de7);
523 OUT_RING (chan
, 0x80000000); /* exit */
525 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
526 if (OUT_RELOCh(chan
, bo
, PFP_C_A8
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
527 OUT_RELOCl(chan
, bo
, PFP_C_A8
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
531 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
532 OUT_RING (chan
, 13 * 8 + 20 * 4);
534 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
535 OUT_RING (chan
, 0x100111);
536 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 13 * 2 + 20);
537 OUT_RING (chan
, 0x00021462);
538 OUT_RING (chan
, 0x00000000);
539 OUT_RING (chan
, 0x00000000);
540 OUT_RING (chan
, 0x00000000);
541 OUT_RING (chan
, 0x00000000);
542 OUT_RING (chan
, 0x80000000);
543 OUT_RING (chan
, 0x00000a0a);
544 OUT_RING (chan
, 0x00000000);
545 OUT_RING (chan
, 0x00000000);
546 OUT_RING (chan
, 0x00000000);
547 OUT_RING (chan
, 0x00000000);
548 OUT_RING (chan
, 0x00000000);
549 OUT_RING (chan
, 0x00000000);
550 OUT_RING (chan
, 0x00000000);
551 OUT_RING (chan
, 0x00000000);
552 OUT_RING (chan
, 0x00000000);
553 OUT_RING (chan
, 0x00000000);
554 OUT_RING (chan
, 0x00000000);
555 OUT_RING (chan
, 0x0000000f);
556 OUT_RING (chan
, 0x00000000);
557 OUT_RING (chan
, 0xfff01c00);
558 OUT_RING (chan
, 0xc07e007c); /* linterp f32 $r0 v[$r63+0x7c] */
559 OUT_RING (chan
, 0x10001c00);
560 OUT_RING (chan
, 0xc8000000); /* rcp f32 $r0 $r0 */
561 OUT_RING (chan
, 0x03f0dc40);
562 OUT_RING (chan
, 0xc07e0094); /* pinterp f32 $r3 $r0 v[$r63+0x94] */
563 OUT_RING (chan
, 0x03f09c40);
564 OUT_RING (chan
, 0xc07e0090); /* pinterp f32 $r2 $r0 v[$r63+0x90] */
565 OUT_RING (chan
, 0xfc205e86);
566 OUT_RING (chan
, 0x80120001); /* tex { _ _ _ $r1 } $t1 { $r2 $r3 } */
567 OUT_RING (chan
, 0x03f0dc40);
568 OUT_RING (chan
, 0xc07e0084); /* pinterp f32 $r3 $r0 v[$r63+0x84] */
569 OUT_RING (chan
, 0x03f09c40);
570 OUT_RING (chan
, 0xc07e0080); /* pinterp f32 $r2 $r0 v[$r63+0x80] */
571 OUT_RING (chan
, 0xfc201e86);
572 OUT_RING (chan
, 0x80120000); /* tex { _ _ _ $r0 } $t0 { $r2 $r3 } */
573 OUT_RING (chan
, 0x0400dc40);
574 OUT_RING (chan
, 0x58000000); /* mul ftz rn f32 $r3 $r0 $r1 */
575 OUT_RING (chan
, 0x0c009de4);
576 OUT_RING (chan
, 0x28000000); /* mov b32 $r2 $r3 */
577 OUT_RING (chan
, 0x0c005de4);
578 OUT_RING (chan
, 0x28000000); /* mov b32 $r1 $r3 */
579 OUT_RING (chan
, 0x0c001de4);
580 OUT_RING (chan
, 0x28000000); /* mov b32 $r0 $r3 */
581 OUT_RING (chan
, 0x00001de7);
582 OUT_RING (chan
, 0x80000000); /* exit */
585 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_OFFSET_OUT_HIGH
, 2);
586 if (OUT_RELOCh(chan
, bo
, PFP_NV12
, NOUVEAU_BO(VRAM
, VRAM
, WR
)) ||
587 OUT_RELOCl(chan
, bo
, PFP_NV12
, NOUVEAU_BO(VRAM
, VRAM
, WR
))) {
591 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_LINE_LENGTH_IN
, 2);
592 OUT_RING (chan
, 19 * 8 + 20 * 4);
594 BEGIN_RING(chan
, m2mf
, NVC0_M2MF_EXEC
, 1);
595 OUT_RING (chan
, 0x100111);
596 BEGIN_RING_NI(chan
, m2mf
, NVC0_M2MF_DATA
, 19 * 2 + 20);
597 OUT_RING (chan
, 0x00021462);
598 OUT_RING (chan
, 0x00000000);
599 OUT_RING (chan
, 0x00000000);
600 OUT_RING (chan
, 0x00000000);
601 OUT_RING (chan
, 0x00000000);
602 OUT_RING (chan
, 0x80000000);
603 OUT_RING (chan
, 0x00000a0a);
604 OUT_RING (chan
, 0x00000000);
605 OUT_RING (chan
, 0x00000000);
606 OUT_RING (chan
, 0x00000000);
607 OUT_RING (chan
, 0x00000000);
608 OUT_RING (chan
, 0x00000000);
609 OUT_RING (chan
, 0x00000000);
610 OUT_RING (chan
, 0x00000000);
611 OUT_RING (chan
, 0x00000000);
612 OUT_RING (chan
, 0x00000000);
613 OUT_RING (chan
, 0x00000000);
614 OUT_RING (chan
, 0x00000000);
615 OUT_RING (chan
, 0x0000000f);
616 OUT_RING (chan
, 0x00000000);
617 OUT_RING (chan
, 0xfff09c00);
618 OUT_RING (chan
, 0xc07e007c);
619 OUT_RING (chan
, 0x10209c00);
620 OUT_RING (chan
, 0xc8000000);
621 OUT_RING (chan
, 0x0bf01c40);
622 OUT_RING (chan
, 0xc07e0080);
623 OUT_RING (chan
, 0x0bf05c40);
624 OUT_RING (chan
, 0xc07e0084);
625 OUT_RING (chan
, 0xfc001e86);
626 OUT_RING (chan
, 0x80120000);
627 OUT_RING (chan
, 0x00015c40);
628 OUT_RING (chan
, 0x58004000);
629 OUT_RING (chan
, 0x1050dc20);
630 OUT_RING (chan
, 0x50004000);
631 OUT_RING (chan
, 0x20511c20);
632 OUT_RING (chan
, 0x50004000);
633 OUT_RING (chan
, 0x30515c20);
634 OUT_RING (chan
, 0x50004000);
635 OUT_RING (chan
, 0x0bf01c40);
636 OUT_RING (chan
, 0xc07e0090);
637 OUT_RING (chan
, 0x0bf05c40);
638 OUT_RING (chan
, 0xc07e0094);
639 OUT_RING (chan
, 0xfc001e86);
640 OUT_RING (chan
, 0x80130001);
641 OUT_RING (chan
, 0x4000dc40);
642 OUT_RING (chan
, 0x30064000);
643 OUT_RING (chan
, 0x50011c40);
644 OUT_RING (chan
, 0x30084000);
645 OUT_RING (chan
, 0x60015c40);
646 OUT_RING (chan
, 0x300a4000);
647 OUT_RING (chan
, 0x70101c40);
648 OUT_RING (chan
, 0x30064000);
649 OUT_RING (chan
, 0x90109c40);
650 OUT_RING (chan
, 0x300a4000);
651 OUT_RING (chan
, 0x80105c40);
652 OUT_RING (chan
, 0x30084000);
653 OUT_RING (chan
, 0x00001de7);
654 OUT_RING (chan
, 0x80000000);
656 BEGIN_RING(chan
, fermi
, 0x021c, 1); /* CODE_FLUSH ? */
657 OUT_RING (chan
, 0x1111);
660 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_SELECT(5), 2);
661 OUT_RING (chan
, 0x51);
662 OUT_RING (chan
, PFP_S
);
663 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_GPR_ALLOC(5), 1);
666 BEGIN_RING(chan
, fermi
, NVC0_3D_CB_SIZE
, 3);
667 OUT_RING (chan
, 256);
668 if (OUT_RELOCh(chan
, bo
, CB_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
) ||
669 OUT_RELOCl(chan
, bo
, CB_OFFSET
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
)) {
673 BEGIN_RING(chan
, fermi
, NVC0_3D_CB_BIND(4), 1);
674 OUT_RING (chan
, 0x01);
676 BEGIN_RING(chan
, fermi
, NVC0_3D_EARLY_FRAGMENT_TESTS
, 1);
678 BEGIN_RING(chan
, fermi
, 0x0360, 2);
679 OUT_RING (chan
, 0x20164010);
680 OUT_RING (chan
, 0x20);
681 BEGIN_RING(chan
, fermi
, 0x196c, 1);
683 BEGIN_RING(chan
, fermi
, 0x1664, 1);
685 BEGIN_RING(chan
, fermi
, NVC0_3D_FRAG_COLOR_CLAMP_EN
, 1);
686 OUT_RING (chan
, 0x11111111);
688 BEGIN_RING(chan
, fermi
, NVC0_3D_DEPTH_TEST_ENABLE
, 1);
691 BEGIN_RING(chan
, fermi
, NVC0_3D_RASTERIZE_ENABLE
, 1);
693 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_SELECT(4), 1);
694 OUT_RING (chan
, 0x40);
695 BEGIN_RING(chan
, fermi
, NVC0_3D_GP_BUILTIN_RESULT_EN
, 1);
697 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_SELECT(3), 1);
698 OUT_RING (chan
, 0x30);
699 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_SELECT(2), 1);
700 OUT_RING (chan
, 0x20);
701 BEGIN_RING(chan
, fermi
, NVC0_3D_SP_SELECT(0), 1);
702 OUT_RING (chan
, 0x00);
704 BEGIN_RING(chan
, fermi
, 0x1604, 1);
706 BEGIN_RING(chan
, fermi
, NVC0_3D_POINT_SPRITE_ENABLE
, 1);
708 BEGIN_RING(chan
, fermi
, NVC0_3D_SCISSOR_ENABLE(0), 1);
711 BEGIN_RING(chan
, fermi
, NVC0_3D_VIEWPORT_HORIZ(0), 2);
712 OUT_RING (chan
, (8192 << 16) | 0);
713 OUT_RING (chan
, (8192 << 16) | 0);
714 BEGIN_RING(chan
, fermi
, NVC0_3D_SCISSOR_HORIZ(0), 2);
715 OUT_RING (chan
, (8192 << 16) | 0);
716 OUT_RING (chan
, (8192 << 16) | 0);