pvr: Query kernel for free list max size
authorSarah Walker <sarah.walker@imgtec.com>
Wed, 23 Nov 2022 12:42:48 +0000 (12:42 +0000)
committerMarge Bot <emma+marge@anholt.net>
Tue, 29 Nov 2022 10:10:16 +0000 (10:10 +0000)
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>

src/imagination/common/pvr_device_info.h
src/imagination/include/pvr_rogue_fw.h
src/imagination/vulkan/pvr_job_render.c
src/imagination/vulkan/winsys/pvrsrvkm/pvr_srv.c

index 6b7d193..2a5803c 100644 (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;
index a737ac6..9e275ac 100644 (file)
 #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
index 8ba24c9..19f768e 100644 (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);
    }
 
index 61d478a..562dbce 100644 (file)
 /* 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 =