summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-02-01 13:04:09 -0500
committerRob Clark <[email protected]>2015-03-08 17:42:43 -0400
commit26b79ac3e40624726bff5101dfe892d3ee2ba607 (patch)
tree53356f3e853b371874515db09cab0f50c8ee2baf /src/gallium
parent3ecc834e752a452bfc445a46ea14d06dc24d7b9b (diff)
freedreno/ir3: fix register usage calculations
For cat1 instructions, use reg() as well for relative src, to ensure proper accounting of register usage. Also, for relative instructions, use reg->size rather than reg->wrmask to determine the number of components read/written. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3.c b/src/gallium/drivers/freedreno/ir3/ir3.c
index fe0ffc98c97..01cdd8ad57a 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3.c
@@ -105,11 +105,18 @@ static uint32_t reg(struct ir3_register *reg, struct ir3_info *info,
if (reg->flags & IR3_REG_IMMED) {
val.iim_val = reg->iim_val;
} else {
- int8_t components = util_last_bit(reg->wrmask);
- int16_t max = (reg->num + repeat + components - 1) >> 2;
+ unsigned components;
- val.comp = reg->num & 0x3;
- val.num = reg->num >> 2;
+ if (reg->flags & IR3_REG_RELATIV) {
+ components = reg->size;
+ val.dummy10 = reg->offset;
+ } else {
+ components = util_last_bit(reg->wrmask);
+ val.comp = reg->num & 0x3;
+ val.num = reg->num >> 2;
+ }
+
+ int16_t max = (reg->num + repeat + components - 1) >> 2;
if (reg->flags & IR3_REG_CONST) {
info->max_const = MAX2(info->max_const, max);
@@ -166,13 +173,13 @@ static int emit_cat1(struct ir3_instruction *instr, void *ptr,
cat1->iim_val = src->iim_val;
cat1->src_im = 1;
} else if (src->flags & IR3_REG_RELATIV) {
- cat1->off = src->offset;
+ cat1->off = reg(src, info, instr->repeat,
+ IR3_REG_R | IR3_REG_CONST | IR3_REG_HALF | IR3_REG_RELATIV);
cat1->src_rel = 1;
cat1->src_rel_c = !!(src->flags & IR3_REG_CONST);
} else {
cat1->src = reg(src, info, instr->repeat,
- IR3_REG_IMMED | IR3_REG_R |
- IR3_REG_CONST | IR3_REG_HALF);
+ IR3_REG_R | IR3_REG_CONST | IR3_REG_HALF);
cat1->src_c = !!(src->flags & IR3_REG_CONST);
}