panfrost: Add panfrost_streamout_offset helper
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 10 Jun 2020 23:28:28 +0000 (19:28 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 12 Jun 2020 14:45:50 +0000 (14:45 +0000)
Calculates the bias required for an xfb record in the src_offset field
to account for truncating the address to force alignment.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5423>

src/gallium/drivers/panfrost/pan_cmdstream.c

index 5c0d7f4d0e9e7c0af55a85ebc9d9c82ce3fef155..af2cffcd2cefe07aed3cc2877ce10d9c0a9b6f4a 100644 (file)
@@ -1615,6 +1615,13 @@ panfrost_emit_varyings(struct panfrost_batch *batch, union mali_attr *slot,
         return transfer.gpu;
 }
 
+static unsigned
+panfrost_streamout_offset(unsigned stride, unsigned offset,
+                        struct pipe_stream_output_target *target)
+{
+        return (target->buffer_offset + (offset * stride * 4)) & 63;
+}
+
 static void
 panfrost_emit_streamout(struct panfrost_batch *batch, union mali_attr *slot,
                         unsigned stride, unsigned offset, unsigned count,