1 #include "nv40_context.h"
2 #include "nv40_state.h"
4 /* Emit relocs for every referenced buffer.
6 * This is to ensure the bufmgr has an accurate idea of how
7 * the buffer is used. These relocs appear in the push buffer as
8 * NOPs, and will only be turned into state changes if a buffer
12 nv40_state_emit_dummy_relocs(struct nv40_context
*nv40
)
16 so_emit_reloc_markers(nv40
->nvws
, nv40
->so_framebuffer
);
17 for (i
= 0; i
< 16; i
++) {
18 if (!(nv40
->fp_samplers
& (1 << i
)))
20 so_emit_reloc_markers(nv40
->nvws
, nv40
->so_fragtex
[i
]);
22 so_emit_reloc_markers(nv40
->nvws
, nv40
->fragprog
.active
->so
);
26 nv40_emit_hw_state(struct nv40_context
*nv40
)
28 if (nv40
->dirty
& NV40_NEW_FB
)
29 so_emit(nv40
->nvws
, nv40
->so_framebuffer
);
31 if (nv40
->dirty
& NV40_NEW_BLEND
)
32 so_emit(nv40
->nvws
, nv40
->so_blend
);
34 if (nv40
->dirty
& NV40_NEW_RAST
)
35 so_emit(nv40
->nvws
, nv40
->so_rast
);
37 if (nv40
->dirty
& NV40_NEW_ZSA
)
38 so_emit(nv40
->nvws
, nv40
->so_zsa
);
40 if (nv40
->dirty
& NV40_NEW_BCOL
)
41 so_emit(nv40
->nvws
, nv40
->so_bcol
);
43 if (nv40
->dirty
& NV40_NEW_SCISSOR
)
44 so_emit(nv40
->nvws
, nv40
->so_scissor
);
46 if (nv40
->dirty
& NV40_NEW_VIEWPORT
)
47 so_emit(nv40
->nvws
, nv40
->so_viewport
);
49 if (nv40
->dirty
& NV40_NEW_STIPPLE
)
50 so_emit(nv40
->nvws
, nv40
->so_stipple
);
52 if (nv40
->dirty
& NV40_NEW_FRAGPROG
) {
53 nv40_fragprog_bind(nv40
, nv40
->fragprog
.current
);
54 /*XXX: clear NV40_NEW_FRAGPROG if no new program uploaded */
57 if (nv40
->dirty_samplers
|| (nv40
->dirty
& NV40_NEW_FRAGPROG
)) {
58 nv40_fragtex_bind(nv40
);
60 BEGIN_RING(curie
, NV40TCL_TEX_CACHE_CTL
, 1);
62 BEGIN_RING(curie
, NV40TCL_TEX_CACHE_CTL
, 1);
64 nv40
->dirty
&= ~NV40_NEW_FRAGPROG
;
67 if (nv40
->dirty
& NV40_NEW_VERTPROG
) {
68 nv40_vertprog_bind(nv40
, nv40
->vertprog
.current
);
69 nv40
->dirty
&= ~NV40_NEW_VERTPROG
;
72 nv40
->dirty_samplers
= 0;
75 nv40_state_emit_dummy_relocs(nv40
);