panfrost: Add an helper to emit a pair of vertex/tiler jobs
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 5 Mar 2020 17:53:08 +0000 (18:53 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 10 Mar 2020 11:47:34 +0000 (12:47 +0100)
Add the panfrost_emit_vertex_tiler_jobs() helper and use it in
panfrost_queue_draw().

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

index 467884cdd0bb93c5847c73d140af8e4666bb9710..4a549cc3bf049d55d2dc0ee63f5f0650a56b2e67 100644 (file)
@@ -1045,3 +1045,36 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch,
 
         vtp->postfix.sampler_descriptor = transfer.gpu;
 }
+
+void
+panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
+                                struct midgard_payload_vertex_tiler *vp,
+                                struct midgard_payload_vertex_tiler *tp)
+{
+        struct panfrost_context *ctx = batch->ctx;
+        bool wallpapering = ctx->wallpaper_batch && batch->tiler_dep;
+
+        if (wallpapering) {
+                /* Inject in reverse order, with "predicted" job indices.
+                 * THIS IS A HACK XXX */
+                panfrost_new_job(batch, JOB_TYPE_TILER, false,
+                                 batch->job_index + 2, tp, sizeof(*tp), true);
+                panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0,
+                                 vp, sizeof(*vp), true);
+                return;
+        }
+
+        /* If rasterizer discard is enable, only submit the vertex */
+
+        bool rasterizer_discard = ctx->rasterizer &&
+                                  ctx->rasterizer->base.rasterizer_discard;
+
+        unsigned vertex = panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0,
+                                           vp, sizeof(*vp), false);
+
+        if (rasterizer_discard)
+                return;
+
+        panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tp, sizeof(*tp),
+                         false);
+}
index aa77b8b28e1ac358f452ded108ee844b045727fd..d3a5e1e64e116a57cce5deb4bdd7e6b05e5ca165 100644 (file)
@@ -76,4 +76,9 @@ panfrost_emit_sampler_descriptors(struct panfrost_batch *batch,
                                   enum pipe_shader_type stage,
                                   struct midgard_payload_vertex_tiler *vtp);
 
+void
+panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
+                                struct midgard_payload_vertex_tiler *vp,
+                                struct midgard_payload_vertex_tiler *tp);
+
 #endif /* __PAN_CMDSTREAM_H__ */
index ba844cb1ca089a1751529ee35cf5716c20c2cb70..528ae2e62828b42d37116f4ff297417dba8f17f6 100644 (file)
@@ -325,29 +325,11 @@ panfrost_queue_draw(struct panfrost_context *ctx)
         /* Handle dirty flags now */
         panfrost_emit_for_draw(ctx);
 
-        /* If rasterizer discard is enable, only submit the vertex */
-
-        bool rasterizer_discard = ctx->rasterizer
-                                  && ctx->rasterizer->base.rasterizer_discard;
-
-
-        struct midgard_payload_vertex_tiler *vertex_payload = &ctx->payloads[PIPE_SHADER_VERTEX];
-        struct midgard_payload_vertex_tiler *tiler_payload = &ctx->payloads[PIPE_SHADER_FRAGMENT];
-
         struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
-        bool wallpapering = ctx->wallpaper_batch && batch->tiler_dep;
-
-        if (wallpapering) {
-                /* Inject in reverse order, with "predicted" job indices. THIS IS A HACK XXX */
-                panfrost_new_job(batch, JOB_TYPE_TILER, false, batch->job_index + 2, tiler_payload, sizeof(*tiler_payload), true);
-                panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0, vertex_payload, sizeof(*vertex_payload), true);
-        } else  {
-                unsigned vertex = panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0, vertex_payload, sizeof(*vertex_payload), false);
-
-                if (!rasterizer_discard)
-                        panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tiler_payload, sizeof(*tiler_payload), false);
-        }
 
+        panfrost_emit_vertex_tiler_jobs(batch,
+                                        &ctx->payloads[PIPE_SHADER_VERTEX],
+                                        &ctx->payloads[PIPE_SHADER_FRAGMENT]);
         panfrost_batch_adjust_stack_size(batch);
 }