Mesa (master): panfrost: Stop using panfrost_bo_release() outside of pan_bo.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 18 09:05:31 UTC 2019


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

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Sat Sep 14 11:23:51 2019 +0200

panfrost: Stop using panfrost_bo_release() outside of pan_bo.c

panfrost_bo_unreference() should be used instead.

The only difference caused by this change is that the scratchpad,
tiler_heap and tiler_dummy BOs are now returned to the cache instead
of being freed when a context is destroyed. This is only a problem if
we care about context isolation, which apparently is not the case since
transient BOs are already returned to the per-FD cache (and all contexts
share the same address space anyway, so enforcing context isolation
is almost impossible).

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_bo.c       | 5 ++++-
 src/gallium/drivers/panfrost/pan_bo.h       | 2 --
 src/gallium/drivers/panfrost/pan_context.c  | 6 +++---
 src/gallium/drivers/panfrost/pan_resource.c | 2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/gallium/drivers/panfrost/pan_bo.c
index d9c4cb208bc..396b25230c4 100644
--- a/src/gallium/drivers/panfrost/pan_bo.c
+++ b/src/gallium/drivers/panfrost/pan_bo.c
@@ -84,6 +84,9 @@ pan_bucket(struct panfrost_screen *screen, unsigned size)
         return &screen->bo_cache[pan_bucket_index(size)];
 }
 
+static void
+panfrost_bo_release(struct panfrost_bo *bo, bool cacheable);
+
 /* Tries to fetch a BO of sufficient size with the appropriate flags from the
  * BO cache. If it succeeds, it returns that BO and removes the BO from the
  * cache. If it fails, it returns NULL signaling the caller to allocate a new
@@ -287,7 +290,7 @@ panfrost_bo_create(struct panfrost_screen *screen, size_t size,
         return bo;
 }
 
-void
+static void
 panfrost_bo_release(struct panfrost_bo *bo, bool cacheable)
 {
         if (!bo)
diff --git a/src/gallium/drivers/panfrost/pan_bo.h b/src/gallium/drivers/panfrost/pan_bo.h
index dfdb202e5d3..2858d3782ef 100644
--- a/src/gallium/drivers/panfrost/pan_bo.h
+++ b/src/gallium/drivers/panfrost/pan_bo.h
@@ -83,8 +83,6 @@ panfrost_bo_create(struct panfrost_screen *screen, size_t size,
                    uint32_t flags);
 void
 panfrost_bo_mmap(struct panfrost_bo *bo);
-void
-panfrost_bo_release(struct panfrost_bo *bo, bool cacheable);
 struct panfrost_bo *
 panfrost_bo_import(struct panfrost_screen *screen, int fd);
 int
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 55fe9c26454..c5139a21f9a 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -2425,9 +2425,9 @@ panfrost_destroy(struct pipe_context *pipe)
         if (panfrost->blitter_wallpaper)
                 util_blitter_destroy(panfrost->blitter_wallpaper);
 
-        panfrost_bo_release(panfrost->scratchpad, false);
-        panfrost_bo_release(panfrost->tiler_heap, false);
-        panfrost_bo_release(panfrost->tiler_dummy, false);
+        panfrost_bo_unreference(panfrost->scratchpad);
+        panfrost_bo_unreference(panfrost->tiler_heap);
+        panfrost_bo_unreference(panfrost->tiler_dummy);
 
         ralloc_free(pipe);
 }
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 1e8a1eadb51..363a330c4fd 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -839,7 +839,7 @@ panfrost_resource_hint_layout(
 
         /* If we grew in size, reallocate the BO */
         if (new_size > rsrc->bo->size) {
-                panfrost_bo_release(rsrc->bo, true);
+                panfrost_bo_unreference(rsrc->bo);
                 rsrc->bo = panfrost_bo_create(screen, new_size, PAN_BO_DELAY_MMAP);
         }
 }




More information about the mesa-commit mailing list