r300: respect radeon common code fallbacks
[mesa.git] / src / gallium / drivers / nv40 / nv40_state_emit.c
index 789ed16126a330499100a580bcdfe57284ef5611..8990f303ce4e300d7465d5da6fe38571d2768270 100644 (file)
@@ -13,6 +13,7 @@ static struct nv40_state_entry *render_states[] = {
        &nv40_state_blend,
        &nv40_state_blend_colour,
        &nv40_state_zsa,
+       &nv40_state_sr,
        &nv40_state_viewport,
        &nv40_state_vbo,
        NULL
@@ -29,6 +30,7 @@ static struct nv40_state_entry *swtnl_states[] = {
        &nv40_state_blend,
        &nv40_state_blend_colour,
        &nv40_state_zsa,
+       &nv40_state_sr,
        &nv40_state_viewport,
        &nv40_state_vtxfmt,
        NULL
@@ -54,19 +56,22 @@ nv40_state_do_validate(struct nv40_context *nv40,
 void
 nv40_state_emit(struct nv40_context *nv40)
 {
-       struct nouveau_channel *chan = nv40->screen->base.channel;
        struct nv40_state *state = &nv40->state;
        struct nv40_screen *screen = nv40->screen;
+       struct nouveau_channel *chan = screen->base.channel;
+       struct nouveau_grobj *curie = screen->curie;
        unsigned i;
        uint64_t states;
 
-       if (nv40->pctx_id != screen->cur_pctx) {
+       /* XXX: race conditions
+        */
+       if (nv40 != screen->cur_ctx) {
                for (i = 0; i < NV40_STATE_MAX; i++) {
                        if (state->hw[i] && screen->state[i] != state->hw[i])
                                state->dirty |= (1ULL << i);
                }
 
-               screen->cur_pctx = nv40->pctx_id;
+               screen->cur_ctx = nv40;
        }
 
        for (i = 0, states = state->dirty; states; i++) {
@@ -80,10 +85,10 @@ nv40_state_emit(struct nv40_context *nv40)
 
        if (state->dirty & ((1ULL << NV40_STATE_FRAGPROG) |
                            (1ULL << NV40_STATE_FRAGTEX0))) {
-               BEGIN_RING(curie, NV40TCL_TEX_CACHE_CTL, 1);
-               OUT_RING  (2);
-               BEGIN_RING(curie, NV40TCL_TEX_CACHE_CTL, 1);
-               OUT_RING  (1);
+               BEGIN_RING(chan, curie, NV40TCL_TEX_CACHE_CTL, 1);
+               OUT_RING  (chan, 2);
+               BEGIN_RING(chan, curie, NV40TCL_TEX_CACHE_CTL, 1);
+               OUT_RING  (chan, 1);
        }
 
        state->dirty = 0;