Mesa (main): freedreno: Don't return a flushed batch

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 5 19:09:11 UTC 2021


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Fri Jun  4 16:32:30 2021 -0700

freedreno: Don't return a flushed batch

Somehow fairly recently the traces CI job started hitting timeouts, not
all the time but enough to be inconvenient for CI.  I tracked it down to
getting into a situation where `ctx->batch->flush == true`, which causes
an infinite loop in the draw_vbo and clear paths (because
fd_batch_lock_submit() checks for flushed batch but fd_context_batch()
does not).  I'm not entirely sure how we get into that state, or what
triggered this (seems possibly triggered by !10937).  But it is easy
enough to recover.

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

---

 src/gallium/drivers/freedreno/freedreno_batch_cache.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
index 98421a0123d..78fc81691f4 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
@@ -436,9 +436,15 @@ batch_from_key(struct fd_batch_cache *cache, struct fd_batch_key *key,
       _mesa_hash_table_search_pre_hashed(cache->ht, hash, key);
 
    if (entry) {
-      free(key);
-      fd_batch_reference(&batch, (struct fd_batch *)entry->data);
-      return batch;
+      fd_batch_reference_locked(&batch, (struct fd_batch *)entry->data);
+
+      if (batch->flushed) {
+         fd_bc_invalidate_batch(batch, false);
+         fd_batch_reference_locked(&batch, NULL);
+      } else {
+         free(key);
+         return batch;
+      }
    }
 
    batch = alloc_batch_locked(cache, ctx, false);



More information about the mesa-commit mailing list