Mesa (master): nv50: fix multi-texturing

Ben Skeggs darktama at kemper.freedesktop.org
Sat Jun 6 06:29:13 UTC 2009


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

Author: Ben Skeggs <bskeggs at redhat.com>
Date:   Sat Jun  6 14:00:45 2009 +1000

nv50: fix multi-texturing

---

 src/gallium/drivers/nv50/nv50_context.h |    1 +
 src/gallium/drivers/nv50/nv50_screen.c  |    2 --
 src/gallium/drivers/nv50/nv50_tex.c     |   18 +++++++++++++++---
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index 1a72baf..9b8cc4d 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -114,6 +114,7 @@ struct nv50_state {
 	unsigned viewport_bypass;
 	struct nouveau_stateobj *tsc_upload;
 	struct nouveau_stateobj *tic_upload;
+	unsigned miptree_nr;
 	struct nouveau_stateobj *vertprog;
 	struct nouveau_stateobj *fragprog;
 	struct nouveau_stateobj *vtxfmt;
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 7904b51..fd39fa7 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -404,8 +404,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
 
 	so_method(so, screen->tesla, 0x1234, 1);
 	so_data  (so, 1);
-	so_method(so, screen->tesla, 0x1458, 1);
-	so_data  (so, 1);
 
 	so_emit(chan, so);
 	so_ref (so, &screen->static_init);
diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c
index 8f553f5..ff40c2a 100644
--- a/src/gallium/drivers/nv50/nv50_tex.c
+++ b/src/gallium/drivers/nv50/nv50_tex.c
@@ -139,23 +139,35 @@ nv50_tex_validate(struct nv50_context *nv50)
 {
 	struct nouveau_grobj *tesla = nv50->screen->tesla;
 	struct nouveau_stateobj *so;
-	int unit;
+	int unit, push;
 
-	so = so_new(nv50->miptree_nr * 8 + 3, nv50->miptree_nr * 2);
+	push  = nv50->miptree_nr * 9 + 2;
+	push += MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2;
+
+	so = so_new(push, nv50->miptree_nr * 2);
 	so_method(so, tesla, 0x0f00, 1);
 	so_data  (so, NV50_CB_TIC);
-	so_method(so, tesla, 0x40000f04, nv50->miptree_nr * 8);
 	for (unit = 0; unit < nv50->miptree_nr; unit++) {
 		struct nv50_miptree *mt = nv50->miptree[unit];
 
+		so_method(so, tesla, 0x40000f04, 8);
 		if (nv50_tex_construct(nv50, so, mt, unit)) {
 			NOUVEAU_ERR("failed tex validate\n");
 			so_ref(NULL, &so);
 			return;
 		}
+
+		so_method(so, tesla, 0x1458, 1);
+		so_data  (so, (unit << 9) | (unit << 1) | 1);
+	}
+
+	for (; unit < nv50->state.miptree_nr; unit++) {
+		so_method(so, tesla, 0x1458, 1);
+		so_data  (so, (unit << 1) | 0);
 	}
 
 	so_ref(so, &nv50->state.tic_upload);
 	so_ref(NULL, &so);
+	nv50->state.miptree_nr = nv50->miptree_nr;
 }
 




More information about the mesa-commit mailing list