nouveau: flush pending pushbuf if buffer on validate list at map/del
authorBen Skeggs <skeggsb@gmail.com>
Fri, 30 May 2008 01:00:59 +0000 (11:00 +1000)
committerBen Skeggs <skeggsb@gmail.com>
Fri, 30 May 2008 01:00:59 +0000 (11:00 +1000)
src/gallium/winsys/dri/nouveau/nouveau_bo.c

index aca16a8b127e56c15ef10cfe118b548201a3f3a5..57f5b7d1ae1b5cdb03cbfe94405be3357358c2ed 100644 (file)
@@ -256,6 +256,9 @@ nouveau_bo_del(struct nouveau_bo **bo)
        if (--nvbo->refcount)
                return;
 
+       if (nvbo->pending)
+               nouveau_pushbuf_flush(nvbo->pending->channel, 0);
+
        if (nvbo->fence)
                nouveau_fence_signal_cb(nvbo->fence, nouveau_bo_del_cb, nvbo);
        else
@@ -270,6 +273,11 @@ nouveau_bo_map(struct nouveau_bo *bo, uint32_t flags)
        if (!nvbo)
                return -EINVAL;
 
+       if (nvbo->pending &&
+           (nvbo->pending->flags & NOUVEAU_BO_WR || flags & NOUVEAU_BO_WR)) {
+               nouveau_pushbuf_flush(nvbo->pending->channel, 0);
+       }
+
        if (flags & NOUVEAU_BO_WR)
                nouveau_fence_wait(&nvbo->fence);
        else