[Mesa-dev] [PATCH 2/3] panfrost: Free imported BOs
Alyssa Rosenzweig
alyssa at rosenzweig.io
Fri Feb 15 01:03:30 UTC 2019
Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
---
src/gallium/drivers/panfrost/pan_resource.c | 4 ++++
src/gallium/drivers/panfrost/pan_resource.h | 6 ++++++
src/gallium/drivers/panfrost/pan_screen.h | 2 ++
3 files changed, 12 insertions(+)
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index fb9b8e63c83..b13461013f5 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -313,6 +313,10 @@ panfrost_destroy_bo(struct panfrost_screen *screen, struct panfrost_bo *pbo)
/* TODO */
printf("--leaking checksum (%zd bytes)--\n", bo->checksum_slab.size);
}
+
+ if (bo->imported) {
+ screen->driver->free_imported_bo(screen, bo);
+ }
}
static void
diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h
index 78baffbd1b2..48c0ca7fbb1 100644
--- a/src/gallium/drivers/panfrost/pan_resource.h
+++ b/src/gallium/drivers/panfrost/pan_resource.h
@@ -45,6 +45,12 @@ struct panfrost_bo {
/* Memory entry corresponding to gpu above */
struct panfrost_memory_entry *entry[MAX_MIP_LEVELS];
+ /* Set if this bo was imported rather than allocated */
+ bool imported;
+
+ /* Number of bytes of the imported allocation */
+ size_t imported_size;
+
/* Set for tiled, clear for linear. */
bool tiled;
diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h
index afb3d34b5b1..646923c9864 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -60,6 +60,8 @@ struct panfrost_driver {
int extent);
void (*free_slab) (struct panfrost_screen *screen,
struct panfrost_memory *mem);
+ void (*free_imported_bo) (struct panfrost_screen *screen,
+ struct panfrost_bo *bo);
void (*enable_counters) (struct panfrost_screen *screen);
};
--
2.20.1
More information about the mesa-dev
mailing list