Mesa (main): panfrost: Simplify get_fresh_batch_for_fbo

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 19:22:31 UTC 2021


Module: Mesa
Branch: main
Commit: 9307028255f1f60b52c3852e0e4b68afa494d43b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9307028255f1f60b52c3852e0e4b68afa494d43b

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Aug 12 21:17:29 2021 +0000

panfrost: Simplify get_fresh_batch_for_fbo

Makes the code easier to read, too.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12525>

---

 src/gallium/drivers/panfrost/pan_job.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index c52d45a7d02..ee67d363729 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -222,21 +222,15 @@ panfrost_get_fresh_batch_for_fbo(struct panfrost_context *ctx, const char *reaso
         batch = panfrost_get_batch(ctx, &ctx->pipe_framebuffer);
         panfrost_dirty_state_all(ctx);
 
-        /* The batch has no draw/clear queued, let's return it directly.
-         * Note that it's perfectly fine to re-use a batch with an
-         * existing clear, we'll just update it with the new clear request.
-         */
-        if (!batch->scoreboard.first_job) {
-                ctx->batch = batch;
-                return batch;
+        /* We only need to submit and get a fresh batch if there is no
+         * draw/clear queued. Otherwise we may reuse the batch. */
+
+        if (batch->scoreboard.first_job) {
+                perf_debug_ctx(ctx, "Flushing the current FBO due to: %s", reason);
+                panfrost_batch_submit(batch, 0, 0);
+                batch = panfrost_get_batch(ctx, &ctx->pipe_framebuffer);
         }
 
-        /* Otherwise, we need to freeze the existing one and instantiate a new
-         * one.
-         */
-        perf_debug_ctx(ctx, "Flushing the current FBO due to: %s", reason);
-        panfrost_batch_submit(batch, 0, 0);
-        batch = panfrost_get_batch(ctx, &ctx->pipe_framebuffer);
         ctx->batch = batch;
         return batch;
 }



More information about the mesa-commit mailing list