panfrost: Stop using panfrost_bo_release() outside of pan_bo.c

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>
This commit is contained in:
Boris Brezillon 2019-09-14 11:23:51 +02:00
parent e15ab939fd
commit cb71ae5572
4 changed files with 8 additions and 7 deletions

View 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)

View 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

View 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);
}

View 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);
}
}