panfrost: Rename panfrost_stage_attributes()
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 5 Mar 2020 20:48:09 +0000 (21:48 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 10 Mar 2020 11:47:34 +0000 (12:47 +0100)
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 <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_cmdstream.h
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_context.h

index 4a549cc3bf049d55d2dc0ee63f5f0650a56b2e67..c9aa4b8399d07b090ba3899a15cf323e45058b10 100644 (file)
@@ -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,
index d3a5e1e64e116a57cce5deb4bdd7e6b05e5ca165..1b69a0be9c76c6a830b02b4fb72f74045f8342b6 100644 (file)
@@ -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,
index 002801875a233ad558581030a7c07f86556d1733..a70ce65c490c383364104caead915f3c3a26262b 100644 (file)
@@ -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]);
index 9c26b012493dc446064786bfd50628d39e1b666b..cc8d0eb16dfadf349071a00b4d8f669ea1e0df3c 100644 (file)
@@ -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);