diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-08-13 09:27:43 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-14 16:57:24 -0700 |
commit | 3d54ed2488c90873e78d3267e967f9bca4b75ab4 (patch) | |
tree | 8b295f78b372ec85a87ba6e04053a1fa2457b41f /src | |
parent | 03350eb8b809d369a6af884a41dca0804c22de69 (diff) |
pan/midgard: Account for unaligned UBOs when promoting uniforms
We only know how to promote aligned accesses, although theoretically we
should be able to promote unaligned to swizzles in the future. Check
this.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/panfrost/midgard/mir_promote_uniforms.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/panfrost/midgard/mir_promote_uniforms.c b/src/panfrost/midgard/mir_promote_uniforms.c index 9f5be37be2c..27e25cad8bf 100644 --- a/src/panfrost/midgard/mir_promote_uniforms.c +++ b/src/panfrost/midgard/mir_promote_uniforms.c @@ -36,6 +36,22 @@ * program so we allow that many registers through at minimum, to prevent * spilling. If we spill anyway, I mean, it's a lose-lose at that point. */ +static unsigned +mir_ubo_offset(midgard_instruction *ins) +{ + assert(ins->type == TAG_LOAD_STORE_4); + assert(OP_IS_UBO_READ(ins->load_store.op)); + + /* Grab the offset as the hw understands it */ + unsigned lo = ins->load_store.varying_parameters >> 7; + unsigned hi = ins->load_store.address; + unsigned raw = ((hi << 3) | lo); + + /* Account for the op's shift */ + unsigned shift = mir_ubo_shift(ins->load_store.op); + return (raw << shift); +} + void midgard_promote_uniforms(compiler_context *ctx, unsigned promoted_count) { @@ -43,11 +59,11 @@ midgard_promote_uniforms(compiler_context *ctx, unsigned promoted_count) if (ins->type != TAG_LOAD_STORE_4) continue; if (!OP_IS_UBO_READ(ins->load_store.op)) continue; - unsigned lo = ins->load_store.varying_parameters >> 7; - unsigned hi = ins->load_store.address; + /* Get the offset. TODO: can we promote unaligned access? */ + unsigned off = mir_ubo_offset(ins); + if (off & 0xF) continue; - /* TODO: Combine fields logically */ - unsigned address = (hi << 3) | lo; + unsigned address = off / 16; /* Check this is UBO 0 */ if (ins->load_store.arg_1) continue; |