[v2,2/3] panfrost: Pass a batch to panfrost_drm_submit_vs_fs_batch()

Submitted by Boris Brezillon on Aug. 31, 2019, 7:53 a.m.

Details

Message ID 20190831075314.30052-2-boris.brezillon@collabora.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon Aug. 31, 2019, 7:53 a.m.
Given the function name it makes more sense to pass it a job batch
directly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
Changes in v2:
* s/panfrost_job_get_batch_for_fbo/panfrost_get_batch_for_fbo/
* s/panfrost_job_batch/panfrost_batch/g
---
 src/gallium/drivers/panfrost/pan_drm.c    | 13 ++++++-------
 src/gallium/drivers/panfrost/pan_job.c    |  2 +-
 src/gallium/drivers/panfrost/pan_screen.h |  3 ++-
 3 files changed, 9 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index 6dd22eb10096..04bb4af53a68 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -248,12 +248,12 @@  panfrost_drm_export_bo(struct panfrost_screen *screen, const struct panfrost_bo
 }
 
 static int
-panfrost_drm_submit_batch(struct panfrost_context *ctx, u64 first_job_desc,
+panfrost_drm_submit_batch(struct panfrost_batch *batch, u64 first_job_desc,
                           int reqs)
 {
+        struct panfrost_context *ctx = batch->ctx;
         struct pipe_context *gallium = (struct pipe_context *) ctx;
         struct panfrost_screen *screen = pan_screen(gallium->screen);
-        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
         struct drm_panfrost_submit submit = {0,};
         int *bo_handles, ret;
 
@@ -293,23 +293,22 @@  panfrost_drm_submit_batch(struct panfrost_context *ctx, u64 first_job_desc,
 }
 
 int
-panfrost_drm_submit_vs_fs_batch(struct panfrost_context *ctx, bool has_draws)
+panfrost_drm_submit_vs_fs_batch(struct panfrost_batch *batch, bool has_draws)
 {
+        struct panfrost_context *ctx = batch->ctx;
         int ret = 0;
 
-        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
-
         panfrost_job_add_bo(batch, ctx->scratchpad.bo);
         panfrost_job_add_bo(batch, ctx->tiler_heap.bo);
         panfrost_job_add_bo(batch, batch->polygon_list);
 
         if (batch->first_job.gpu) {
-                ret = panfrost_drm_submit_batch(ctx, batch->first_job.gpu, 0);
+                ret = panfrost_drm_submit_batch(batch, batch->first_job.gpu, 0);
                 assert(!ret);
         }
 
         if (batch->first_tiler.gpu || batch->clear) {
-                ret = panfrost_drm_submit_batch(ctx,
+                ret = panfrost_drm_submit_batch(batch,
                                                 panfrost_fragment_job(ctx, has_draws),
                                                 PANFROST_JD_REQ_FS);
                 assert(!ret);
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 4b317701477c..971adc61f225 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -211,7 +211,7 @@  panfrost_job_submit(struct panfrost_context *ctx, struct panfrost_batch *batch)
 
         bool has_draws = batch->last_job.gpu;
 
-        ret = panfrost_drm_submit_vs_fs_batch(ctx, has_draws);
+        ret = panfrost_drm_submit_vs_fs_batch(batch, has_draws);
 
         if (ret)
                 fprintf(stderr, "panfrost_job_submit failed: %d\n", ret);
diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h
index 3017b9c154f4..11cbb72075ab 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -39,6 +39,7 @@ 
 #include <panfrost-misc.h>
 #include "pan_allocate.h"
 
+struct panfrost_batch;
 struct panfrost_context;
 struct panfrost_resource;
 struct panfrost_screen;
@@ -163,7 +164,7 @@  panfrost_drm_import_bo(struct panfrost_screen *screen, int fd);
 int
 panfrost_drm_export_bo(struct panfrost_screen *screen, const struct panfrost_bo *bo);
 int
-panfrost_drm_submit_vs_fs_batch(struct panfrost_context *ctx, bool has_draws);
+panfrost_drm_submit_vs_fs_batch(struct panfrost_batch *batch, bool has_draws);
 void
 panfrost_drm_force_flush_fragment(struct panfrost_context *ctx,
                                   struct pipe_fence_handle **fence);