summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_pipe.c
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-05-16 10:11:54 +0200
committerSamuel Pitoiset <[email protected]>2017-06-14 10:04:36 +0200
commit77bbdcdfcd8ad354a6e556b7440ea160fa62db85 (patch)
tree195ef79ba13ccd98c189e96462557edeb6d3d8c3 /src/gallium/drivers/radeonsi/si_pipe.c
parent86d7b7f01a06c6b84876ffcea907576725551a8a (diff)
radeonsi: add a slab allocator for bindless descriptors
For each texture/image handles, we need to allocate a new buffer for the bindless descriptor. But when the number of buffers added to the current CS becomes high, the overhead in the winsys (and in the kernel) is important. To reduce this bottleneck, the idea is to suballocate the bindless descriptors using a slab similar to the one used in the winsys. Currently, a buffer can hold 1024 bindless descriptors but this limit is arbitrary and could be changed in the future for some reasons. Once a slab is allocated the "base" buffer is added to a per-context list. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_pipe.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_pipe.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 031e4731bf0..14fe9dd6a36 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -94,6 +94,9 @@ static void si_destroy_context(struct pipe_context *context)
r600_resource_reference(&sctx->last_trace_buf, NULL);
radeon_clear_saved_cs(&sctx->last_gfx);
+ pb_slabs_deinit(&sctx->bindless_descriptor_slabs);
+ util_dynarray_fini(&sctx->bindless_descriptors);
+
FREE(sctx);
}
@@ -316,6 +319,15 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen,
sctx->tm = si_create_llvm_target_machine(sscreen);
+ /* Create a slab allocator for all bindless descriptors. */
+ if (!pb_slabs_init(&sctx->bindless_descriptor_slabs, 6, 6, 1, sctx,
+ si_bindless_descriptor_can_reclaim_slab,
+ si_bindless_descriptor_slab_alloc,
+ si_bindless_descriptor_slab_free))
+ goto fail;
+
+ util_dynarray_init(&sctx->bindless_descriptors, NULL);
+
return &sctx->b.b;
fail:
fprintf(stderr, "radeonsi: Failed to create a context.\n");