[Mesa-dev] [PATCH 1/4] panfrost: Add transient BOs to job batches

Boris Brezillon boris.brezillon at collabora.com
Fri Aug 30 14:05:34 UTC 2019


Memory allocated through panfrost_allocate_transient() is likely to
come from the transient pool. Let's add the BO backing the allocated
memory region to the job batch so the kernel can retain this BO while
jobs are executed.

In practice that has never been a problem because the transient pool
is never shrinked, and even if it was, we still control the lifetime of
the job, so there's no reason for this BO to be freed before the GPU is
done executing the batch. But it still make sense to add the BO for
debugging purpose.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
---
 src/gallium/drivers/panfrost/pan_allocate.c | 2 ++
 src/gallium/drivers/panfrost/pan_drm.c      | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/panfrost/pan_allocate.c b/src/gallium/drivers/panfrost/pan_allocate.c
index f549c864c70b..080f917bccdc 100644
--- a/src/gallium/drivers/panfrost/pan_allocate.c
+++ b/src/gallium/drivers/panfrost/pan_allocate.c
@@ -110,6 +110,8 @@ panfrost_allocate_transient(struct panfrost_context *ctx, size_t sz)
                         bo = panfrost_create_slab(screen, &index);
                 }
 
+                panfrost_job_add_bo(batch, bo);
+
                 /* Remember we created this */
                 util_dynarray_append(&batch->transient_indices, unsigned, index);
 
diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 8e05fc936b25..1399b1afd48e 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -298,7 +298,6 @@ panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws)
 
         struct panfrost_job *job = panfrost_get_job_for_fbo(ctx);
 
-        /* TODO: Add here the transient pools */
         panfrost_job_add_bo(job, ctx->scratchpad.bo);
         panfrost_job_add_bo(job, ctx->tiler_heap.bo);
         panfrost_job_add_bo(job, job->polygon_list);
-- 
2.21.0



More information about the mesa-dev mailing list