mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 10:20:09 +01:00
panfrost: Bookkeep transient indices
The batch now temporarily possesses the transient buffer, so it'll need to remember that to free it later. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
parent
00c9a1cb75
commit
0f5ad9efcc
3 changed files with 16 additions and 2 deletions
|
|
@ -59,7 +59,7 @@ panfrost_allocate_chunk(struct panfrost_context *ctx, size_t size, unsigned heap
|
|||
/* Allocate a new transient slab */
|
||||
|
||||
static struct panfrost_bo *
|
||||
panfrost_create_slab(struct panfrost_screen *screen)
|
||||
panfrost_create_slab(struct panfrost_screen *screen, unsigned *index)
|
||||
{
|
||||
/* Allocate a new slab on the screen */
|
||||
|
||||
|
|
@ -70,6 +70,10 @@ panfrost_create_slab(struct panfrost_screen *screen)
|
|||
struct panfrost_bo *alloc = panfrost_drm_create_bo(screen, TRANSIENT_SLAB_SIZE, 0);
|
||||
|
||||
*new = alloc;
|
||||
|
||||
/* Return the BO as well as the index we just added */
|
||||
|
||||
*index = util_dynarray_num_elements(&screen->transient_bo, void *) - 1;
|
||||
return alloc;
|
||||
}
|
||||
|
||||
|
|
@ -81,6 +85,7 @@ struct panfrost_transfer
|
|||
panfrost_allocate_transient(struct panfrost_context *ctx, size_t sz)
|
||||
{
|
||||
struct panfrost_screen *screen = pan_screen(ctx->base.screen);
|
||||
struct panfrost_job *batch = panfrost_get_job_for_fbo(ctx);
|
||||
|
||||
/* Pad the size */
|
||||
sz = ALIGN_POT(sz, ALIGNMENT);
|
||||
|
|
@ -94,8 +99,13 @@ panfrost_allocate_transient(struct panfrost_context *ctx, size_t sz)
|
|||
if (sz < TRANSIENT_SLAB_SIZE) {
|
||||
/* TODO: Lookup free */
|
||||
|
||||
unsigned index = 0;
|
||||
|
||||
if (!bo)
|
||||
bo = panfrost_create_slab(screen);
|
||||
bo = panfrost_create_slab(screen, &index);
|
||||
|
||||
/* Remember we created this */
|
||||
util_dynarray_append(&batch->transient_indices, unsigned, index);
|
||||
|
||||
update_offset = true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ panfrost_create_job(struct panfrost_context *ctx)
|
|||
|
||||
util_dynarray_init(&job->headers, job);
|
||||
util_dynarray_init(&job->gpu_headers, job);
|
||||
util_dynarray_init(&job->transient_indices, job);
|
||||
|
||||
return job;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ struct panfrost_job {
|
|||
|
||||
/* BOs referenced -- will be used for flushing logic */
|
||||
struct set *bos;
|
||||
|
||||
/* Indices of transient BOs referenced */
|
||||
struct util_dynarray transient_indices;
|
||||
};
|
||||
|
||||
/* Functions for managing the above */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue