panfrost: Detangle postfix from varying emits

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6476>
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index a112901..2293945 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -1694,9 +1694,11 @@
 void
 panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
                                  unsigned vertex_count,
-                                 struct mali_vertex_tiler_postfix *vertex_postfix,
-                                 struct mali_vertex_tiler_postfix *tiler_postfix,
-                                 union midgard_primitive_size *primitive_size)
+                                 mali_ptr *vs_attribs,
+                                 mali_ptr *fs_attribs,
+                                 mali_ptr *buffers,
+                                 mali_ptr *position,
+                                 mali_ptr *psiz)
 {
         /* Load the shaders */
         struct panfrost_context *ctx = batch->ctx;
@@ -1782,12 +1784,12 @@
                         gen_stride, vertex_count);
 
         /* fp32 vec4 gl_Position */
-        tiler_postfix->position_varying = panfrost_emit_varyings(batch,
+        *position = panfrost_emit_varyings(batch,
                         &varyings[pan_varying_index(present, PAN_VARY_POSITION)],
                         sizeof(float) * 4, vertex_count);
 
         if (present & (1 << PAN_VARY_PSIZ)) {
-                primitive_size->pointer = panfrost_emit_varyings(batch,
+                *psiz = panfrost_emit_varyings(batch,
                                 &varyings[pan_varying_index(present, PAN_VARY_PSIZ)],
                                 2, vertex_count);
         }
@@ -1796,11 +1798,9 @@
         pan_emit_special_input(varyings, present, PAN_VARY_FACE, MALI_ATTRIBUTE_SPECIAL_FRONT_FACING);
         pan_emit_special_input(varyings, present, PAN_VARY_FRAGCOORD, MALI_ATTRIBUTE_SPECIAL_FRAG_COORD);
 
-        vertex_postfix->varyings = T.gpu;
-        tiler_postfix->varyings = T.gpu;
-
-        vertex_postfix->varying_meta = trans.gpu;
-        tiler_postfix->varying_meta = trans.gpu + vs_size;
+        *buffers = T.gpu;
+        *vs_attribs = trans.gpu;
+        *fs_attribs = trans.gpu + vs_size;
 }
 
 void
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h
index 1f39002..371188d 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.h
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.h
@@ -79,9 +79,11 @@
 void
 panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
                                  unsigned vertex_count,
-                                 struct mali_vertex_tiler_postfix *vertex_postfix,
-                                 struct mali_vertex_tiler_postfix *tiler_postfix,
-                                 union midgard_primitive_size *primitive_size);
+                                 mali_ptr *vs_attribs,
+                                 mali_ptr *fs_attribs,
+                                 mali_ptr *buffers,
+                                 mali_ptr *position,
+                                 mali_ptr *psiz);
 
 void
 panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 7b433a5..58f08fa 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -391,14 +391,20 @@
 
         /* Emit all sort of descriptors. */
         mali_ptr push_vert = 0, push_frag = 0, attribs = 0;
+        mali_ptr varyings = 0, vs_vary = 0, fs_vary = 0, pos = 0, psiz = 0;
 
         vertex_postfix.attribute_meta = panfrost_emit_vertex_data(batch, &attribs);
         vertex_postfix.attributes = attribs;
         panfrost_emit_varying_descriptor(batch,
                                          ctx->padded_count *
                                          ctx->instance_count,
-                                         &vertex_postfix, &tiler_postfix,
-                                         &primitive_size);
+                                         &vs_vary, &fs_vary, &varyings,
+                                         &pos, &psiz);
+        vertex_postfix.varyings = varyings;
+        tiler_postfix.varyings = varyings;
+        vertex_postfix.varying_meta = vs_vary;
+        tiler_postfix.varying_meta = fs_vary;
+        tiler_postfix.position_varying = pos;
         vertex_postfix.sampler_descriptor = panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_VERTEX);
         tiler_postfix.sampler_descriptor = panfrost_emit_sampler_descriptors(batch, PIPE_SHADER_FRAGMENT);
         vertex_postfix.textures = panfrost_emit_texture_descriptors(batch, PIPE_SHADER_VERTEX);
@@ -412,6 +418,7 @@
         vertex_postfix.shader = panfrost_emit_compute_shader_meta(batch, PIPE_SHADER_VERTEX);
         tiler_postfix.shader = panfrost_emit_frag_shader_meta(batch);
 
+        primitive_size.pointer = psiz;
         panfrost_vt_update_primitive_size(ctx, &tiler_prefix, &primitive_size);
 
         /* Fire off the draw itself */