panfrost: Fix various leaks unmapping resources
v2: Don't check for NULL before free() Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
@@ -287,16 +287,18 @@ panfrost_destroy_bo(struct panfrost_screen *screen, struct panfrost_bo *pbo)
|
|||||||
{
|
{
|
||||||
struct panfrost_bo *bo = (struct panfrost_bo *)pbo;
|
struct panfrost_bo *bo = (struct panfrost_bo *)pbo;
|
||||||
|
|
||||||
if (bo->entry[0] != NULL) {
|
for (int l = 0; l < MAX_MIP_LEVELS; ++l) {
|
||||||
/* Most allocations have an entry to free */
|
if (bo->entry[l] != NULL) {
|
||||||
bo->entry[0]->freed = true;
|
/* Most allocations have an entry to free */
|
||||||
pb_slab_free(&screen->slabs, &bo->entry[0]->base);
|
bo->entry[l]->freed = true;
|
||||||
|
pb_slab_free(&screen->slabs, &bo->entry[l]->base);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bo->tiled) {
|
if (bo->tiled) {
|
||||||
/* Tiled has a malloc'd CPU, so just plain ol' free needed */
|
/* Tiled has a malloc'd CPU, so just plain ol' free needed */
|
||||||
|
|
||||||
for (int l = 0; bo->cpu[l]; l++) {
|
for (int l = 0; l < MAX_MIP_LEVELS; ++l) {
|
||||||
free(bo->cpu[l]);
|
free(bo->cpu[l]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,9 +511,10 @@ panfrost_slab_can_reclaim(void *priv, struct pb_slab_entry *entry)
|
|||||||
static void
|
static void
|
||||||
panfrost_slab_free(void *priv, struct pb_slab *slab)
|
panfrost_slab_free(void *priv, struct pb_slab *slab)
|
||||||
{
|
{
|
||||||
/* STUB */
|
struct panfrost_memory *mem = (struct panfrost_memory *) slab;
|
||||||
//struct panfrost_memory *mem = (struct panfrost_memory *) slab;
|
struct panfrost_screen *screen = (struct panfrost_screen *) priv;
|
||||||
printf("stub: Tried to free slab\n");
|
|
||||||
|
screen->driver->free_slab(screen, mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -58,7 +58,9 @@ struct panfrost_driver {
|
|||||||
int extra_flags,
|
int extra_flags,
|
||||||
int commit_count,
|
int commit_count,
|
||||||
int extent);
|
int extent);
|
||||||
void (*enable_counters) (struct panfrost_screen *screen);
|
void (*free_slab) (struct panfrost_screen *screen,
|
||||||
|
struct panfrost_memory *mem);
|
||||||
|
void (*enable_counters) (struct panfrost_screen *screen);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct panfrost_screen {
|
struct panfrost_screen {
|
||||||
|
Reference in New Issue
Block a user