nv50: wait on the buf's fence before sticking it into pushbuf
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 28 Nov 2013 21:23:15 +0000 (16:23 -0500)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Wed, 4 Dec 2013 15:38:50 +0000 (16:38 +0100)
This resolves some rendering issues in source games.
See https://bugs.freedesktop.org/show_bug.cgi?id=64323

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "9.2 10.0" <mesa-stable@lists.freedesktop.org>
src/gallium/drivers/nouveau/nouveau_buffer.c
src/gallium/drivers/nouveau/nv50/nv50_vbo.c

index 3e0404983fe303c5186468a1c1ea79c6ea370fb1..95905a8776f750891f91b2ca9398233984016f39 100644 (file)
@@ -205,6 +205,9 @@ nouveau_transfer_write(struct nouveau_context *nv, struct nouveau_transfer *tx,
                   base, size / 4, (const uint32_t *)data);
    else
       nv->push_data(nv, buf->bo, buf->offset + base, buf->domain, size, data);
+
+   nouveau_fence_ref(nv->screen->fence.current, &buf->fence);
+   nouveau_fence_ref(nv->screen->fence.current, &buf->fence_wr);
 }
 
 
index c6162b5f415f66c60e72d25c556aa34ca768cc44..947c67d6a75e185746c48cee195c929e8226f452 100644 (file)
@@ -597,6 +597,15 @@ nv50_draw_elements(struct nv50_context *nv50, boolean shorten,
 
       assert(nouveau_resource_mapped_by_gpu(nv50->idxbuf.buffer));
 
+      /* This shouldn't have to be here. The going theory is that the buffer
+       * is being filled in by PGRAPH, and it's not done yet by the time it
+       * gets submitted to PFIFO, which in turn starts immediately prefetching
+       * the not-yet-written data. Ideally this wait would only happen on
+       * pushbuf submit, but it's probably not a big performance difference.
+       */
+      if (buf->fence_wr && !nouveau_fence_signalled(buf->fence_wr))
+         nouveau_fence_wait(buf->fence_wr);
+
       while (instance_count--) {
          BEGIN_NV04(push, NV50_3D(VERTEX_BEGIN_GL), 1);
          PUSH_DATA (push, prim);