i965: Fix type of gl_FragData[] dereference for FB write.
[mesa.git] / src / mesa / drivers / dri / nouveau / nouveau_bo_state.c
index 664632f407dcd452c621e1af02f16dde7186a918..7eef8c1ee81e648ac3154487d0d161dd17dd4893 100644 (file)
 #include "nouveau_context.h"
 
 static GLboolean
-nouveau_bo_marker_emit(GLcontext *ctx, struct nouveau_bo_marker *m,
+nouveau_bo_marker_emit(struct gl_context *ctx, struct nouveau_bo_marker *m,
                       uint32_t flags)
 {
        struct nouveau_channel *chan = context_chan(ctx);
-       struct nouveau_pushbuf *push = chan->pushbuf;
        uint32_t packet;
 
        if (m->gr->bound == NOUVEAU_GROBJ_UNBOUND)
@@ -41,11 +40,10 @@ nouveau_bo_marker_emit(GLcontext *ctx, struct nouveau_bo_marker *m,
        if (MARK_RING(chan, 2, 2))
                return GL_FALSE;
 
-       push->remaining -= 2;
        packet = (m->gr->subc << 13) | (1 << 18) | m->mthd;
 
        if (flags) {
-               if (nouveau_pushbuf_emit_reloc(chan, push->cur++, m->bo,
+               if (nouveau_pushbuf_emit_reloc(chan, chan->cur++, m->bo,
                                               packet, 0, flags |
                                               (m->flags & (NOUVEAU_BO_VRAM |
                                                            NOUVEAU_BO_GART |
@@ -53,10 +51,10 @@ nouveau_bo_marker_emit(GLcontext *ctx, struct nouveau_bo_marker *m,
                                               0, 0))
                        goto fail;
        } else {
-               *(push->cur++) = packet;
+               *(chan->cur++) = packet;
        }
 
-       if (nouveau_pushbuf_emit_reloc(chan, push->cur++, m->bo, m->data,
+       if (nouveau_pushbuf_emit_reloc(chan, chan->cur++, m->bo, m->data,
                                       m->data2, flags | m->flags,
                                       m->vor, m->tor))
                goto fail;
@@ -128,17 +126,17 @@ void
 nouveau_bo_context_reset(struct nouveau_bo_context *bctx)
 {
        struct nouveau_bo_state *s = &to_nouveau_context(bctx->ctx)->bo;
-       int i;
-
-       for (i = 0; i < bctx->count; i++)
-               nouveau_bo_ref(NULL, &bctx->marker[i].bo);
+       int i, n = bctx->count;
 
-       s->count -= bctx->count;
+       s->count -= n;
        bctx->count = 0;
+
+       for (i = 0; i < n; i++)
+               nouveau_bo_ref(NULL, &bctx->marker[i].bo);
 }
 
 GLboolean
-nouveau_bo_state_emit(GLcontext *ctx)
+nouveau_bo_state_emit(struct gl_context *ctx)
 {
        struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo;
        int i, j;
@@ -157,7 +155,7 @@ nouveau_bo_state_emit(GLcontext *ctx)
 }
 
 void
-nouveau_bo_state_init(GLcontext *ctx)
+nouveau_bo_state_init(struct gl_context *ctx)
 {
        struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo;
        int i;
@@ -167,7 +165,7 @@ nouveau_bo_state_init(GLcontext *ctx)
 }
 
 void
-nouveau_bo_state_destroy(GLcontext *ctx)
+nouveau_bo_state_destroy(struct gl_context *ctx)
 {
        struct nouveau_bo_state *s = &to_nouveau_context(ctx)->bo;
        int i, j;