Mesa (gallium-0.2): nouveau: do not forget to half dimension.

Patrice Mandin pmandin at kemper.freedesktop.org
Tue Feb 10 20:23:02 UTC 2009


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

Author: Patrice Mandin <patmandin at gmail.com>
Date:   Tue Feb 10 21:22:29 2009 +0100

nouveau: do not forget to half dimension.

---

 src/gallium/drivers/nv04/nv04_surface_2d.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c
index 538f823..63f2125 100644
--- a/src/gallium/drivers/nv04/nv04_surface_2d.c
+++ b/src/gallium/drivers/nv04/nv04_surface_2d.c
@@ -106,7 +106,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
 	const unsigned max_h = 1024;
 	const unsigned sub_w = w > max_w ? max_w : w;
 	const unsigned sub_h = h > max_h ? max_h : h;
-	unsigned cx, cy;
+	unsigned cx, cy, level_w, level_h;
 	int i, src_offset = src->offset, dst_offset = dst->offset;
 
 	/* POT or GTFO */
@@ -128,9 +128,13 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
 	OUT_RING  (chan, swzsurf->handle);
 
 	/* FIXME: Find right src and dst offset, given mipmap level */
+	level_w = w;
+	level_h = h;
 	for (i=0; i<src->level; i++) {
-		src_offset += w * h * src->block.size;
-		dst_offset += w * h * dst->block.size;
+		src_offset += level_w * level_h * src->block.size;
+		dst_offset += level_w * level_h * dst->block.size;
+		level_w >>= 1;
+		level_h >>= 1;
 	}
 
 	for (cy = 0; cy < h; cy += sub_h) {




More information about the mesa-commit mailing list