From: Sarah Walker Date: Wed, 23 Nov 2022 12:42:48 +0000 (+0000) Subject: pvr: Query kernel for free list max size X-Git-Tag: upstream/23.3.3~16274 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2673d0f8b2a97bbe775f0de1c240c69164371bfd;p=platform%2Fupstream%2Fmesa.git pvr: Query kernel for free list max size Signed-off-by: Sarah Walker Reviewed-by: Frank Binns Part-of: --- diff --git a/src/imagination/common/pvr_device_info.h b/src/imagination/common/pvr_device_info.h index 6b7d193..2a5803c 100644 --- a/src/imagination/common/pvr_device_info.h +++ b/src/imagination/common/pvr_device_info.h @@ -359,6 +359,7 @@ struct pvr_device_info { struct pvr_device_runtime_info { uint64_t min_free_list_size; + uint64_t max_free_list_size; uint64_t reserved_shared_size; uint64_t total_reserved_partition_size; uint64_t num_phantoms; diff --git a/src/imagination/include/pvr_rogue_fw.h b/src/imagination/include/pvr_rogue_fw.h index a737ac6..9e275ac 100644 --- a/src/imagination/include/pvr_rogue_fw.h +++ b/src/imagination/include/pvr_rogue_fw.h @@ -28,25 +28,6 @@ #ifndef PVR_ROGUE_FW_H #define PVR_ROGUE_FW_H -/** - * Maximum PB free list size supported by RGX and Services. - * - * Maximum PB free list size must ensure that no PM address space can be fully - * used, because if the full address space was used it would wrap and corrupt - * itself. Since there are two freelists (local is always minimum sized) this - * can be described as following three conditions being met: - * - * Minimum PB + Maximum PB < ALIST PM address space size (16GB) - * Minimum PB + Maximum PB < TE PM address space size (16GB) / NUM_TE_PIPES - * Minimum PB + Maximum PB < VCE PM address space size (16GB) / NUM_VCE_PIPES - * - * Since the max of NUM_TE_PIPES and NUM_VCE_PIPES is 4, we have a hard limit - * of 4GB minus the Minimum PB. For convenience we take the smaller power-of-2 - * value of 2GB. This is far more than any normal application would request - * or use. - */ -#define ROGUE_FREE_LIST_MAX_SIZE (2ULL * 1024ULL * 1024ULL * 1024ULL) - /* FIXME: This will change based on the firmware configuration, which will vary * depending on the BVNC and firmware version. The powervr KM driver allows this * information to be queried, but the pvrsrvkm KM driver doesn't. This diff --git a/src/imagination/vulkan/pvr_job_render.c b/src/imagination/vulkan/pvr_job_render.c index 8ba24c9..19f768e 100644 --- a/src/imagination/vulkan/pvr_job_render.c +++ b/src/imagination/vulkan/pvr_job_render.c @@ -148,6 +148,8 @@ VkResult pvr_free_list_create(struct pvr_device *device, struct pvr_free_list *parent_free_list, struct pvr_free_list **const free_list_out) { + const struct pvr_device_runtime_info *runtime_info = + &device->pdevice->dev_runtime_info; struct pvr_winsys_free_list *parent_ws_free_list = parent_free_list ? parent_free_list->ws_free_list : NULL; const uint64_t bo_flags = PVR_BO_ALLOC_FLAG_GPU_UNCACHED | @@ -205,8 +207,8 @@ VkResult pvr_free_list_create(struct pvr_device *device, /* Make sure the 'max' size doesn't exceed what the firmware supports and * adjust the other sizes accordingly. */ - if (max_size > ROGUE_FREE_LIST_MAX_SIZE) { - max_size = ROGUE_FREE_LIST_MAX_SIZE; + if (max_size > runtime_info->max_free_list_size) { + max_size = runtime_info->max_free_list_size; assert(align64(max_size, size_alignment) == max_size); } diff --git a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c index 61d478a..562dbce 100644 --- a/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c +++ b/src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c @@ -50,6 +50,25 @@ /* Amount of space used to hold sync prim values (in bytes). */ #define PVR_SRV_SYNC_PRIM_VALUE_SIZE 4U +/** + * Maximum PB free list size supported by RGX and Services. + * + * Maximum PB free list size must ensure that no PM address space can be fully + * used, because if the full address space was used it would wrap and corrupt + * itself. Since there are two freelists (local is always minimum sized) this + * can be described as following three conditions being met: + * + * Minimum PB + Maximum PB < ALIST PM address space size (16GB) + * Minimum PB + Maximum PB < TE PM address space size (16GB) / NUM_TE_PIPES + * Minimum PB + Maximum PB < VCE PM address space size (16GB) / NUM_VCE_PIPES + * + * Since the max of NUM_TE_PIPES and NUM_VCE_PIPES is 4, we have a hard limit + * of 4GB minus the Minimum PB. For convenience we take the smaller power-of-2 + * value of 2GB. This is far more than any normal application would request + * or use. + */ +#define PVR_SRV_FREE_LIST_MAX_SIZE (2ULL * 1024ULL * 1024ULL * 1024ULL) + static VkResult pvr_srv_heap_init( struct pvr_srv_winsys *srv_ws, struct pvr_srv_winsys_heap *srv_heap, @@ -518,6 +537,7 @@ pvr_srv_winsys_device_info_init(struct pvr_winsys *ws, } runtime_info->min_free_list_size = pvr_srv_get_min_free_list_size(dev_info); + runtime_info->max_free_list_size = PVR_SRV_FREE_LIST_MAX_SIZE; runtime_info->reserved_shared_size = pvr_srv_get_reserved_shared_size(dev_info); runtime_info->total_reserved_partition_size =