diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-12 12:53:36 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-07-12 15:31:48 -0700 |
commit | 0f5ad9efccc28fc78883ef10a1aad83d1013a4c3 (patch) | |
tree | cef3a9f5efde901e58f5a421a4e26baab904825d /src/gallium/drivers/panfrost/pan_allocate.c | |
parent | 00c9a1cb75ea0b8c9aceaf1dc44a09c577c6b26b (diff) |
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 <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_allocate.c')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_allocate.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/panfrost/pan_allocate.c b/src/gallium/drivers/panfrost/pan_allocate.c index 15c5f8aa671..4febb001033 100644 --- a/src/gallium/drivers/panfrost/pan_allocate.c +++ b/src/gallium/drivers/panfrost/pan_allocate.c @@ -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 { |