gallium: squash-merge of gallium screen context
[mesa.git] / src / gallium / drivers / nv30 / nv30_state_emit.c
index 621b8846c8ed3835c97fd809ddfbe0dcba208e26..d9650f63eb21a3986731734ba1f4cd919149483a 100644 (file)
@@ -41,16 +41,18 @@ 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++) {
@@ -63,6 +65,14 @@ nv30_state_emit(struct nv30_context *nv30)
        }
 
        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(chan, state->hw[NV30_STATE_FB]);
        for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {