summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-10-31 14:57:35 -0400
committerAlyssa Rosenzweig <[email protected]>2019-11-04 15:36:08 -0500
commitbf5508f7b9698d3aa657b810febbf0e97e3b7b20 (patch)
tree7b5b553b3328f733ad0a6b1e84395528f1d0547c
parentf538981384271f8fd0c03a8633e3870f12106ddc (diff)
pan/midgard: Extend offset_swizzle to non-32-bit
We take a size parameter; use it. Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r--src/panfrost/midgard/midgard_ra.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c
index e923a3a9420..87eedfd7c2e 100644
--- a/src/panfrost/midgard/midgard_ra.c
+++ b/src/panfrost/midgard/midgard_ra.c
@@ -72,8 +72,7 @@ struct phys_reg {
unsigned size;
};
-/* Shift each component up by reg_offset and shift all components horizontally
- * by dst_offset. TODO: vec8+ */
+/* Shift up by reg_offset and horizontally by dst_offset. */
static void
offset_swizzle(unsigned *swizzle, unsigned reg_offset, unsigned srcsize, unsigned dst_offset)
@@ -83,12 +82,14 @@ offset_swizzle(unsigned *swizzle, unsigned reg_offset, unsigned srcsize, unsigne
signed reg_comp = reg_offset / srcsize;
signed dst_comp = dst_offset / srcsize;
+ unsigned max_component = (16 / srcsize) - 1;
+
assert(reg_comp * srcsize == reg_offset);
assert(dst_comp * srcsize == dst_offset);
for (signed c = 0; c < MIR_VEC_COMPONENTS; ++c) {
signed comp = MAX2(c - dst_comp, 0);
- out[c] = MIN2(swizzle[comp] + reg_comp, 4 - 1);
+ out[c] = MIN2(swizzle[comp] + reg_comp, max_component);
}
memcpy(swizzle, out, sizeof(out));