Mesa (master): nv50: make a working check for user memory vertex/ index buffers

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Tue Apr 20 20:08:51 UTC 2010


Module: Mesa
Branch: master
Commit: 3a5b82f3351a0023bfb0594010377c7671c06e28
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a5b82f3351a0023bfb0594010377c7671c06e28

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Tue Apr 20 22:01:37 2010 +0200

nv50: make a working check for user memory vertex/index buffers

---

 src/gallium/drivers/nv50/nv50_resource.h |    8 ++++++++
 src/gallium/drivers/nv50/nv50_vbo.c      |    4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_resource.h b/src/gallium/drivers/nv50/nv50_resource.h
index 6cf7662..f435a58 100644
--- a/src/gallium/drivers/nv50/nv50_resource.h
+++ b/src/gallium/drivers/nv50/nv50_resource.h
@@ -4,6 +4,8 @@
 
 #include "util/u_transfer.h"
 
+#include "nouveau/nouveau_winsys.h"
+
 struct pipe_resource;
 struct nouveau_bo;
 
@@ -49,6 +51,12 @@ struct nv50_resource *nv50_resource(struct pipe_resource *resource)
 	return (struct nv50_resource *)resource;
 }
 
+/* is resource mapped into the GPU's address space (i.e. VRAM or GART) ? */
+static INLINE boolean
+nv50_resource_mapped_by_gpu(struct pipe_resource *resource)
+{
+   return nv50_resource(resource)->bo->handle;
+}
 
 void
 nv50_init_resource_functions(struct pipe_context *pcontext);
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 34719c9..864cb09 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -412,7 +412,7 @@ nv50_draw_elements_instanced(struct pipe_context *pipe,
 	BEGIN_RING(chan, tesla, NV50TCL_VB_ELEMENT_BASE, 1);
 	OUT_RING  (chan, indexBias);
 
-	if (!(indexBuffer->bind & PIPE_BIND_INDEX_BUFFER) || indexSize == 1) {
+	if (!nv50_resource_mapped_by_gpu(indexBuffer) || indexSize == 1) {
 		nv50_draw_elements_inline(pipe, indexBuffer, indexSize,
 					  mode, start, count, startInstance,
 					  instanceCount);
@@ -565,7 +565,7 @@ nv50_vbo_validate(struct nv50_context *nv50)
 
 	for (i = 0; i < nv50->vtxbuf_nr; i++) {
 		if (nv50->vtxbuf[i].stride &&
-		    !(nv50->vtxbuf[i].buffer->bind & PIPE_BIND_VERTEX_BUFFER))
+		    !nv50_resource_mapped_by_gpu(nv50->vtxbuf[i].buffer))
 			nv50->vbo_fifo = 0xffff;
 	}
 




More information about the mesa-commit mailing list