panfrost: Simplify offset fixup proof
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 14 Aug 2020 16:01:55 +0000 (12:01 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 17 Aug 2020 11:43:52 +0000 (11:43 +0000)
No need to put strides and such into it at all.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6326>

src/gallium/drivers/panfrost/pan_cmdstream.c

index 91687ace09681823dc91b43b9011a77893a42864..41abf57b0beca81cb0d5cda31d28ff58cb6a96c9 100644 (file)
@@ -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;