From 046c15458575f826da430d86a3056876f1bcc638 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 5 Mar 2020 21:48:09 +0100 Subject: [PATCH] panfrost: Rename panfrost_stage_attributes() panfrost_stage_attributes() is emitting mali_attr_meta descriptors, so let's rename it accordingly and move it to pan_cmdstream.c. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 17 ++++++++++++ src/gallium/drivers/panfrost/pan_cmdstream.h | 4 +++ src/gallium/drivers/panfrost/pan_context.c | 28 +++----------------- src/gallium/drivers/panfrost/pan_context.h | 4 +++ 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 4a549cc3bf0..c9aa4b8399d 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -1046,6 +1046,23 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch, vtp->postfix.sampler_descriptor = transfer.gpu; } +void +panfrost_emit_vertex_attr_meta(struct panfrost_batch *batch, + struct midgard_payload_vertex_tiler *vp) +{ + struct panfrost_context *ctx = batch->ctx; + + if (!ctx->vertex) + return; + + struct panfrost_vertex_state *so = ctx->vertex; + + panfrost_vertex_state_upd_attr_offs(ctx, vp); + vp->postfix.attribute_meta = panfrost_upload_transient(batch, so->hw, + sizeof(*so->hw) * + PAN_MAX_ATTRIBUTE); +} + void panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, struct midgard_payload_vertex_tiler *vp, diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h index d3a5e1e64e1..1b69a0be9c7 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.h +++ b/src/gallium/drivers/panfrost/pan_cmdstream.h @@ -76,6 +76,10 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch, enum pipe_shader_type stage, struct midgard_payload_vertex_tiler *vtp); +void +panfrost_emit_vertex_attr_meta(struct panfrost_batch *batch, + struct midgard_payload_vertex_tiler *vp); + void panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, struct midgard_payload_vertex_tiler *vp, diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 002801875a2..a70ce65c490 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -183,7 +183,7 @@ panfrost_writes_point_size(struct panfrost_context *ctx) return vs->writes_point_size && ctx->payloads[PIPE_SHADER_FRAGMENT].prefix.draw_mode == MALI_POINTS; } -static void +void panfrost_vertex_state_upd_attr_offs(struct panfrost_context *ctx, struct midgard_payload_vertex_tiler *vp) { @@ -238,27 +238,6 @@ panfrost_vertex_state_upd_attr_offs(struct panfrost_context *ctx, } } -/* Stage the attribute descriptors so we can adjust src_offset - * to let BOs align nicely */ - -static void -panfrost_stage_attributes(struct panfrost_context *ctx) -{ - struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx); - struct panfrost_vertex_state *so = ctx->vertex; - - /* Update src_offsets before copying to the GPU buffer. */ - - panfrost_vertex_state_upd_attr_offs(ctx, - &ctx->payloads[PIPE_SHADER_VERTEX]); - - 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 * number addressable -- if there are gaps, include them in the count anyway). * We always include UBO #0 in the count, since we *need* uniforms enabled for @@ -299,9 +278,8 @@ panfrost_emit_for_draw(struct panfrost_context *ctx) panfrost_emit_shader_meta(batch, PIPE_SHADER_FRAGMENT, &ctx->payloads[PIPE_SHADER_FRAGMENT]); - /* We stage to transient, so always dirty.. */ - if (ctx->vertex) - panfrost_stage_attributes(ctx); + panfrost_emit_vertex_attr_meta(batch, + &ctx->payloads[PIPE_SHADER_VERTEX]); for (int i = 0; i <= PIPE_SHADER_FRAGMENT; ++i) { panfrost_emit_sampler_descriptors(batch, i, &ctx->payloads[i]); diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index 9c26b012493..cc8d0eb16df 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -288,6 +288,10 @@ panfrost_invalidate_frame(struct panfrost_context *ctx); bool panfrost_writes_point_size(struct panfrost_context *ctx); +void +panfrost_vertex_state_upd_attr_offs(struct panfrost_context *ctx, + struct midgard_payload_vertex_tiler *vp); + struct panfrost_transfer panfrost_vertex_tiler_job(struct panfrost_context *ctx, bool is_tiler); -- 2.30.2