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 | |
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')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_allocate.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_job.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/panfrost/pan_job.h | 3 |
3 files changed, 16 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 { diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index ea3747bbad5..a802030769f 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -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; } diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index 5e62c818f71..9dce1e69415 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -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 */ |