summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost/pan_job.c
diff options
context:
space:
mode:
authorBoris Brezillon <[email protected]>2019-09-15 09:21:13 +0200
committerBoris Brezillon <[email protected]>2019-10-03 16:55:38 -0400
commitada752afe404a3afc96e401fc979d8040f30204b (patch)
treef024ff119a3d2fd88b5c94b6be12470fd630d12e /src/gallium/drivers/panfrost/pan_job.c
parent12f790f7dac469909a30fa6d882a2790207df9a2 (diff)
panfrost: Extend the panfrost_batch_add_bo() API to pass access flags
The type of access being done on a BO has impacts on job scheduling (shared resources being written enforce serialization while those being read only allow for job parallelization) and BO lifetime (the fragment job might last longer than the vertex/tiler ones, if we can, it's good to release BOs earlier so that others can re-use them through the BO re-use cache). Let's pass extra access flags to panfrost_batch_add_bo() and panfrost_batch_create_bo() so the batch submission logic can take the appropriate when submitting batches. Note that this information is not used yet, we're just patching callers to pass the correct flags here. Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_job.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_job.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 69047ca62a6..8e2703ae168 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -132,7 +132,8 @@ panfrost_get_batch_for_fbo(struct panfrost_context *ctx)
}
void
-panfrost_batch_add_bo(struct panfrost_batch *batch, struct panfrost_bo *bo)
+panfrost_batch_add_bo(struct panfrost_batch *batch, struct panfrost_bo *bo,
+ uint32_t flags)
{
if (!bo)
return;
@@ -146,26 +147,30 @@ panfrost_batch_add_bo(struct panfrost_batch *batch, struct panfrost_bo *bo)
void panfrost_batch_add_fbo_bos(struct panfrost_batch *batch)
{
+ uint32_t flags = PAN_BO_ACCESS_SHARED | PAN_BO_ACCESS_WRITE |
+ PAN_BO_ACCESS_VERTEX_TILER |
+ PAN_BO_ACCESS_FRAGMENT;
+
for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) {
struct panfrost_resource *rsrc = pan_resource(batch->key.cbufs[i]->texture);
- panfrost_batch_add_bo(batch, rsrc->bo);
+ panfrost_batch_add_bo(batch, rsrc->bo, flags);
}
if (batch->key.zsbuf) {
struct panfrost_resource *rsrc = pan_resource(batch->key.zsbuf->texture);
- panfrost_batch_add_bo(batch, rsrc->bo);
+ panfrost_batch_add_bo(batch, rsrc->bo, flags);
}
}
struct panfrost_bo *
panfrost_batch_create_bo(struct panfrost_batch *batch, size_t size,
- uint32_t create_flags)
+ uint32_t create_flags, uint32_t access_flags)
{
struct panfrost_bo *bo;
bo = panfrost_bo_create(pan_screen(batch->ctx->base.screen), size,
create_flags);
- panfrost_batch_add_bo(batch, bo);
+ panfrost_batch_add_bo(batch, bo, access_flags);
/* panfrost_batch_add_bo() has retained a reference and
* panfrost_bo_create() initialize the refcnt to 1, so let's
@@ -189,7 +194,11 @@ panfrost_batch_get_polygon_list(struct panfrost_batch *batch, unsigned size)
/* Create the BO as invisible, as there's no reason to map */
batch->polygon_list = panfrost_batch_create_bo(batch, size,
- PAN_BO_INVISIBLE);
+ PAN_BO_INVISIBLE,
+ PAN_BO_ACCESS_PRIVATE |
+ PAN_BO_ACCESS_RW |
+ PAN_BO_ACCESS_VERTEX_TILER |
+ PAN_BO_ACCESS_FRAGMENT);
}
return batch->polygon_list->gpu;
@@ -202,7 +211,11 @@ panfrost_batch_get_scratchpad(struct panfrost_batch *batch)
return batch->scratchpad;
batch->scratchpad = panfrost_batch_create_bo(batch, 64 * 4 * 4096,
- PAN_BO_INVISIBLE);
+ PAN_BO_INVISIBLE,
+ PAN_BO_ACCESS_PRIVATE |
+ PAN_BO_ACCESS_RW |
+ PAN_BO_ACCESS_VERTEX_TILER |
+ PAN_BO_ACCESS_FRAGMENT);
assert(batch->scratchpad);
return batch->scratchpad;
}
@@ -215,7 +228,11 @@ panfrost_batch_get_tiler_heap(struct panfrost_batch *batch)
batch->tiler_heap = panfrost_batch_create_bo(batch, 4096 * 4096,
PAN_BO_INVISIBLE |
- PAN_BO_GROWABLE);
+ PAN_BO_GROWABLE,
+ PAN_BO_ACCESS_PRIVATE |
+ PAN_BO_ACCESS_RW |
+ PAN_BO_ACCESS_VERTEX_TILER |
+ PAN_BO_ACCESS_FRAGMENT);
assert(batch->tiler_heap);
return batch->tiler_heap;
}
@@ -227,7 +244,11 @@ panfrost_batch_get_tiler_dummy(struct panfrost_batch *batch)
return batch->tiler_dummy;
batch->tiler_dummy = panfrost_batch_create_bo(batch, 4096,
- PAN_BO_INVISIBLE);
+ PAN_BO_INVISIBLE,
+ PAN_BO_ACCESS_PRIVATE |
+ PAN_BO_ACCESS_RW |
+ PAN_BO_ACCESS_VERTEX_TILER |
+ PAN_BO_ACCESS_FRAGMENT);
assert(batch->tiler_dummy);
return batch->tiler_dummy;
}