mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-04 02:18:16 +02:00
v3dv: disable threadeded submissions under drm-shim
Threaded submit relies on DRM syncobj wait ioctls blocking until the GPU signals completion. Under drm-shim there is no real GPU, so SYNCOBJ_WAIT returns immediately, creating a race between the submit thread and vkQueueWaitIdle that leads to use-after-free crashes. Detect if we are running under drm-shim by checking the DRM version description, skip enabling threaded submit in that case. Assisted-by: Cursor Agent (Opus 4.6) Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41779>
This commit is contained in:
parent
788979594e
commit
5a9e40f028
2 changed files with 22 additions and 4 deletions
|
|
@ -1381,6 +1381,12 @@ create_physical_device(struct v3dv_instance *instance,
|
|||
device->render_fd = render_fd;
|
||||
device->display_fd = display_fd;
|
||||
|
||||
drmVersionPtr version = drmGetVersion(render_fd);
|
||||
if (version) {
|
||||
device->is_shim = version->desc && strcmp(version->desc, "shim") == 0;
|
||||
drmFreeVersion(version);
|
||||
}
|
||||
|
||||
if (!v3d_get_device_info(device->render_fd, &device->devinfo, &v3d_ioctl)) {
|
||||
result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"Failed to get info from device.");
|
||||
|
|
@ -1831,9 +1837,14 @@ queue_init(struct v3dv_device *device, struct v3dv_queue *queue,
|
|||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
result = vk_queue_enable_submit_thread(&queue->vk);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_submit_thread;
|
||||
/* Threaded submit requires an implementation of syncobj which is not
|
||||
* available on the shim driver.
|
||||
*/
|
||||
if (!device->pdevice->is_shim) {
|
||||
result = vk_queue_enable_submit_thread(&queue->vk);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail_submit_thread;
|
||||
}
|
||||
|
||||
queue->device = device;
|
||||
queue->vk.driver_submit = v3dv_queue_driver_submit;
|
||||
|
|
@ -1962,7 +1973,12 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
|
|||
device->vk.copy_sync_payloads = vk_drm_syncobj_copy_payloads;
|
||||
|
||||
vk_device_set_drm_fd(&device->vk, physical_device->render_fd);
|
||||
vk_device_enable_threaded_submit(&device->vk);
|
||||
|
||||
/* Threaded submit requires an implementation of syncobj which is not
|
||||
* available on the shim driver.
|
||||
*/
|
||||
if (!physical_device->is_shim)
|
||||
vk_device_enable_threaded_submit(&device->vk);
|
||||
|
||||
device->queues = vk_zalloc2(&device->vk.alloc, pAllocator,
|
||||
sizeof(*device->queues) * total_queues, 8,
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ struct v3dv_physical_device {
|
|||
bool multisync;
|
||||
bool perfmon;
|
||||
} caps;
|
||||
|
||||
bool is_shim;
|
||||
};
|
||||
|
||||
static inline struct v3dv_bo *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue