panfrost: Hoist add_fbo_bo call
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 14 Aug 2020 22:31:05 +0000 (18:31 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 19 Aug 2020 08:24:37 +0000 (08:24 +0000)
Move it to batch initialization, to take it out of the clear/draw path.
This should make sense - as soon as the batch is created, we need to
hold the refference. Functionally there shouldn't be unused batches
floating around anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6327>

src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_job.h

index 84843ac87868b06c17d5ee44375295dc0a0527e0..f3f1aa5536215321e3057be469ba6d80ae8e5612 100644 (file)
@@ -139,8 +139,6 @@ panfrost_clear(
          * fragment jobs.
          */
         struct panfrost_batch *batch = panfrost_get_fresh_batch_for_fbo(ctx);
-
-        panfrost_batch_add_fbo_bos(batch);
         panfrost_batch_clear(batch, buffers, color, depth, stencil);
 }
 
@@ -309,12 +307,9 @@ panfrost_draw_vbo(
                 return;
         }
 
-        /* Now that we have a guaranteed terminating path, find the job.
-         * Assignment commented out to prevent unused warning */
+        /* Now that we have a guaranteed terminating path, find the job. */
 
         struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
-
-        panfrost_batch_add_fbo_bos(batch);
         panfrost_batch_set_requirements(batch);
 
         /* Take into account a negative bias */
index 33b8bce4df87681680995063819737189b3ce646..b0665da6b6ea44e3a06c06d1ca4a150a0339576d 100644 (file)
@@ -92,6 +92,9 @@ panfrost_batch_fence_reference(struct panfrost_batch_fence *fence)
         pipe_reference(NULL, &fence->reference);
 }
 
+static void
+panfrost_batch_add_fbo_bos(struct panfrost_batch *batch);
+
 static struct panfrost_batch *
 panfrost_create_batch(struct panfrost_context *ctx,
                       const struct pipe_framebuffer_state *key)
@@ -111,6 +114,8 @@ panfrost_create_batch(struct panfrost_context *ctx,
 
         batch->pool = panfrost_create_pool(batch, pan_device(ctx->base.screen));
 
+        panfrost_batch_add_fbo_bos(batch);
+
         return batch;
 }
 
@@ -559,7 +564,8 @@ panfrost_batch_add_resource_bos(struct panfrost_batch *batch,
                 panfrost_batch_add_bo(batch, rsrc->separate_stencil->bo, flags);
 }
 
-void panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
+static void
+panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
 {
         uint32_t flags = PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_WRITE |
                          PAN_BO_ACCESS_VERTEX_TILER |
index 68e1f40b99ea66d6180b867578b1ca9d22bba1f4..e94dd76ad0c007a46aee6c8c68f62311af1a5e99 100644 (file)
@@ -147,8 +147,6 @@ void
 panfrost_batch_add_bo(struct panfrost_batch *batch, struct panfrost_bo *bo,
                       uint32_t flags);
 
-void panfrost_batch_add_fbo_bos(struct panfrost_batch *batch);
-
 struct panfrost_bo *
 panfrost_batch_create_bo(struct panfrost_batch *batch, size_t size,
                          uint32_t create_flags, uint32_t access_flags);