From 073bdbdea75d8f78f0e37334fde0e6b212c244aa Mon Sep 17 00:00:00 2001 From: Luigi Santivetti Date: Wed, 10 May 2023 08:29:46 +0100 Subject: [PATCH] pvr: switch pvr_descriptor_set_create to use pvr_bo_suballoc Signed-off-by: Luigi Santivetti Reviewed-by: Karmjit Mahil Part-of: --- src/imagination/vulkan/pvr_cmd_buffer.c | 6 +++--- src/imagination/vulkan/pvr_common.h | 2 +- src/imagination/vulkan/pvr_descriptor_set.c | 23 +++++++++++------------ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c index 917618c..bd696a3 100644 --- a/src/imagination/vulkan/pvr_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_cmd_buffer.c @@ -3356,7 +3356,7 @@ static VkResult pvr_setup_descriptor_mappings_old( descriptor_set = desc_state->descriptor_sets[desc_set_num]; - desc_set_addr = descriptor_set->pvr_bo->vma->dev_addr; + desc_set_addr = descriptor_set->pvr_bo->dev_addr; if (desc_set_entry->primary) { desc_portion_offset = @@ -3554,7 +3554,7 @@ static VkResult pvr_cmd_buffer_upload_patched_desc_set( if (result != VK_SUCCESS) return result; - src_mem_ptr = (uint32_t *)desc_set->pvr_bo->bo->map; + src_mem_ptr = (uint32_t *)pvr_bo_suballoc_get_map_addr(desc_set->pvr_bo); dst_mem_ptr = (uint32_t *)pvr_bo_suballoc_get_map_addr(patched_desc_set_bo); memcpy(dst_mem_ptr, src_mem_ptr, normal_desc_set_size); @@ -3726,7 +3726,7 @@ pvr_cmd_buffer_upload_desc_set_table(struct pvr_cmd_buffer *const cmd_buffer, bound_desc_sets[set] = new_desc_set_bo->dev_addr.addr; } else { - bound_desc_sets[set] = desc_set->pvr_bo->vma->dev_addr.addr; + bound_desc_sets[set] = desc_set->pvr_bo->dev_addr.addr; } } diff --git a/src/imagination/vulkan/pvr_common.h b/src/imagination/vulkan/pvr_common.h index 7f19ee5..a6d509d 100644 --- a/src/imagination/vulkan/pvr_common.h +++ b/src/imagination/vulkan/pvr_common.h @@ -379,7 +379,7 @@ struct pvr_descriptor_set { const struct pvr_descriptor_set_layout *layout; const struct pvr_descriptor_pool *pool; - struct pvr_bo *pvr_bo; + struct pvr_suballoc_bo *pvr_bo; /* Links this descriptor set into pvr_descriptor_pool::descriptor_sets list. */ diff --git a/src/imagination/vulkan/pvr_descriptor_set.c b/src/imagination/vulkan/pvr_descriptor_set.c index 0e0f08f..57b84c3 100644 --- a/src/imagination/vulkan/pvr_descriptor_set.c +++ b/src/imagination/vulkan/pvr_descriptor_set.c @@ -1089,7 +1089,7 @@ static void pvr_free_descriptor_set(struct pvr_device *device, struct pvr_descriptor_set *set) { list_del(&set->link); - pvr_bo_free(device, set->pvr_bo); + pvr_bo_suballoc_free(set->pvr_bo); vk_object_free(&device->vk, &pool->alloc, set); } @@ -1219,12 +1219,11 @@ pvr_descriptor_set_create(struct pvr_device *device, PVR_MAX_DESCRIPTOR_MEM_SIZE_IN_DWORDS) * sizeof(uint32_t); - result = pvr_bo_alloc(device, - device->heaps.general_heap, - bo_size, - cache_line_size, - PVR_BO_ALLOC_FLAG_CPU_MAPPED, - &set->pvr_bo); + result = pvr_bo_suballoc(&device->suballoc_general, + bo_size, + cache_line_size, + false, + &set->pvr_bo); if (result != VK_SUCCESS) goto err_free_descriptor_set; } @@ -1254,12 +1253,12 @@ pvr_descriptor_set_create(struct pvr_device *device, binding, stage, j); - void *map = set->pvr_bo->bo->map; if (binding->type == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER) offset_in_dwords += 4; - memcpy((uint8_t *)map + PVR_DW_TO_BYTES(offset_in_dwords), + memcpy((uint8_t *)pvr_bo_suballoc_get_map_addr(set->pvr_bo) + + PVR_DW_TO_BYTES(offset_in_dwords), sampler->descriptor.words, sizeof(sampler->descriptor.words)); } @@ -1824,7 +1823,7 @@ static void pvr_write_descriptor_set(struct pvr_device *device, const VkWriteDescriptorSet *write_set) { PVR_FROM_HANDLE(pvr_descriptor_set, set, write_set->dstSet); - uint32_t *map = set->pvr_bo->bo->map; + uint32_t *map = pvr_bo_suballoc_get_map_addr(set->pvr_bo); const struct pvr_descriptor_set_layout_binding *binding = pvr_get_descriptor_binding(set->layout, write_set->dstBinding); @@ -1969,8 +1968,8 @@ static void pvr_copy_descriptor_set(struct pvr_device *device, return; } - src_mem_ptr = src_set->pvr_bo->bo->map; - dst_mem_ptr = dst_set->pvr_bo->bo->map; + src_mem_ptr = pvr_bo_suballoc_get_map_addr(src_set->pvr_bo); + dst_mem_ptr = pvr_bo_suballoc_get_map_addr(dst_set->pvr_bo); /* From the Vulkan 1.3.232 spec VUID-VkCopyDescriptorSet-dstBinding-02632: * -- 2.7.4