Mesa (staging/21.1): freedreno/a6xx: Fix framebuffer_barrier crash

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 14 19:24:03 UTC 2021


Module: Mesa
Branch: staging/21.1
Commit: 54f05e878c4da171c0a1b34d9c92ecbf96ffa73a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=54f05e878c4da171c0a1b34d9c92ecbf96ffa73a

Author: Rob Clark <robdclark at chromium.org>
Date:   Wed Jun 30 09:49:40 2021 -0700

freedreno/a6xx: Fix framebuffer_barrier crash

This is emitting cmdstream, it should take the submit lock to (a) ensure
we actually have a batch, and (b) prevent it from being flushed from
under it.  This was overlooked in the conversion.

Fixes: 02298ed1fc6 ("freedreno: Add submit lock")
Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11658>
(cherry picked from commit 525be273266fb78073286d8544e10f6d20f2d3a6)

---

 src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index 88aef02c77d..e648cc377d1 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -1378,10 +1378,12 @@ static void
 fd6_framebuffer_barrier(struct fd_context *ctx) assert_dt
 {
    struct fd6_context *fd6_ctx = fd6_context(ctx);
-   struct fd_batch *batch = ctx->batch;
+   struct fd_batch *batch = fd_context_batch_locked(ctx);
    struct fd_ringbuffer *ring = batch->draw;
    unsigned seqno;
 
+   fd_batch_needs_flush(batch);
+
    seqno = fd6_event_write(batch, ring, RB_DONE_TS, true);
 
    OUT_PKT7(ring, CP_WAIT_REG_MEM, 6);
@@ -1403,6 +1405,9 @@ fd6_framebuffer_barrier(struct fd_context *ctx) assert_dt
    OUT_RING(ring, CP_WAIT_MEM_GTE_0_RESERVED(0));
    OUT_RELOC(ring, control_ptr(fd6_ctx, seqno));
    OUT_RING(ring, CP_WAIT_MEM_GTE_3_REF(seqno));
+
+   fd_batch_unlock_submit(batch);
+   fd_batch_reference(&batch, NULL);
 }
 
 void



More information about the mesa-commit mailing list