Mesa (main): freedreno: Optimize no-op submits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 4 15:29:13 UTC 2021


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Sep 30 08:39:53 2021 -0700

freedreno: Optimize no-op submits

In some cases we need to emit a no-op batch/submit, just to get a fence.
No need to emit all the boilerplate state-resture and flushing in this
case.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13160>

---

 src/freedreno/drm/freedreno_ringbuffer.h       | 7 +++++++
 src/gallium/drivers/freedreno/freedreno_gmem.c | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/drm/freedreno_ringbuffer.h b/src/freedreno/drm/freedreno_ringbuffer.h
index 6fc49f72b8e..ae985801ac9 100644
--- a/src/freedreno/drm/freedreno_ringbuffer.h
+++ b/src/freedreno/drm/freedreno_ringbuffer.h
@@ -256,6 +256,13 @@ fd_ringbuffer_size(struct fd_ringbuffer *ring)
    return offset_bytes(ring->cur, ring->start);
 }
 
+static inline bool
+fd_ringbuffer_empty(struct fd_ringbuffer *ring)
+{
+   return (fd_ringbuffer_cmd_count(ring) == 1) &&
+          (offset_bytes(ring->cur, ring->start) == 0);
+}
+
 #define LOG_DWORDS 0
 
 static inline void
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
index 22d4bc279d2..dbdc63faec0 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.c
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
@@ -724,7 +724,8 @@ fd_gmem_render_tiles(struct fd_batch *batch)
 
    if (batch->nondraw) {
       DBG("%p: rendering non-draw", batch);
-      render_sysmem(batch);
+      if (!fd_ringbuffer_empty(batch->draw))
+         render_sysmem(batch);
       ctx->stats.batch_nondraw++;
    } else if (sysmem) {
       trace_render_sysmem(&batch->trace, batch->gmem);



More information about the mesa-commit mailing list