Mesa (master): r600g: fix reserve_cfile for R700+
Christian König
deathsimple at kemper.freedesktop.org
Tue Jan 18 23:41:04 UTC 2011
Module: Mesa
Branch: master
Commit: ba700d2ead3ae629ff29599455176fee72706698
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba700d2ead3ae629ff29599455176fee72706698
Author: Christian König <deathsimple at vodafone.de>
Date: Tue Jan 18 22:45:23 2011 +0100
r600g: fix reserve_cfile for R700+
According to R700 ISA we have only two channels for cfile constants.
This patch makes piglit tests "glsl1-constant array with constant
indexing" happy on RV710.
---
src/gallium/drivers/r600/r600_asm.c | 36 ++++++++++++++++------------------
1 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 78cb60e..b9c74e9 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -539,26 +539,24 @@ static int reserve_gpr(struct alu_bank_swizzle *bs, unsigned sel, unsigned chan,
return 0;
}
-static int reserve_cfile(struct alu_bank_swizzle *bs, unsigned sel, unsigned chan)
+static int reserve_cfile(struct r600_bc *bc, struct alu_bank_swizzle *bs, unsigned sel, unsigned chan)
{
- int res, resmatch = -1, resempty = -1;
- for (res = 3; res >= 0; --res) {
- if (bs->hw_cfile_addr[res] == -1)
- resempty = res;
- else if (bs->hw_cfile_addr[res] == sel &&
- bs->hw_cfile_elem[res] == chan)
- resmatch = res;
+ int res, num_res = 4;
+ if (bc->chiprev >= CHIPREV_R700) {
+ num_res = 2;
+ chan /= 2;
}
- if (resmatch != -1)
- return 0; // Read for this scalar element already reserved, nothing to do here.
- else if (resempty != -1) {
- bs->hw_cfile_addr[resempty] = sel;
- bs->hw_cfile_elem[resempty] = chan;
- } else {
- // All cfile read ports are used, cannot reference vector element
- return -1;
+ for (res = 0; res < num_res; ++res) {
+ if (bs->hw_cfile_addr[res] == -1) {
+ bs->hw_cfile_addr[res] = sel;
+ bs->hw_cfile_elem[res] = chan;
+ return 0;
+ } else if (bs->hw_cfile_addr[res] == sel &&
+ bs->hw_cfile_elem[res] == chan)
+ return 0; // Read for this scalar element already reserved, nothing to do here.
}
- return 0;
+ // All cfile read ports are used, cannot reference vector element
+ return -1;
}
static int is_gpr(unsigned sel)
@@ -604,7 +602,7 @@ static int check_vector(struct r600_bc *bc, struct r600_bc_alu *alu,
return r;
}
} else if (is_cfile(sel)) {
- r = reserve_cfile(bs, sel, elem);
+ r = reserve_cfile(bc, bs, sel, elem);
if (r)
return r;
}
@@ -631,7 +629,7 @@ static int check_scalar(struct r600_bc *bc, struct r600_bc_alu *alu,
const_count++;
}
if (is_cfile(sel)) {
- r = reserve_cfile(bs, sel, elem);
+ r = reserve_cfile(bc, bs, sel, elem);
if (r)
return r;
}
More information about the mesa-commit
mailing list