From 9cc81ea0c209078b02e1eb62a27d4c31b292ba3d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 14 Aug 2020 12:01:55 -0400 Subject: [PATCH] panfrost: Simplify offset fixup proof No need to put strides and such into it at all. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 91687ace096..41abf57b0be 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1439,25 +1439,13 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch, panfrost_instance_id(ctx->padded_count, &attrs[k]); so->hw[PAN_INSTANCE_ID].index = k++; - /* Fixup offsets for the second pass. Recall that the hardware - * calculates attribute addresses as: - * - * addr = base + (stride * vtx) + src_offset; - * - * However, on Mali, base must be aligned to 64-bytes, so we - * instead let: + /* Attribute addresses require 64-byte alignment, so let: * * base' = base & ~63 = base - (base & 63) + * offset' = offset + (base & 63) * - * To compensate when using base' (see emit_vertex_data), we have - * to adjust src_offset by the masked off piece: - * - * addr' = base' + (stride * vtx) + (src_offset + (base & 63)) - * = base - (base & 63) + (stride * vtx) + src_offset + (base & 63) - * = base + (stride * vtx) + src_offset - * = addr; - * - * QED. + * Since base' + offset' = base + offset, these are equivalent + * addressing modes and now base is 64 aligned. */ unsigned start = vertex_postfix->offset_start; -- 2.30.2