From 575f62ea02ecd420572fd952cff5da0304ade17c Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 5 Mar 2020 19:48:30 +0100 Subject: [PATCH] panfrost: Emit attribute descriptors after patching the templates Patching attribute desc when they are in cacheable memory should be more efficient. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 4fea5f507b3..f91a2d24743 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -192,13 +192,6 @@ panfrost_stage_attributes(struct panfrost_context *ctx) struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); struct panfrost_vertex_state *so = ctx->vertex; - size_t sz = sizeof(struct mali_attr_meta) * PAN_MAX_ATTRIBUTE; - struct panfrost_transfer transfer = panfrost_allocate_transient(batch, sz); - struct mali_attr_meta *target = (struct mali_attr_meta *) transfer.cpu; - - /* Copy as-is for the first pass */ - memcpy(target, so->hw, sz); - /* Fixup offsets for the second pass. Recall that the hardware * calculates attribute addresses as: * @@ -241,10 +234,14 @@ panfrost_stage_attributes(struct panfrost_context *ctx) if (so->pipe[i].instance_divisor && ctx->instance_count > 1 && start) src_offset -= buf->stride * start; - target[i].src_offset = src_offset; + so->hw[i].src_offset = src_offset; } - ctx->payloads[PIPE_SHADER_VERTEX].postfix.attribute_meta = transfer.gpu; + mali_ptr out = panfrost_upload_transient(batch, so->hw, + sizeof(*so->hw) * + PAN_MAX_ATTRIBUTE); + + ctx->payloads[PIPE_SHADER_VERTEX].postfix.attribute_meta = out; } /* Compute number of UBOs active (more specifically, compute the highest UBO -- 2.30.2