Mesa (master): panfrost: Prepare things to avoid flushes on FB switch

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


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Thu Sep  5 19:07:12 2019 +0200

panfrost: Prepare things to avoid flushes on FB switch

panfrost_attach_vt_xxx() functions are now passed a batch, and the
generated FB desc is kept in panfrost_batch so we can switch FBs
without forcing a flush. The postfix->framebuffer field is restored
on the next attach_vt_framebuffer() call if the batch already has an
FB desc.

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 | 17 +++++++++--------
 src/gallium/drivers/panfrost/pan_job.h     |  3 +++
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index f3950b05391..745d42e314f 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -163,18 +163,16 @@ panfrost_clear(
 }
 
 static mali_ptr
-panfrost_attach_vt_mfbd(struct panfrost_context *ctx)
+panfrost_attach_vt_mfbd(struct panfrost_batch *batch)
 {
-        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
         struct bifrost_framebuffer mfbd = panfrost_emit_mfbd(batch, ~0);
 
         return panfrost_upload_transient(batch, &mfbd, sizeof(mfbd)) | MALI_MFBD;
 }
 
 static mali_ptr
-panfrost_attach_vt_sfbd(struct panfrost_context *ctx)
+panfrost_attach_vt_sfbd(struct panfrost_batch *batch)
 {
-        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
         struct mali_single_framebuffer sfbd = panfrost_emit_sfbd(batch, ~0);
 
         return panfrost_upload_transient(batch, &sfbd, sizeof(sfbd)) | MALI_SFBD;
@@ -191,12 +189,15 @@ panfrost_attach_vt_framebuffer(struct panfrost_context *ctx)
         }
 
         struct panfrost_screen *screen = pan_screen(ctx->base.screen);
-        mali_ptr framebuffer = screen->require_sfbd ?
-                               panfrost_attach_vt_sfbd(ctx) :
-                               panfrost_attach_vt_mfbd(ctx);
+        struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+
+        if (!batch->framebuffer)
+                batch->framebuffer = screen->require_sfbd ?
+                                     panfrost_attach_vt_sfbd(batch) :
+                                     panfrost_attach_vt_mfbd(batch);
 
         for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i)
-                ctx->payloads[i].postfix.framebuffer = framebuffer;
+                ctx->payloads[i].postfix.framebuffer = batch->framebuffer;
 }
 
 /* Reset per-frame context, called on context initialisation as well as after
diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h
index cf0d93f2628..fe15e2dddab 100644
--- a/src/gallium/drivers/panfrost/pan_job.h
+++ b/src/gallium/drivers/panfrost/pan_job.h
@@ -108,6 +108,9 @@ struct panfrost_batch {
 
         /* Polygon list bound to the batch, or NULL if none bound yet */
         struct panfrost_bo *polygon_list;
+
+        /* Framebuffer descriptor. */
+        mali_ptr framebuffer;
 };
 
 /* Functions for managing the above */




More information about the mesa-commit mailing list