From: Alyssa Rosenzweig Date: Sat, 7 Dec 2019 20:54:36 +0000 (-0500) Subject: pan/midgard: Fix shift for TLS access X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b4da476f449aac5fc3867afdabc4ec545e5f1ec;p=mesa.git pan/midgard: Fix shift for TLS access Due to this issue we were using 4x the memory we should have for TLS, which was messing up the size calculations. Oops! Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/panfrost/midgard/midgard_emit.c b/src/panfrost/midgard/midgard_emit.c index 63dcb41ad41..fca181334bb 100644 --- a/src/panfrost/midgard/midgard_emit.c +++ b/src/panfrost/midgard/midgard_emit.c @@ -359,6 +359,19 @@ emit_alu_bundle(compiler_context *ctx, } } +/* Shift applied to the immediate used as an offset. Probably this is papering + * over some other semantic distinction else well, but it unifies things in the + * compiler so I don't mind. */ + +static unsigned +mir_ldst_imm_shift(midgard_load_store_op op) +{ + if (OP_IS_UBO_READ(op)) + return 3; + else + return 1; +} + /* After everything is scheduled, emit whole bundles at a time */ void @@ -393,8 +406,11 @@ emit_binary_bundle(compiler_context *ctx, unsigned offset = bundle->instructions[i]->constants[0]; if (offset) { - bundle->instructions[i]->load_store.varying_parameters |= (offset & 0x7F) << 3; - bundle->instructions[i]->load_store.address |= (offset >> 7); + unsigned shift = mir_ldst_imm_shift(bundle->instructions[i]->load_store.op); + unsigned upper_shift = 10 - shift; + + bundle->instructions[i]->load_store.varying_parameters |= (offset & ((1 << upper_shift) - 1)) << shift; + bundle->instructions[i]->load_store.address |= (offset >> upper_shift); } }