anv: ensure shader printf is functional on all backends
Also ensure the printfs are read even if the device is lost or ran into a fault. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Ivan Briano <ivan.briano@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38358>
This commit is contained in:
committed by
Marge Bot
parent
ef5a0def76
commit
b9266a122b
@@ -153,11 +153,26 @@ anv_QueueWaitIdle(VkQueue _queue)
|
||||
if (queue->vk.submit.mode != VK_QUEUE_SUBMIT_MODE_THREADED) {
|
||||
int ret = anv_xe_wait_exec_queue_idle(device, queue->exec_queue_id);
|
||||
|
||||
if (ret == 0)
|
||||
return VK_SUCCESS;
|
||||
if (ret == -ECANCELED)
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
return vk_errorf(device, VK_ERROR_UNKNOWN, "anv_xe_wait_exec_queue_idle failed: %m");
|
||||
VkResult result;
|
||||
switch (ret) {
|
||||
case 0:
|
||||
result = VK_SUCCESS;
|
||||
break;
|
||||
case -ECANCELED:
|
||||
result = VK_ERROR_DEVICE_LOST;
|
||||
break;
|
||||
default:
|
||||
result = vk_errorf(device, VK_ERROR_UNKNOWN, "anv_xe_wait_exec_queue_idle failed: %m");
|
||||
break;
|
||||
}
|
||||
|
||||
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
|
||||
VkResult print_result =
|
||||
vk_check_printf_status(&device->vk, &device->printf);
|
||||
result = result != VK_SUCCESS ? result : print_result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case INTEL_KMD_TYPE_I915:
|
||||
@@ -165,6 +180,4 @@ anv_QueueWaitIdle(VkQueue _queue)
|
||||
default:
|
||||
UNREACHABLE("Missing");
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -365,25 +365,28 @@ anv_i915_device_check_status(struct vk_device *vk_device)
|
||||
result = anv_gem_context_get_reset_stats(device,
|
||||
device->queues[i].context_id);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
goto done;
|
||||
|
||||
if (device->queues[i].companion_rcs_id != 0) {
|
||||
uint32_t context_id = device->queues[i].companion_rcs_id;
|
||||
result = anv_gem_context_get_reset_stats(device, context_id);
|
||||
if (result != VK_SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if (result != VK_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = anv_gem_context_get_reset_stats(device, device->context_id);
|
||||
}
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
if (INTEL_DEBUG(DEBUG_SHADER_PRINT))
|
||||
result = vk_check_printf_status(vk_device, &device->printf);
|
||||
done:
|
||||
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
|
||||
VkResult print_result =
|
||||
vk_check_printf_status(vk_device, &device->printf);
|
||||
/* Report the device error if there is one, only report the printf error
|
||||
* if no device error.
|
||||
*/
|
||||
result = result != VK_SUCCESS ? result : print_result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -198,21 +198,25 @@ anv_xe_device_check_status(struct vk_device *vk_device)
|
||||
for (uint32_t i = 0; i < device->queue_count; i++) {
|
||||
result = anv_xe_get_device_status(device, device->queues[i].exec_queue_id);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
goto done;
|
||||
|
||||
if (device->queues[i].companion_rcs_id != 0) {
|
||||
uint32_t exec_queue_id = device->queues[i].companion_rcs_id;
|
||||
result = anv_xe_get_device_status(device, exec_queue_id);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
if (INTEL_DEBUG(DEBUG_SHADER_PRINT))
|
||||
result = vk_check_printf_status(vk_device, &device->printf);
|
||||
done:
|
||||
if (INTEL_DEBUG(DEBUG_SHADER_PRINT)) {
|
||||
VkResult print_result =
|
||||
vk_check_printf_status(vk_device, &device->printf);
|
||||
/* Report the device error if there is one, only report the printf error
|
||||
* if no device error.
|
||||
*/
|
||||
result = result != VK_SUCCESS ? result : print_result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user