Mesa (master): panfrost: Allow testing if a specific batch is targeting a scanout FB

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Sep 13 15:51:37 UTC 2019


Module: Mesa
Branch: master
Commit: e46d95d51bc11301b603f1beb9b1341b3623a46b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e46d95d51bc11301b603f1beb9b1341b3623a46b

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Sun Sep  1 10:54:38 2019 +0200

panfrost: Allow testing if a specific batch is targeting a scanout FB

Rename panfrost_is_scanout() into panfrost_batch_is_scanout(), pass it
a batch instead of a context and move the code to pan_job.c.

With this in place, we can now test if a batch is targeting a scanout
FB even if this batch is not bound to the context.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

---

 src/gallium/drivers/panfrost/pan_context.c | 20 +-------------------
 src/gallium/drivers/panfrost/pan_context.h |  3 ---
 src/gallium/drivers/panfrost/pan_job.c     | 18 ++++++++++++++++++
 src/gallium/drivers/panfrost/pan_job.h     |  3 +++
 src/gallium/drivers/panfrost/pan_mfbd.c    |  3 +--
 5 files changed, 23 insertions(+), 24 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 0fb4c2584e4..35b36f501e2 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -151,24 +151,6 @@ panfrost_emit_mfbd(struct panfrost_context *ctx, unsigned vertex_count)
         return framebuffer;
 }
 
-/* Are we currently rendering to the screen (rather than an FBO)? */
-
-bool
-panfrost_is_scanout(struct panfrost_context *ctx)
-{
-        /* If there is no color buffer, it's an FBO */
-        if (ctx->pipe_framebuffer.nr_cbufs != 1)
-                return false;
-
-        /* If we're too early that no framebuffer was sent, it's scanout */
-        if (!ctx->pipe_framebuffer.cbufs[0])
-                return true;
-
-        return ctx->pipe_framebuffer.cbufs[0]->texture->bind & PIPE_BIND_DISPLAY_TARGET ||
-               ctx->pipe_framebuffer.cbufs[0]->texture->bind & PIPE_BIND_SCANOUT ||
-               ctx->pipe_framebuffer.cbufs[0]->texture->bind & PIPE_BIND_SHARED;
-}
-
 static void
 panfrost_clear(
         struct pipe_context *pipe,
@@ -2396,7 +2378,7 @@ panfrost_set_framebuffer_state(struct pipe_context *pctx,
          */
 
         struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
-        bool is_scanout = panfrost_is_scanout(ctx);
+        bool is_scanout = panfrost_batch_is_scanout(batch);
         bool has_draws = batch->last_job.gpu;
 
         /* Bail out early when the current and new states are the same. */
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index 586b6d854b6..02552ed23de 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -315,9 +315,6 @@ panfrost_flush(
         struct pipe_fence_handle **fence,
         unsigned flags);
 
-bool
-panfrost_is_scanout(struct panfrost_context *ctx);
-
 mali_ptr panfrost_sfbd_fragment(struct panfrost_context *ctx, bool has_draws);
 mali_ptr panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws);
 
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 0f8fe1a1b7a..3d64aa8e452 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -375,6 +375,24 @@ panfrost_batch_intersection_scissor(struct panfrost_batch *batch,
         batch->maxy = MIN2(batch->maxy, maxy);
 }
 
+/* Are we currently rendering to the screen (rather than an FBO)? */
+
+bool
+panfrost_batch_is_scanout(struct panfrost_batch *batch)
+{
+        /* If there is no color buffer, it's an FBO */
+        if (batch->key.nr_cbufs != 1)
+                return false;
+
+        /* If we're too early that no framebuffer was sent, it's scanout */
+        if (!batch->key.cbufs[0])
+                return true;
+
+        return batch->key.cbufs[0]->texture->bind & PIPE_BIND_DISPLAY_TARGET ||
+               batch->key.cbufs[0]->texture->bind & PIPE_BIND_SCANOUT ||
+               batch->key.cbufs[0]->texture->bind & PIPE_BIND_SHARED;
+}
+
 void
 panfrost_batch_init(struct panfrost_context *ctx)
 {
diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h
index a5347f8814e..cf0d93f2628 100644
--- a/src/gallium/drivers/panfrost/pan_job.h
+++ b/src/gallium/drivers/panfrost/pan_job.h
@@ -189,4 +189,7 @@ panfrost_scoreboard_queue_fused_job_prepend(
 void
 panfrost_scoreboard_link_batch(struct panfrost_batch *batch);
 
+bool
+panfrost_batch_is_scanout(struct panfrost_batch *batch);
+
 #endif
diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c
index 3ad22f82c4a..8b1831c9208 100644
--- a/src/gallium/drivers/panfrost/pan_mfbd.c
+++ b/src/gallium/drivers/panfrost/pan_mfbd.c
@@ -454,9 +454,8 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws)
          * The exception is ReadPixels, but this is not supported on GLES so we
          * can safely ignore it. */
 
-        if (panfrost_is_scanout(ctx)) {
+        if (panfrost_batch_is_scanout(batch))
                 batch->requirements &= ~PAN_REQ_DEPTH_WRITE;
-        }
 
         /* Actualize the requirements */
 




More information about the mesa-commit mailing list