From 8d3e8c3ad920b7f9b248551cc87df264dad845ec Mon Sep 17 00:00:00 2001 From: Sarah Walker Date: Tue, 18 Oct 2022 14:20:52 +0100 Subject: [PATCH] pvr: Rename heap reserved area to static data carveout Signed-off-by: Sarah Walker Reviewed-by: Karmjit Mahil Part-of: --- src/imagination/vulkan/winsys/pvr_winsys.h | 4 +-- src/imagination/vulkan/winsys/pvr_winsys_helper.c | 14 ++++---- src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c | 37 +++++++++++----------- src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h | 2 +- .../vulkan/winsys/pvrsrvkm/pvr_srv_bo.c | 8 ++--- 5 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/imagination/vulkan/winsys/pvr_winsys.h b/src/imagination/vulkan/winsys/pvr_winsys.h index 64ffa7b..46d23a8 100644 --- a/src/imagination/vulkan/winsys/pvr_winsys.h +++ b/src/imagination/vulkan/winsys/pvr_winsys.h @@ -66,10 +66,10 @@ struct pvr_winsys_heap { struct pvr_winsys *ws; pvr_dev_addr_t base_addr; - pvr_dev_addr_t reserved_addr; + pvr_dev_addr_t static_data_carveout_addr; uint64_t size; - uint64_t reserved_size; + uint64_t static_data_carveout_size; uint32_t page_size; uint32_t log2_page_size; diff --git a/src/imagination/vulkan/winsys/pvr_winsys_helper.c b/src/imagination/vulkan/winsys/pvr_winsys_helper.c index 74c2cc8..6af32b1 100644 --- a/src/imagination/vulkan/winsys/pvr_winsys_helper.c +++ b/src/imagination/vulkan/winsys/pvr_winsys_helper.c @@ -132,7 +132,7 @@ void pvr_winsys_helper_heap_free(struct pvr_winsys_vma *const vma) p_atomic_dec(&heap->ref_count); } -/* Note: the function assumes the heap allocation in the reserved memory area +/* Note: the function assumes the heap allocation in the carveout memory area * can be freed with the regular heap allocation free function. The free * function gets called on mapping failure. */ @@ -219,8 +219,8 @@ VkResult pvr_winsys_helper_allocate_static_memory( result = pvr_buffer_create_and_map(ws, heap_alloc_reserved, general_heap, - general_heap->reserved_addr, - general_heap->reserved_size, + general_heap->static_data_carveout_addr, + general_heap->static_data_carveout_size, general_heap->page_size, &general_vma); if (result != VK_SUCCESS) @@ -229,8 +229,8 @@ VkResult pvr_winsys_helper_allocate_static_memory( result = pvr_buffer_create_and_map(ws, heap_alloc_reserved, pds_heap, - pds_heap->reserved_addr, - pds_heap->reserved_size, + pds_heap->static_data_carveout_addr, + pds_heap->static_data_carveout_size, pds_heap->page_size, &pds_vma); if (result != VK_SUCCESS) @@ -239,8 +239,8 @@ VkResult pvr_winsys_helper_allocate_static_memory( result = pvr_buffer_create_and_map(ws, heap_alloc_reserved, usc_heap, - usc_heap->reserved_addr, - pds_heap->reserved_size, + usc_heap->static_data_carveout_addr, + pds_heap->static_data_carveout_size, usc_heap->page_size, &usc_vma); if (result != VK_SUCCESS) diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c index 3cf4ee3..e14e4eb 100644 --- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c +++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c @@ -52,46 +52,46 @@ #include "vk_sync.h" #include "vk_sync_timeline.h" -/* reserved_size can be 0 when no reserved region is needed. reserved_address - * must be 0 if reserved_size is 0. +/* carveout_size can be 0 when no carveout is needed. carveout_address must + * be 0 if carveout_size is 0. */ static VkResult pvr_winsys_heap_init( struct pvr_winsys *const ws, pvr_dev_addr_t base_address, uint64_t size, - pvr_dev_addr_t reserved_address, - uint64_t reserved_size, + pvr_dev_addr_t carveout_address, + uint64_t carveout_size, uint32_t log2_page_size, const struct pvr_winsys_static_data_offsets *const static_data_offsets, struct pvr_winsys_heap *const heap) { - const bool reserved_area_bottom_of_heap = reserved_address.addr == + const bool carveout_area_bottom_of_heap = carveout_address.addr == base_address.addr; const pvr_dev_addr_t vma_heap_begin_addr = - reserved_area_bottom_of_heap - ? PVR_DEV_ADDR_OFFSET(base_address, reserved_size) + carveout_area_bottom_of_heap + ? PVR_DEV_ADDR_OFFSET(base_address, carveout_size) : base_address; - const uint64_t vma_heap_size = size - reserved_size; + const uint64_t vma_heap_size = size - carveout_size; assert(base_address.addr); - assert(reserved_size <= size); + assert(carveout_size <= size); - /* As per the reserved_base powervr-km uapi documentation the reserved - * region can only be at the beginning of the heap or at the end. - * reserved_address is 0 if there is no reserved region. + /* As per the static_data_carveout_base powervr-km uapi documentation the + * carveout region can only be at the beginning of the heap or at the end. + * carveout_address is 0 if there is no carveout region. * pvrsrv-km doesn't explicitly provide this info and it's assumed that it's * always at the beginning. */ - assert(reserved_area_bottom_of_heap || - reserved_address.addr + reserved_size == base_address.addr + size || - (!reserved_address.addr && !reserved_size)); + assert(carveout_area_bottom_of_heap || + carveout_address.addr + carveout_size == base_address.addr + size || + (!carveout_address.addr && !carveout_size)); heap->ws = ws; heap->base_addr = base_address; - heap->reserved_addr = reserved_address; + heap->static_data_carveout_addr = carveout_address; heap->size = size; - heap->reserved_size = reserved_size; + heap->static_data_carveout_size = carveout_size; heap->page_size = 1 << log2_page_size; heap->log2_page_size = log2_page_size; @@ -168,7 +168,8 @@ static VkResult pvr_srv_heap_init( assert(srv_heap->base.page_size == srv_ws->base.page_size); assert(srv_heap->base.log2_page_size == srv_ws->base.log2_page_size); - assert(srv_heap->base.reserved_size % PVR_SRV_RESERVED_SIZE_GRANULARITY == + assert(srv_heap->base.static_data_carveout_size % + PVR_SRV_CARVEOUT_SIZE_GRANULARITY == 0); /* Create server-side counterpart of Device Memory heap */ diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h index ed7516f..88bb3b4 100644 --- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h +++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.h @@ -39,7 +39,7 @@ *******************************************/ /* 64KB is MAX anticipated OS page size */ -#define PVR_SRV_RESERVED_SIZE_GRANULARITY 0x10000 +#define PVR_SRV_CARVEOUT_SIZE_GRANULARITY 0x10000 #define PVR_SRV_DEVMEM_HEAPNAME_MAXLENGTH 160 diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_bo.c b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_bo.c index 8eea994..5f46885 100644 --- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_bo.c +++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv_bo.c @@ -389,7 +389,7 @@ VkResult pvr_srv_heap_alloc_reserved(struct pvr_winsys_heap *heap, */ if (reserved_dev_addr.addr < heap->base_addr.addr || reserved_dev_addr.addr + size > - heap->base_addr.addr + heap->reserved_size || + heap->base_addr.addr + heap->static_data_carveout_size || reserved_dev_addr.addr & ((ws->page_size) - 1)) { result = vk_error(NULL, VK_ERROR_INITIALIZATION_FAILED); goto err_vk_free_srv_vma; @@ -479,10 +479,10 @@ void pvr_srv_winsys_heap_free(struct pvr_winsys_vma *vma) /* Remove mapping handle and underlying reservation. */ pvr_srv_int_unreserve_addr(srv_ws->base.render_fd, srv_vma->reservation); - /* Check if we are dealing with reserved address range. */ + /* Check if we are dealing with carveout address range. */ if (vma->dev_addr.addr < - (vma->heap->base_addr.addr + vma->heap->reserved_size)) { - /* For the reserved addresses just decrement the reference count. */ + (vma->heap->base_addr.addr + vma->heap->static_data_carveout_size)) { + /* For the carveout addresses just decrement the reference count. */ p_atomic_dec(&vma->heap->ref_count); } else { /* Free allocated virtual space. */ -- 2.7.4