Mesa (master): nv50: make MRTs work

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sat Oct 31 12:41:05 UTC 2009


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

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Sat Oct 31 11:25:48 2009 +0100

nv50: make MRTs work

We have to indicate to the hw whether the FP exports
multiple colour results.
Method 0x121c is used to specify the number of RTs.
Also deactivate zeta explicitly if there's no zsbuf.

---

 src/gallium/drivers/nv50/nv50_program.c        |    4 ++++
 src/gallium/drivers/nv50/nv50_state_validate.c |   11 +++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 9ccc4f5..c3edc02 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -2644,6 +2644,10 @@ nv50_program_tx_prep(struct nv50_pc *pc)
 			pc->result[2].rhw = rid;
 
 		p->cfg.high_result = rid;
+
+		/* separate/different colour results for MRTs ? */
+		if (pc->result_nr - (p->info.writes_z ? 1 : 0) > 1)
+			p->cfg.regs[2] |= 1;
 	}
 
 	if (pc->immd_nr) {
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 956a700..a13d64b 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -37,6 +37,14 @@ nv50_state_validate_fb(struct nv50_context *nv50)
 	struct pipe_framebuffer_state *fb = &nv50->framebuffer;
 	unsigned i, w, h, gw = 0;
 
+	/* Set nr of active RTs. Don't know what 0xfac6880 does, but
+	 * at least 0x880 was required to draw to more than 1 RT.
+	 * In some special cases, 0xfac6880 is not used, we probably
+	 * don't hit any of these though.
+	 */
+	so_method(so, tesla, 0x121c, 1);
+	so_data  (so, 0x0fac6880 | fb->nr_cbufs);
+
 	for (i = 0; i < fb->nr_cbufs; i++) {
 		struct pipe_texture *pt = fb->cbufs[i]->texture;
 		struct nouveau_bo *bo = nv50_miptree(pt)->base.bo;
@@ -121,6 +129,9 @@ nv50_state_validate_fb(struct nv50_context *nv50)
 		so_data  (so, fb->zsbuf->width);
 		so_data  (so, fb->zsbuf->height);
 		so_data  (so, 0x00010001);
+	} else {
+		so_method(so, tesla, 0x1538, 1);
+		so_data  (so, 0);
 	}
 
 	so_method(so, tesla, NV50TCL_VIEWPORT_HORIZ, 2);




More information about the mesa-commit mailing list