From 4a4ed53c012c39c3a0781c7944f9449e258ada1d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 15 Feb 2019 00:15:14 +0000 Subject: panfrost: Free imported BOs Signed-off-by: Alyssa Rosenzweig --- 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(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 1287193c0e9..26f4782a4ad 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -312,6 +312,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 af92fa48ec9..dea2332dbfa 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); }; -- cgit v1.2.3