mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
radv: Use vulkan runtime for device lost.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974>
This commit is contained in:
parent
085f99b729
commit
1a84dd6358
3 changed files with 14 additions and 44 deletions
|
|
@ -2959,22 +2959,6 @@ radv_device_finish_vrs_image(struct radv_device *device)
|
|||
&device->meta_state.alloc);
|
||||
}
|
||||
|
||||
VkResult
|
||||
_radv_device_set_lost(struct radv_device *device, const char *file, int line, const char *msg, ...)
|
||||
{
|
||||
VkResult err;
|
||||
va_list ap;
|
||||
|
||||
p_atomic_inc(&device->lost);
|
||||
|
||||
va_start(ap, msg);
|
||||
err =
|
||||
__vk_errorv(device, VK_ERROR_DEVICE_LOST, file, line, msg, ap);
|
||||
va_end(ap);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice)
|
||||
|
|
@ -4858,7 +4842,7 @@ fail:
|
|||
* VK_ERROR_DEVICE_LOST to ensure the clients do not attempt
|
||||
* to submit the same job again to this device.
|
||||
*/
|
||||
result = radv_device_set_lost(queue->device, "vkQueueSubmit() failed");
|
||||
result = vk_device_set_lost(&queue->device->vk, "vkQueueSubmit() failed");
|
||||
}
|
||||
|
||||
radv_free_temp_syncobjs(queue->device, submission->temporary_semaphore_part_count,
|
||||
|
|
@ -5077,7 +5061,7 @@ radv_QueueSubmit2KHR(VkQueue _queue, uint32_t submitCount, const VkSubmitInfo2KH
|
|||
uint32_t fence_idx = 0;
|
||||
bool flushed_caches = false;
|
||||
|
||||
if (radv_device_is_lost(queue->device))
|
||||
if (vk_device_is_lost(&queue->device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
if (fence != VK_NULL_HANDLE) {
|
||||
|
|
@ -5150,7 +5134,7 @@ radv_QueueWaitIdle(VkQueue _queue)
|
|||
{
|
||||
RADV_FROM_HANDLE(radv_queue, queue, _queue);
|
||||
|
||||
if (radv_device_is_lost(queue->device))
|
||||
if (vk_device_is_lost(&queue->device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
mtx_lock(&queue->pending_mutex);
|
||||
|
|
@ -5162,10 +5146,10 @@ radv_QueueWaitIdle(VkQueue _queue)
|
|||
if (!queue->device->ws->ctx_wait_idle(
|
||||
queue->hw_ctx, radv_queue_family_to_ring(queue->vk.queue_family_index),
|
||||
queue->vk.index_in_family)) {
|
||||
return radv_device_set_lost(queue->device,
|
||||
"Failed to wait for a '%s' queue "
|
||||
"to be idle. GPU hang ?",
|
||||
radv_get_queue_family_name(queue));
|
||||
return vk_device_set_lost(&queue->device->vk,
|
||||
"Failed to wait for a '%s' queue "
|
||||
"to be idle. GPU hang ?",
|
||||
radv_get_queue_family_name(queue));
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
|
@ -5762,7 +5746,7 @@ radv_QueueBindSparse(VkQueue _queue, uint32_t bindInfoCount, const VkBindSparseI
|
|||
RADV_FROM_HANDLE(radv_queue, queue, _queue);
|
||||
uint32_t fence_idx = 0;
|
||||
|
||||
if (radv_device_is_lost(queue->device))
|
||||
if (vk_device_is_lost(&queue->device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
if (fence != VK_NULL_HANDLE) {
|
||||
|
|
@ -5911,7 +5895,7 @@ radv_WaitForFences(VkDevice _device, uint32_t fenceCount, const VkFence *pFences
|
|||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
uint32_t *handles;
|
||||
|
||||
if (radv_device_is_lost(device))
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
timeout = radv_get_absolute_timeout(timeout);
|
||||
|
|
@ -5969,7 +5953,7 @@ radv_GetFenceStatus(VkDevice _device, VkFence _fence)
|
|||
struct radv_fence_part *part =
|
||||
fence->temporary.kind != RADV_FENCE_NONE ? &fence->temporary : &fence->permanent;
|
||||
|
||||
if (radv_device_is_lost(device))
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
bool success = device->ws->wait_syncobj(device->ws, &part->syncobj, 1, true, 0);
|
||||
|
|
@ -6239,7 +6223,7 @@ radv_GetSemaphoreCounterValue(VkDevice _device, VkSemaphore _semaphore, uint64_t
|
|||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
RADV_FROM_HANDLE(radv_semaphore, semaphore, _semaphore);
|
||||
|
||||
if (radv_device_is_lost(device))
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
struct radv_semaphore_part *part = semaphore->temporary.kind != RADV_SEMAPHORE_NONE
|
||||
|
|
@ -6298,7 +6282,7 @@ radv_WaitSemaphores(VkDevice _device, const VkSemaphoreWaitInfo *pWaitInfo, uint
|
|||
{
|
||||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
|
||||
if (radv_device_is_lost(device))
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
uint64_t abs_timeout = radv_get_absolute_timeout(timeout);
|
||||
|
|
@ -6449,7 +6433,7 @@ radv_GetEventStatus(VkDevice _device, VkEvent _event)
|
|||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
RADV_FROM_HANDLE(radv_event, event, _event);
|
||||
|
||||
if (radv_device_is_lost(device))
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
if (*event->map == 1)
|
||||
|
|
|
|||
|
|
@ -860,9 +860,6 @@ struct radv_device {
|
|||
uint64_t allocated_memory_size[VK_MAX_MEMORY_HEAPS];
|
||||
mtx_t overallocation_mutex;
|
||||
|
||||
/* Track the number of device loss occurs. */
|
||||
int lost;
|
||||
|
||||
/* Whether the user forced VRS rates on GFX10.3+. */
|
||||
enum radv_force_vrs force_vrs;
|
||||
|
||||
|
|
@ -880,17 +877,6 @@ struct radv_device {
|
|||
struct radv_shader_prolog *instance_rate_vs_prologs[816];
|
||||
};
|
||||
|
||||
VkResult _radv_device_set_lost(struct radv_device *device, const char *file, int line,
|
||||
const char *msg, ...) radv_printflike(4, 5);
|
||||
|
||||
#define radv_device_set_lost(dev, ...) _radv_device_set_lost(dev, __FILE__, __LINE__, __VA_ARGS__)
|
||||
|
||||
static inline bool
|
||||
radv_device_is_lost(const struct radv_device *device)
|
||||
{
|
||||
return unlikely(p_atomic_read(&device->lost));
|
||||
}
|
||||
|
||||
struct radv_device_memory {
|
||||
struct vk_object_base base;
|
||||
struct radeon_winsys_bo *bo;
|
||||
|
|
|
|||
|
|
@ -976,7 +976,7 @@ radv_GetQueryPoolResults(VkDevice _device, VkQueryPool queryPool, uint32_t first
|
|||
char *data = pData;
|
||||
VkResult result = VK_SUCCESS;
|
||||
|
||||
if (radv_device_is_lost(device))
|
||||
if (vk_device_is_lost(&device->vk))
|
||||
return VK_ERROR_DEVICE_LOST;
|
||||
|
||||
for (unsigned query_idx = 0; query_idx < queryCount; ++query_idx, data += stride) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue