st/mesa: fix incorrect RowStride computation
[mesa.git] / src / gallium / drivers / nv30 / nv30_state_emit.c
index f77b08ff6959096a3a514a02eba90f1928d8ec25..deefe7fd8db1eba2cf47c265ecafd1f2cc2ec984 100644 (file)
@@ -12,6 +12,7 @@ static struct nv30_state_entry *render_states[] = {
        &nv30_state_blend,
        &nv30_state_blend_colour,
        &nv30_state_zsa,
+       &nv30_state_sr,
        &nv30_state_viewport,
        &nv30_state_vbo,
        NULL
@@ -21,14 +22,6 @@ static void
 nv30_state_do_validate(struct nv30_context *nv30,
                       struct nv30_state_entry **states)
 {
-       const struct pipe_framebuffer_state *fb = &nv30->framebuffer;
-       unsigned i;
-
-       for (i = 0; i < fb->nr_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        while (*states) {
                struct nv30_state_entry *e = *states;
 
@@ -46,18 +39,21 @@ nv30_state_do_validate(struct nv30_context *nv30,
 void
 nv30_state_emit(struct nv30_context *nv30)
 {
+       struct nouveau_channel *chan = nv30->screen->base.channel;
        struct nv30_state *state = &nv30->state;
        struct nv30_screen *screen = nv30->screen;
-       unsigned i, samplers;
+       unsigned i;
        uint64_t states;
 
-       if (nv30->pctx_id != screen->cur_pctx) {
+       /* XXX: racy!
+        */
+       if (nv30 != screen->cur_ctx) {
                for (i = 0; i < NV30_STATE_MAX; i++) {
                        if (state->hw[i] && screen->state[i] != state->hw[i])
                                state->dirty |= (1ULL << i);
                }
 
-               screen->cur_pctx = nv30->pctx_id;
+               screen->cur_ctx = nv30;
        }
 
        for (i = 0, states = state->dirty; states; i++) {
@@ -65,23 +61,31 @@ nv30_state_emit(struct nv30_context *nv30)
                        continue;
                so_ref (state->hw[i], &nv30->screen->state[i]);
                if (state->hw[i])
-                       so_emit(nv30->nvws, nv30->screen->state[i]);
+                       so_emit(chan, nv30->screen->state[i]);
                states &= ~(1ULL << i);
        }
 
        state->dirty = 0;
+}
+
+void
+nv30_state_flush_notify(struct nouveau_channel *chan)
+{
+       struct nv30_context *nv30 = chan->user_private;
+       struct nv30_state *state = &nv30->state;
+       unsigned i, samplers;
 
-       so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FB]);
+       so_emit_reloc_markers(chan, state->hw[NV30_STATE_FB]);
        for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
                if (!(samplers & (1 << i)))
                        continue;
-               so_emit_reloc_markers(nv30->nvws,
+               so_emit_reloc_markers(chan,
                                      state->hw[NV30_STATE_FRAGTEX0+i]);
                samplers &= ~(1ULL << i);
        }
-       so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FRAGPROG]);
+       so_emit_reloc_markers(chan, state->hw[NV30_STATE_FRAGPROG]);
        if (state->hw[NV30_STATE_VTXBUF] /*&& nv30->render_mode == HW*/)
-               so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_VTXBUF]);
+               so_emit_reloc_markers(chan, state->hw[NV30_STATE_VTXBUF]);
 }
 
 boolean