Mesa (master): panfrost: Don't return imported/exported BOs to the cache
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 18 09:05:31 UTC 2019
Module: Mesa
Branch: master
Commit: 9af4aeaaf7c88c80718caf10041e63545b202e2b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9af4aeaaf7c88c80718caf10041e63545b202e2b
Author: Boris Brezillon <boris.brezillon at collabora.com>
Date: Sat Sep 14 11:46:44 2019 +0200
panfrost: Don't return imported/exported BOs to the cache
We don't know who else is using the BO in that case, and thus shouldn't
re-use it for something else.
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 | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/gallium/drivers/panfrost/pan_bo.c
index 5d0f296cc4f..209d1e0d71e 100644
--- a/src/gallium/drivers/panfrost/pan_bo.c
+++ b/src/gallium/drivers/panfrost/pan_bo.c
@@ -182,6 +182,9 @@ panfrost_bo_cache_put(struct panfrost_bo *bo)
{
struct panfrost_screen *screen = bo->screen;
+ if (bo->flags & PAN_BO_DONT_REUSE)
+ return false;
+
pthread_mutex_lock(&screen->bo_cache_lock);
struct list_head *bucket = pan_bucket(screen, bo->size);
struct drm_panfrost_madvise madv;
@@ -352,6 +355,7 @@ panfrost_bo_import(struct panfrost_screen *screen, int fd)
bo->gem_handle = gem_handle;
bo->gpu = (mali_ptr) get_bo_offset.offset;
bo->size = lseek(fd, 0, SEEK_END);
+ bo->flags |= PAN_BO_DONT_REUSE;
assert(bo->size > 0);
pipe_reference_init(&bo->reference, 1);
@@ -372,6 +376,7 @@ panfrost_bo_export(struct panfrost_bo *bo)
if (ret == -1)
return -1;
+ bo->flags |= PAN_BO_DONT_REUSE;
return args.fd;
}
diff --git a/src/gallium/drivers/panfrost/pan_bo.h b/src/gallium/drivers/panfrost/pan_bo.h
index 2858d3782ef..33fbddff336 100644
--- a/src/gallium/drivers/panfrost/pan_bo.h
+++ b/src/gallium/drivers/panfrost/pan_bo.h
@@ -52,6 +52,10 @@ struct panfrost_screen;
* (semantically distinct from INVISIBLE, which cannot never be mmaped) */
#define PAN_BO_DELAY_MMAP (1 << 4)
+/* Some BOs shouldn't be returned back to the reuse BO cache, use this flag to
+ * let the BO logic know about this contraint. */
+#define PAN_BO_DONT_REUSE (1 << 5)
+
struct panfrost_bo {
/* Must be first for casting */
struct list_head link;
More information about the mesa-commit
mailing list