Mesa (gallium-0.2): nv50: fix assertion failure

Ben Skeggs darktama at kemper.freedesktop.org
Mon Jan 12 07:00:06 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: 73f1857aeea8f48deb3d12ef2bfc1fca00df6a69
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=73f1857aeea8f48deb3d12ef2bfc1fca00df6a69

Author: Ben Skeggs <skeggsb at gmail.com>
Date:   Mon Jan 12 15:42:20 2009 +1000

nv50: fix assertion failure

---

 src/gallium/drivers/nv50/nv50_miptree.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 430e75a..c3436db 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -73,6 +73,10 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp)
 
 		lvl->image_offset = CALLOC(mt->image_nr, sizeof(int));
 		lvl->image = CALLOC(mt->image_nr, sizeof(struct pipe_buffer *));
+
+		width = MAX2(1, width >> 1);
+		height = MAX2(1, height >> 1);
+		depth = MAX2(1, depth >> 1);
 	}
 
 	for (i = 0; i < mt->image_nr; i++) {
@@ -144,8 +148,11 @@ nv50_miptree_sync(struct pipe_screen *pscreen, struct nv50_miptree *mt,
 	src = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
 				       PIPE_BUFFER_USAGE_CPU_READ);
 
+	/* Pretend we're only reading with the GPU so surface doesn't get marked
+	 * as dirtied by the GPU.
+	 */
 	dst = pscreen->get_tex_surface(pscreen, &mt->base, face, level, zslice,
-				       PIPE_BUFFER_USAGE_GPU_WRITE);
+				       PIPE_BUFFER_USAGE_GPU_READ);
 
 	nvws->surface_copy(nvws, dst, 0, 0, src, 0, 0, dst->width, dst->height);
 
@@ -191,7 +198,7 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
 
 	if (flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
 		assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE));
-		assert(!(lvl->image_dirty_cpu & (1 << img)));
+		assert(!(lvl->image_dirty_gpu & (1 << img)));
 
 		ps->offset = 0;
 		pipe_texture_reference(&ps->texture, pt);




More information about the mesa-commit mailing list