panfrost: Detangle postfix from varying emits
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 25 Aug 2020 17:37:22 +0000 (13:37 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 28 Aug 2020 14:53:53 +0000 (14:53 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6476>

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

index a11290187e284aabaac00bc690464c5a0e0c0e20..229394599b735e96d41e3c579f6ff19b43fd85c5 100644 (file)
@@ -1694,9 +1694,11 @@ pan_emit_special_input(struct mali_attribute_buffer_packed *out,
 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 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
                         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 @@ panfrost_emit_varying_descriptor(struct panfrost_batch *batch,
         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
index 1f390024767cd5b8a2fb713a53f0cd61896c8bcf..371188d818eb78f74af4f51a5fc22d00f8ababd7 100644 (file)
@@ -79,9 +79,11 @@ panfrost_get_index_buffer_bounded(struct panfrost_context *ctx,
 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,
index 7b433a51d7776c6aa181037dba140014810d4204..58f08fae0eaf18821ad55e360207cf24628cd5c9 100644 (file)
@@ -391,14 +391,20 @@ panfrost_draw_vbo(
 
         /* 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 @@ panfrost_draw_vbo(
         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 */