From: Alyssa Rosenzweig Date: Thu, 31 Oct 2019 18:57:35 +0000 (-0400) Subject: pan/midgard: Extend offset_swizzle to non-32-bit X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bf5508f7b9698d3aa657b810febbf0e97e3b7b20;p=mesa.git pan/midgard: Extend offset_swizzle to non-32-bit We take a size parameter; use it. Signed-off-by: Alyssa Rosenzweig --- 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));