diff options
author | Iago Toral Quiroga <[email protected]> | 2017-03-22 09:18:56 +0100 |
---|---|---|
committer | Iago Toral Quiroga <[email protected]> | 2017-03-24 08:11:53 +0100 |
commit | 4da1832c00ab93cbf90b14501840dd698565a869 (patch) | |
tree | 54631da3c1190d91c062f0fa265ef7b182e67ae9 /src | |
parent | 50c8d2c1f71944688ebf753af3866981a07c4e9c (diff) |
anv: return VK_ERROR_DEVICE_LOST immeditely when device is known to be lost
If we know the device has been lost we should return this error code for
any command that can report it before we attempt to do anything with the
device.
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 22 | ||||
-rw-r--r-- | src/intel/vulkan/genX_query.c | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 193db01b920..4e4fa195a7c 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1273,6 +1273,9 @@ VkResult anv_QueueSubmit( ANV_FROM_HANDLE(anv_queue, queue, _queue); ANV_FROM_HANDLE(anv_fence, fence, _fence); struct anv_device *device = queue->device; + if (unlikely(device->lost)) + return VK_ERROR_DEVICE_LOST; + VkResult result = VK_SUCCESS; /* We lock around QueueSubmit for three main reasons: @@ -1371,6 +1374,9 @@ VkResult anv_DeviceWaitIdle( VkDevice _device) { ANV_FROM_HANDLE(anv_device, device, _device); + if (unlikely(device->lost)) + return VK_ERROR_DEVICE_LOST; + struct anv_batch batch; uint32_t cmds[8]; @@ -1676,11 +1682,15 @@ VkResult anv_BindBufferMemory( } VkResult anv_QueueBindSparse( - VkQueue queue, + VkQueue _queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence) { + ANV_FROM_HANDLE(anv_queue, queue, _queue); + if (unlikely(queue->device->lost)) + return VK_ERROR_DEVICE_LOST; + return vk_error(VK_ERROR_FEATURE_NOT_PRESENT); } @@ -1788,6 +1798,10 @@ VkResult anv_GetFenceStatus( { ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_fence, fence, _fence); + + if (unlikely(device->lost)) + return VK_ERROR_DEVICE_LOST; + int64_t t = 0; int ret; @@ -1827,6 +1841,9 @@ VkResult anv_WaitForFences( ANV_FROM_HANDLE(anv_device, device, _device); int ret; + if (unlikely(device->lost)) + return VK_ERROR_DEVICE_LOST; + /* DRM_IOCTL_I915_GEM_WAIT uses a signed 64 bit timeout and is supposed * to block indefinitely timeouts <= 0. Unfortunately, this was broken * for a couple of kernel releases. Since there's no way to know @@ -2018,6 +2035,9 @@ VkResult anv_GetEventStatus( ANV_FROM_HANDLE(anv_device, device, _device); ANV_FROM_HANDLE(anv_event, event, _event); + if (unlikely(device->lost)) + return VK_ERROR_DEVICE_LOST; + if (!device->info.has_llc) { /* Invalidate read cache before reading event written by GPU. */ __builtin_ia32_clflush(event); diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c index 2bbca66cebc..b1ed4d3854a 100644 --- a/src/intel/vulkan/genX_query.c +++ b/src/intel/vulkan/genX_query.c @@ -150,6 +150,9 @@ VkResult genX(GetQueryPoolResults)( pool->type == VK_QUERY_TYPE_PIPELINE_STATISTICS || pool->type == VK_QUERY_TYPE_TIMESTAMP); + if (unlikely(device->lost)) + return VK_ERROR_DEVICE_LOST; + if (pData == NULL) return VK_SUCCESS; |