From: Alyssa Rosenzweig Date: Fri, 10 Dec 2021 19:31:25 +0000 (-0500) Subject: panfrost: Align instance size for IDVS X-Git-Tag: upstream/22.3.5~14618 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ff3c4a636c891aa9f57722ca1ef03aafc5ad33e;p=platform%2Fupstream%2Fmesa.git panfrost: Align instance size for IDVS Hardware requirement. Failing to do this raises a DATA_INVALID_FAULT. Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 7666a16..392a654 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2850,9 +2850,19 @@ panfrost_direct_draw(struct panfrost_batch *batch, ctx->offset_start = draw->start; } - if (info->instance_count > 1) - ctx->padded_count = panfrost_padded_vertex_count(vertex_count); - else + if (info->instance_count > 1) { + unsigned count = vertex_count; + + /* Index-Driven Vertex Shading requires different instances to + * have different cache lines for position results. Each vertex + * position is 16 bytes and the Mali cache line is 64 bytes, so + * the instance count must be aligned to 4 vertices. + */ + if (idvs) + count = ALIGN_POT(count, 4); + + ctx->padded_count = panfrost_padded_vertex_count(count); + } else ctx->padded_count = vertex_count; panfrost_statistics_record(ctx, info, draw);