pvr: Query kernel for free list max size

Signed-off-by: Sarah Walker <sarah.walker@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19976>
This commit is contained in:
Sarah Walker 2022-11-23 12:42:48 +00:00 committed by Marge Bot
parent 5e5c42ebb5
commit 2673d0f8b2
4 changed files with 25 additions and 21 deletions

View file

@ -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;

View file

@ -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

View file

@ -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);
}

View file

@ -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 =