diff options
author | Bas Nieuwenhuizen <[email protected]> | 2017-03-12 22:43:51 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2017-08-03 00:45:13 +0200 |
commit | c9d4b571ad5dc3e622603a0f50d293192850d749 (patch) | |
tree | cc0018db59aabf06930036208dcaa7b85a9f06c0 /src/amd/vulkan/radv_private.h | |
parent | fe3d2559d941f8f69dbdb369221af69a9974d017 (diff) |
radv: Add suballocation for shaders.
This reduces the number of BOs that we need for the BO lists during
a submission.
Currently uses a fairly simple linear search for finding free space,
that could eventually be improved to a binary tree, which with some
per-node info could make a check for space O(1) and finding it O(log n),
in the number of buffers in that slab.
Signed-off-by: Bas Nieuwenhuizen <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_private.h')
-rw-r--r-- | src/amd/vulkan/radv_private.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 25afd497da0..8e86f5c1d52 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -549,6 +549,9 @@ struct radv_device { struct radv_pipeline_cache * mem_cache; uint32_t image_mrt_offset_counter; + + struct list_head shader_slabs; + mtx_t shader_slab_mutex; }; struct radv_device_memory { @@ -981,17 +984,35 @@ mesa_to_vk_shader_stage(gl_shader_stage mesa_stage) stage = __builtin_ffs(__tmp) - 1, __tmp; \ __tmp &= ~(1 << (stage))) + +struct radv_shader_slab { + struct list_head slabs; + struct list_head shaders; + struct radeon_winsys_bo *bo; + uint64_t size; + char *ptr; +}; + struct radv_shader_variant { uint32_t ref_count; struct radeon_winsys_bo *bo; + uint64_t bo_offset; struct ac_shader_config config; struct ac_shader_variant_info info; unsigned rsrc1; unsigned rsrc2; uint32_t code_size; + + struct list_head slab_list; }; + +void *radv_alloc_shader_memory(struct radv_device *device, + struct radv_shader_variant *shader); + +void radv_destroy_shader_slabs(struct radv_device *device); + struct radv_depth_stencil_state { uint32_t db_depth_control; uint32_t db_stencil_control; |