#define PVR_GLOBAL_FREE_LIST_MAX_SIZE (256U * 1024U * 1024U)
#define PVR_GLOBAL_FREE_LIST_GROW_SIZE (1U * 1024U * 1024U)
+/* After PVR_SECONDARY_DEVICE_THRESHOLD devices per instance are created,
+ * devices will have a smaller global free list size, as usually this use-case
+ * implies smaller amounts of work spread out. The free list can still grow as
+ * required.
+ */
+#define PVR_SECONDARY_DEVICE_THRESHOLD (4U)
+#define PVR_SECONDARY_DEVICE_FREE_LIST_INITAL_SIZE (512U * 1024U)
+
/* The grow threshold is a percentage. This is intended to be 12.5%, but has
* been rounded up since the percentage is treated as an integer.
*/
pvr_process_debug_variable();
instance->physical_devices_count = -1;
+ instance->active_device_count = 0;
VG(VALGRIND_CREATE_MEMPOOL(instance, 0, false));
VkDevice *pDevice)
{
PVR_FROM_HANDLE(pvr_physical_device, pdevice, physicalDevice);
+ uint32_t initial_free_list_size = PVR_GLOBAL_FREE_LIST_INITIAL_SIZE;
struct pvr_instance *instance = pdevice->instance;
struct vk_device_dispatch_table dispatch_table;
struct pvr_device *device;
if (result != VK_SUCCESS)
goto err_pvr_winsys_destroy;
+ if (p_atomic_inc_return(&instance->active_device_count) >
+ PVR_SECONDARY_DEVICE_THRESHOLD) {
+ initial_free_list_size = PVR_SECONDARY_DEVICE_FREE_LIST_INITAL_SIZE;
+ }
+
result = pvr_free_list_create(device,
- PVR_GLOBAL_FREE_LIST_INITIAL_SIZE,
+ initial_free_list_size,
PVR_GLOBAL_FREE_LIST_MAX_SIZE,
PVR_GLOBAL_FREE_LIST_GROW_SIZE,
PVR_GLOBAL_FREE_LIST_GROW_THRESHOLD,
NULL /* parent_free_list */,
&device->global_free_list);
if (result != VK_SUCCESS)
- goto err_pvr_bo_store_destroy;
+ goto err_dec_device_count;
result = pvr_device_init_nop_program(device);
if (result != VK_SUCCESS)
err_pvr_free_list_destroy:
pvr_free_list_destroy(device->global_free_list);
-err_pvr_bo_store_destroy:
+err_dec_device_count:
+ p_atomic_dec(&device->instance->active_device_count);
+
pvr_bo_store_destroy(device);
err_pvr_winsys_destroy:
if (device->master_fd >= 0)
close(device->master_fd);
+ p_atomic_dec(&device->instance->active_device_count);
+
close(device->render_fd);
vk_device_finish(&device->vk);
vk_free(&device->vk.alloc, device);