pvr: Enable threaded submit when supported

Adds a winsys feature flag to enable threaded submit.

Currently pvrsrvkm can't support threaded submit as pvrsrvkm syncs don't
support VK_SYNC_FEATURE_WAIT_PENDING.

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>

Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21577>
This commit is contained in:
Jarred Davies 2023-01-31 07:18:59 +00:00 committed by Marge Bot
parent 5be2e44095
commit 18fb8d3b55
4 changed files with 22 additions and 0 deletions

View file

@ -1767,6 +1767,13 @@ VkResult pvr_CreateDevice(VkPhysicalDevice physicalDevice,
goto err_close_master_fd;
}
if (device->ws->features.supports_threaded_submit) {
/* Queue submission can be blocked if the kernel CCBs become full,
* so enable threaded submit to not block the submitter.
*/
vk_device_enable_threaded_submit(&device->vk);
}
device->ws->ops->get_heaps_info(device->ws, &device->heaps);
result = pvr_bo_store_create(device);

View file

@ -75,6 +75,12 @@ static VkResult pvr_queue_init(struct pvr_device *device,
if (result != VK_SUCCESS)
return result;
if (device->ws->features.supports_threaded_submit) {
result = vk_queue_enable_submit_thread(&queue->vk);
if (result != VK_SUCCESS)
goto err_vk_queue_finish;
}
result = pvr_transfer_ctx_create(device,
PVR_WINSYS_CTX_PRIORITY_MEDIUM,
&transfer_ctx);

View file

@ -485,6 +485,10 @@ struct pvr_winsys {
struct vk_sync_type syncobj_type;
struct vk_sync_timeline_type timeline_syncobj_type;
struct {
bool supports_threaded_submit : 1;
} features;
const struct pvr_winsys_ops *ops;
};

View file

@ -684,6 +684,11 @@ struct pvr_winsys *pvr_srv_winsys_create(int master_fd,
srv_ws->base.sync_types[1] = &srv_ws->base.timeline_syncobj_type.sync;
srv_ws->base.sync_types[2] = NULL;
/* Threaded submit requires VK_SYNC_FEATURE_WAIT_PENDING which pvrsrv
* doesn't support.
*/
srv_ws->base.features.supports_threaded_submit = false;
result = pvr_srv_memctx_init(srv_ws);
if (result != VK_SUCCESS)
goto err_vk_free_srv_ws;