Mesa (master): panfrost: Drop batch from scoreboard routines
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jul 9 17:05:43 UTC 2020
Module: Mesa
Branch: master
Commit: 7ec6ee405789c9835ef50407ab8c948e513d4a9d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ec6ee405789c9835ef50407ab8c948e513d4a9d
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Tue Jul 7 17:19:31 2020 -0400
panfrost: Drop batch from scoreboard routines
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5827>
---
src/gallium/drivers/panfrost/pan_cmdstream.c | 8 ++---
src/gallium/drivers/panfrost/pan_compute.c | 3 +-
src/gallium/drivers/panfrost/pan_job.c | 2 +-
src/gallium/drivers/panfrost/pan_scoreboard.c | 51 +++++++++++++--------------
src/gallium/drivers/panfrost/pan_scoreboard.h | 7 ++--
5 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index fc029ee84b0..58eb3f2a0b6 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -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);
}
diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index f8184b65d83..2fd45859855 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -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);
}
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 2295f9ced8c..fb98b9a4bab 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -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);
diff --git a/src/gallium/drivers/panfrost/pan_scoreboard.c b/src/gallium/drivers/panfrost/pan_scoreboard.c
index 06349e36ac2..d2cc0568789 100644
--- a/src/gallium/drivers/panfrost/pan_scoreboard.c
+++ b/src/gallium/drivers/panfrost/pan_scoreboard.c
@@ -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
@@ -108,15 +108,14 @@
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;
}
diff --git a/src/gallium/drivers/panfrost/pan_scoreboard.h b/src/gallium/drivers/panfrost/pan_scoreboard.h
index d6b91a48269..329635f095a 100644
--- a/src/gallium/drivers/panfrost/pan_scoreboard.h
+++ b/src/gallium/drivers/panfrost/pan_scoreboard.h
@@ -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
More information about the mesa-commit
mailing list