OSDN Git Service

panfrost: Stop using panfrost_bo_release() outside of pan_bo.c
authorBoris Brezillon <boris.brezillon@collabora.com>
Sat, 14 Sep 2019 09:23:51 +0000 (11:23 +0200)
committerBoris Brezillon <boris.brezillon@collabora.com>
Wed, 18 Sep 2019 08:35:06 +0000 (10:35 +0200)
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@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/gallium/drivers/panfrost/pan_bo.c
src/gallium/drivers/panfrost/pan_bo.h
src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_resource.c

index d9c4cb2..396b252 100644 (file)
@@ -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)
index dfdb202..2858d37 100644 (file)
@@ -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
index 55fe9c2..c5139a2 100644 (file)
@@ -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);
 }
index 1e8a1ea..363a330 100644 (file)
@@ -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);
         }
 }