panfrost: Drop batch from scoreboard routines
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 7 Jul 2020 21:19:31 +0000 (17:19 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 9 Jul 2020 16:03:08 +0000 (12:03 -0400)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5827>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_compute.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_scoreboard.c
src/gallium/drivers/panfrost/pan_scoreboard.h

index fc029ee84b092cc7cfcabf3e3b39fe74aaf696ca..58eb3f2a0b6287c1132c24349a60490b83d56474 100644 (file)
@@ -2200,9 +2200,9 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
         if (wallpapering) {
                 /* Inject in reverse order, with "predicted" job indices.
                  * THIS IS A HACK XXX */
-                panfrost_new_job(batch, JOB_TYPE_TILER, false,
+                panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_TILER, false,
                                  batch->scoreboard.job_index + 2, tp, tp_size, true);
-                panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0,
+                panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_VERTEX, false, 0,
                                  vp, vp_size, true);
                 return;
         }
@@ -2212,13 +2212,13 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
         bool rasterizer_discard = ctx->rasterizer &&
                                   ctx->rasterizer->base.rasterizer_discard;
 
-        unsigned vertex = panfrost_new_job(batch, JOB_TYPE_VERTEX, false, 0,
+        unsigned vertex = panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_VERTEX, false, 0,
                                            vp, vp_size, false);
 
         if (rasterizer_discard)
                 return;
 
-        panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tp, tp_size,
+        panfrost_new_job(&batch->pool, &batch->scoreboard, JOB_TYPE_TILER, false, vertex, tp, tp_size,
                          false);
 }
 
index f8184b65d83f79db223c433e811a96d07792b820..2fd45859855ebaabb19576f7312c3ca1f7a03340 100644 (file)
@@ -132,7 +132,8 @@ panfrost_launch_grid(struct pipe_context *pipe,
                                           info->block[2],
                                           false);
 
-        panfrost_new_job(batch, JOB_TYPE_COMPUTE, true, 0, &payload,
+        panfrost_new_job(&batch->pool, &batch->scoreboard,
+                        JOB_TYPE_COMPUTE, true, 0, &payload,
                          sizeof(payload), false);
         panfrost_flush_all_batches(ctx, true);
 }
index 2295f9ced8c0d0b3f3e9e4c8a8c10e7678b95eeb..fb98b9a4bab06a980f4b5333b6d81445e975ee88 100644 (file)
@@ -1056,7 +1056,7 @@ panfrost_batch_submit(struct panfrost_batch *batch)
         mali_ptr polygon_list = panfrost_batch_get_polygon_list(batch,
                 MALI_TILER_MINIMUM_HEADER_SIZE);
 
-        panfrost_scoreboard_initialize_tiler(batch, polygon_list);
+        panfrost_scoreboard_initialize_tiler(&batch->pool, &batch->scoreboard, polygon_list);
 
         ret = panfrost_batch_submit_jobs(batch);
 
index 06349e36ac271dd3192d6a89e792a04024d6bb1f..d2cc0568789414dd5b85ff6bdbc2790aa4cff8be 100644 (file)
@@ -29,7 +29,7 @@
 #include "util/bitset.h"
 
 /*
- * Within a batch (panfrost_job), there are various types of Mali jobs:
+ * There are various types of Mali jobs:
  *
  *  - WRITE_VALUE: generic write primitive, used to zero tiler field
  *  - VERTEX: runs a vertex shader
 
 unsigned
 panfrost_new_job(
-                struct panfrost_batch *batch,
+                struct pan_pool *pool,
+                struct pan_scoreboard *scoreboard,
                 enum mali_job_type type,
                 bool barrier,
                 unsigned local_dep,
                 void *payload, size_t payload_size,
                 bool inject)
 {
-        struct panfrost_device *dev = pan_device(batch->ctx->base.screen);
-
         unsigned global_dep = 0;
 
         if (type == JOB_TYPE_TILER) {
@@ -124,16 +123,16 @@ panfrost_new_job(
                  * job must depend on the write value job, whose index we
                  * reserve now */
 
-                if (batch->scoreboard.tiler_dep)
-                        global_dep = batch->scoreboard.tiler_dep;
-                else if (!(dev->quirks & IS_BIFROST)) {
-                        batch->scoreboard.write_value_index = ++batch->scoreboard.job_index;
-                        global_dep = batch->scoreboard.write_value_index;
+                if (scoreboard->tiler_dep)
+                        global_dep = scoreboard->tiler_dep;
+                else if (!(pool->dev->quirks & IS_BIFROST)) {
+                        scoreboard->write_value_index = ++scoreboard->job_index;
+                        global_dep = scoreboard->write_value_index;
                 }
         }
 
         /* Assign the index */
