From 81a21ea9cd1134fd22ed07d83925976bd3625280 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 28 Jan 2021 10:26:29 +0100 Subject: [PATCH] panfrost: Only allocate the extra attribute buffer entry on Bifrost Bifrost needs an empty attribute buffer entry to tell the prefecter it should stop fetching attribute buffers, but Midgard doesn't have this constraint. It's also useless to have 2 empty entries for the instance or image case. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Reviewed-by: Italo Nicola Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 88003444aae..685aaf99e62 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1359,7 +1359,8 @@ panfrost_emit_vertex_data(struct panfrost_batch *batch, * Also, we allocate more memory than what's needed here if either instancing * is enabled or images are present, this can be improved. */ unsigned bufs_per_attrib = (ctx->instance_count > 1 || nr_images > 0) ? 2 : 1; - unsigned nr_bufs = (vs->attribute_count + 1) * bufs_per_attrib; + unsigned nr_bufs = (vs->attribute_count * bufs_per_attrib) + + (pan_is_bifrost(dev) ? 1 : 0); struct panfrost_ptr S = panfrost_pool_alloc_aligned(&batch->pool, MALI_ATTRIBUTE_BUFFER_LENGTH * nr_bufs,