1 #include "nv30_context.h"
2 #include "nv30_state.h"
5 nv30_emit_hw_state(struct nv30_context
*nv30
)
9 if (nv30
->dirty
& NV30_NEW_FRAGPROG
) {
10 nv30_fragprog_bind(nv30
, nv30
->fragprog
.current
);
11 /*XXX: clear NV30_NEW_FRAGPROG if no new program uploaded */
14 if (nv30
->dirty_samplers
|| (nv30
->dirty
& NV30_NEW_FRAGPROG
)) {
15 nv30_fragtex_bind(nv30
);
17 BEGIN_RING(rankine, NV34TCL_TX_CACHE_CTL, 1);
19 BEGIN_RING(rankine, NV34TCL_TX_CACHE_CTL, 1);
21 nv30
->dirty
&= ~NV30_NEW_FRAGPROG
;
24 if (nv30
->dirty
& NV30_NEW_VERTPROG
) {
25 nv30_vertprog_bind(nv30
, nv30
->vertprog
.current
);
26 nv30
->dirty
&= ~NV30_NEW_VERTPROG
;
29 nv30
->dirty_samplers
= 0;
31 /* Emit relocs for every referenced buffer.
32 * This is to ensure the bufmgr has an accurate idea of how
33 * the buffer is used. This isn't very efficient, but we don't
34 * seem to take a significant performance hit. Will be improved
35 * at some point. Vertex arrays are emitted by nv30_vbo.c
39 if (nv30
->rt_enable
& NV34TCL_RT_ENABLE_COLOR0
) {
40 BEGIN_RING(rankine
, NV34TCL_DMA_COLOR0
, 1);
41 OUT_RELOCo(nv30
->rt
[0], NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
);
42 BEGIN_RING(rankine
, NV34TCL_COLOR0_OFFSET
, 1);
43 OUT_RELOCl(nv30
->rt
[0], 0, NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
);
46 if (nv30
->rt_enable
& NV34TCL_RT_ENABLE_COLOR1
) {
47 BEGIN_RING(rankine
, NV34TCL_DMA_COLOR1
, 1);
48 OUT_RELOCo(nv30
->rt
[1], NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
);
49 BEGIN_RING(rankine
, NV34TCL_COLOR1_OFFSET
, 1);
50 OUT_RELOCl(nv30
->rt
[1], 0, NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
);
54 BEGIN_RING(rankine
, NV34TCL_DMA_ZETA
, 1);
55 OUT_RELOCo(nv30
->zeta
, NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
);
56 BEGIN_RING(rankine
, NV34TCL_ZETA_OFFSET
, 1);
57 OUT_RELOCl(nv30
->zeta
, 0, NOUVEAU_BO_VRAM
| NOUVEAU_BO_WR
);
58 /* XXX allocate LMA */
59 /* BEGIN_RING(rankine, NV34TCL_LMA_DEPTH_OFFSET, 1);
63 /* Texture images, emitted in nv30_fragtex_build */
65 for (i
= 0; i
< 16; i
++) {
66 if (!(nv30
->fp_samplers
& (1 << i
)))
68 BEGIN_RING(rankine
, NV34TCL_TX_OFFSET(i
), 2);
69 OUT_RELOCl(nv30
->tex
[i
].buffer
, 0, NOUVEAU_BO_VRAM
|
70 NOUVEAU_BO_GART
| NOUVEAU_BO_RD
);
71 OUT_RELOCd(nv30
->tex
[i
].buffer
, nv30
->tex
[i
].format
,
72 NOUVEAU_BO_VRAM
| NOUVEAU_BO_GART
| NOUVEAU_BO_RD
|
73 NOUVEAU_BO_OR
, NV34TCL_TX_FORMAT_DMA0
,
74 NV34TCL_TX_FORMAT_DMA1
);
78 /* Fragment program */
79 BEGIN_RING(rankine
, NV34TCL_FP_ACTIVE_PROGRAM
, 1);
80 OUT_RELOC (nv30
->fragprog
.active
->buffer
, 0, NOUVEAU_BO_VRAM
|
81 NOUVEAU_BO_GART
| NOUVEAU_BO_RD
| NOUVEAU_BO_LOW
|
82 NOUVEAU_BO_OR
, NV34TCL_FP_ACTIVE_PROGRAM_DMA0
,
83 NV34TCL_FP_ACTIVE_PROGRAM_DMA1
);