summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2013-11-28 16:23:15 -0500
committerCarl Worth <cworth@cworth.org>2013-12-12 15:42:45 -0800
commit767623bbf223a0dc6cb930fc5b5aa67ca131abe7 (patch)
tree466d233041ef02136f9f940514ebf31959bed546
parent94e7e35d6e3cc3f72c1e81309c3503c46ecea34c (diff)
nv50: wait on the buf's fence before sticking it into pushbuf
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> (cherry picked from commit 0e5bf8565106833e1a678ebdae81fdf1657391c9)
-rw-r--r--src/gallium/drivers/nouveau/nouveau_buffer.c3
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c
index 3e0404983f..95905a8776 100644
--- a/src/gallium/drivers/nouveau/nouveau_buffer.c
+++ b/src/gallium/drivers/nouveau/nouveau_buffer.c
@@ -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);
}
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index ca46f6c266..d3a66e6b1e 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -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);