-        unsigned index = ++batch->scoreboard.job_index;
+        unsigned index = ++scoreboard->job_index;
 
         struct mali_job_descriptor_header job = {
                 .job_descriptor_size = 1,
@@ -145,27 +144,27 @@ panfrost_new_job(
         };
 
         if (inject)
-                job.next_job = batch->scoreboard.first_job;
+                job.next_job = scoreboard->first_job;
 
-        struct panfrost_transfer transfer = panfrost_pool_alloc(&batch->pool, sizeof(job) + payload_size);
+        struct panfrost_transfer transfer = panfrost_pool_alloc(pool, sizeof(job) + payload_size);
         memcpy(transfer.cpu, &job, sizeof(job));
         memcpy(transfer.cpu + sizeof(job), payload, payload_size);
 
         if (inject) {
-                batch->scoreboard.first_job = transfer.gpu;
+                scoreboard->first_job = transfer.gpu;
                 return index;
         }
 
         /* Form a chain */
         if (type == JOB_TYPE_TILER)
-                batch->scoreboard.tiler_dep = index;
+                scoreboard->tiler_dep = index;
 
-        if (batch->scoreboard.prev_job)
-                batch->scoreboard.prev_job->next_job = transfer.gpu;
+        if (scoreboard->prev_job)
+                scoreboard->prev_job->next_job = transfer.gpu;
         else
-                batch->scoreboard.first_job = transfer.gpu;
+                scoreboard->first_job = transfer.gpu;
 
-        batch->scoreboard.prev_job = (struct mali_job_descriptor_header *) transfer.cpu;
+        scoreboard->prev_job = (struct mali_job_descriptor_header *) transfer.cpu;
         return index;
 }
 
@@ -173,12 +172,12 @@ panfrost_new_job(
  * this is called right before frame submission. */
 
 void
-panfrost_scoreboard_initialize_tiler(struct panfrost_batch *batch, mali_ptr polygon_list)
+panfrost_scoreboard_initialize_tiler(struct pan_pool *pool,
+                struct pan_scoreboard *scoreboard,
+                mali_ptr polygon_list)
 {
-        struct panfrost_device *dev = pan_device(batch->ctx->base.screen);
-
         /* Check if we even need tiling */
-        if (dev->quirks & IS_BIFROST || !batch->scoreboard.tiler_dep)
+        if (pool->dev->quirks & IS_BIFROST || !scoreboard->tiler_dep)
                 return;
 
         /* Okay, we do. Let's generate it. We'll need the job's polygon list
@@ -186,9 +185,9 @@ panfrost_scoreboard_initialize_tiler(struct panfrost_batch *batch, mali_ptr poly
 
         struct mali_job_descriptor_header job = {
                 .job_type = JOB_TYPE_WRITE_VALUE,
-                .job_index = batch->scoreboard.write_value_index,
+                .job_index = scoreboard->write_value_index,
                 .job_descriptor_size = 1,
-                .next_job = batch->scoreboard.first_job
+                .next_job = scoreboard->first_job
         };
 
         struct mali_payload_write_value payload = {
@@ -196,9 +195,9 @@ panfrost_scoreboard_initialize_tiler(struct panfrost_batch *batch, mali_ptr poly
                 .value_descriptor = MALI_WRITE_VALUE_ZERO,
         };
 
-        struct panfrost_transfer transfer = panfrost_pool_alloc(&batch->pool, sizeof(job) + sizeof(payload));
+        struct panfrost_transfer transfer = panfrost_pool_alloc(pool, sizeof(job) + sizeof(payload));
         memcpy(transfer.cpu, &job, sizeof(job));
         memcpy(transfer.cpu + sizeof(job), &payload, sizeof(payload));
 
-        batch->scoreboard.first_job = transfer.gpu;
+        scoreboard->first_job = transfer.gpu;
 }
index d6b91a482696bcbafd8ed49f0304a09bbb2506de..329635f095a0f1d6dde69ce8a641e9ec8b2550fd 100644 (file)
@@ -47,14 +47,17 @@ struct pan_scoreboard {
 
 unsigned
 panfrost_new_job(
-                struct panfrost_batch *batch,
+                struct pan_pool *pool,
+                struct pan_scoreboard *scoreboard,
                 enum mali_job_type type,
                 bool barrier,
                 unsigned local_dep,
                 void *payload, size_t payload_size,
                 bool inject);
 
-void panfrost_scoreboard_initialize_tiler(struct panfrost_batch *batch,
+void panfrost_scoreboard_initialize_tiler(
+                struct pan_pool *pool,
+                struct pan_scoreboard *scoreboard,
                 mali_ptr polygon_list);
 
 #endif