Mesa (main): freedreno: Drop batch-cache orphan tracking.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 15 20:59:33 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Mon Jun 14 11:42:43 2021 -0700

freedreno: Drop batch-cache orphan tracking.

Let's let valgrind/asan handle leak detection.  This means you can use the
flag even on non-DEBUG builds.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>

---

 src/gallium/drivers/freedreno/freedreno_batch.c    |  9 --------
 src/gallium/drivers/freedreno/freedreno_batch.h    |  6 ------
 .../drivers/freedreno/freedreno_batch_cache.c      | 25 ++++++----------------
 src/gallium/drivers/freedreno/freedreno_screen.c   |  5 -----
 src/gallium/drivers/freedreno/freedreno_screen.h   |  5 -----
 5 files changed, 7 insertions(+), 43 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c
index 3abe60d9094..82f425d96f7 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch.c
@@ -141,11 +141,6 @@ fd_batch_create(struct fd_context *ctx, bool nondraw)
 
    batch_init(batch);
 
-   fd_screen_assert_locked(ctx->screen);
-   if (BATCH_DEBUG) {
-      _mesa_set_add(ctx->screen->live_batches, batch);
-   }
-
    return batch;
 }
 
@@ -305,10 +300,6 @@ __fd_batch_destroy(struct fd_batch *batch)
 
    fd_screen_assert_locked(batch->ctx->screen);
 
-   if (BATCH_DEBUG) {
-      _mesa_set_remove_key(ctx->screen->live_batches, batch);
-   }
-
    fd_bc_invalidate_batch(batch, true);
 
    batch_reset_resources(batch);
diff --git a/src/gallium/drivers/freedreno/freedreno_batch.h b/src/gallium/drivers/freedreno/freedreno_batch.h
index 535d0deb797..9a7bfcd7bfe 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch.h
+++ b/src/gallium/drivers/freedreno/freedreno_batch.h
@@ -41,12 +41,6 @@
 extern "C" {
 #endif
 
-#ifdef DEBUG
-#define BATCH_DEBUG FD_DBG(MSGS)
-#else
-#define BATCH_DEBUG 0
-#endif
-
 struct fd_resource;
 struct fd_batch_key;
 struct fd_batch_result;
diff --git a/src/gallium/drivers/freedreno/freedreno_batch_cache.c b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
index 751c34ada98..3fb6b04f155 100644
--- a/src/gallium/drivers/freedreno/freedreno_batch_cache.c
+++ b/src/gallium/drivers/freedreno/freedreno_batch_cache.c
@@ -204,24 +204,12 @@ fd_bc_flush_deferred(struct fd_batch_cache *cache, struct fd_context *ctx)
    bc_flush(cache, ctx, true);
 }
 
-static bool
-batch_in_cache(struct fd_batch_cache *cache, struct fd_batch *batch)
-{
-   struct fd_batch *b;
-
-   foreach_batch (b, cache, cache->batch_mask)
-      if (b == batch)
-         return true;
-
-   return false;
-}
-
 void
 fd_bc_dump(struct fd_screen *screen, const char *fmt, ...)
 {
    struct fd_batch_cache *cache = &screen->batch_cache;
 
-   if (!BATCH_DEBUG)
+   if (!FD_DBG(MSGS))
       return;
 
    fd_screen_lock(screen);
@@ -231,11 +219,12 @@ fd_bc_dump(struct fd_screen *screen, const char *fmt, ...)
    vprintf(fmt, ap);
    va_end(ap);
 
-   set_foreach (screen->live_batches, entry) {
-      struct fd_batch *batch = (struct fd_batch *)entry->key;
-      printf("  %p<%u>%s%s\n", batch, batch->seqno,
-             batch->needs_flush ? ", NEEDS FLUSH" : "",
-             batch_in_cache(cache, batch) ? "" : ", ORPHAN");
+   for (int i = 0; i < ARRAY_SIZE(cache->batches); i++) {
+      struct fd_batch *batch = cache->batches[i];
+      if (batch) {
+         printf("  %p<%u>%s\n", batch, batch->seqno,
+                batch->needs_flush ? ", NEEDS FLUSH" : "");
+      }
    }
 
    printf("----\n");
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index aa4e9875f93..0054c738ea4 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -170,8 +170,6 @@ fd_screen_destroy(struct pipe_screen *pscreen)
    if (screen->compiler)
       ir3_screen_fini(pscreen);
 
-   ralloc_free(screen->live_batches);
-
    free(screen->perfcntr_queries);
    free(screen);
 }
@@ -1078,9 +1076,6 @@ fd_screen_create(struct fd_device *dev, struct renderonly *ro)
    if (fd_device_version(dev) >= FD_VERSION_UNLIMITED_CMDS)
       screen->reorder = !FD_DBG(INORDER);
 
-   if (BATCH_DEBUG)
-      screen->live_batches = _mesa_pointer_set_create(NULL);
-
    fd_bc_init(&screen->batch_cache);
 
    list_inithead(&screen->context_list);
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h
index 4ffcf5397c7..d5945085427 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.h
+++ b/src/gallium/drivers/freedreno/freedreno_screen.h
@@ -144,11 +144,6 @@ struct fd_screen {
    const uint64_t *supported_modifiers;
 
    struct renderonly *ro;
-
-   /* when BATCH_DEBUG is enabled, tracking for fd_batch's which are not yet
-    * freed:
-    */
-   struct set *live_batches;
 };
 
 static inline struct fd_screen *



More information about the mesa-commit mailing list