device->instance = physical_device->instance;
device->chipset_id = physical_device->chipset_id;
device->no_hw = physical_device->no_hw;
- device->lost = false;
+ device->_lost = false;
if (pAllocator)
device->alloc = *pAllocator;
*pQueue = NULL;
}
+void
+anv_device_set_lost(struct anv_device *device, const char *msg, ...)
+{
+ device->_lost = true;
+}
+
VkResult
anv_device_query_status(struct anv_device *device)
{
* for it. However, it doesn't hurt to check and it potentially lets us
* avoid an ioctl.
*/
- if (unlikely(device->lost))
+ if (anv_device_is_lost(device))
return VK_ERROR_DEVICE_LOST;
uint32_t active, pending;
int ret = anv_gem_gpu_get_reset_stats(device, &active, &pending);
if (ret == -1) {
/* We don't know the real error. */
- device->lost = true;
+ anv_device_set_lost(device, "get_reset_stats failed: %m");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"get_reset_stats failed: %m");
}
if (active) {
- device->lost = true;
+ anv_device_set_lost(device, "GPU hung on one of our command buffers");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"GPU hung on one of our command buffers");
} else if (pending) {
- device->lost = true;
+ anv_device_set_lost(device, "GPU hung with commands in-flight");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"GPU hung with commands in-flight");
}
return VK_NOT_READY;
} else if (ret == -1) {
/* We don't know the real error. */
- device->lost = true;
+ anv_device_set_lost(device, "gem wait failed: %m");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"gem wait failed: %m");
}
return VK_TIMEOUT;
} else if (ret == -1) {
/* We don't know the real error. */
- device->lost = true;
+ anv_device_set_lost(device, "gem wait failed: %m");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"gem wait failed: %m");
}
VkDevice _device)
{
ANV_FROM_HANDLE(anv_device, device, _device);
- if (unlikely(device->lost))
+ if (anv_device_is_lost(device))
return VK_ERROR_DEVICE_LOST;
struct anv_batch batch;
VkFence fence)
{
ANV_FROM_HANDLE(anv_queue, queue, _queue);
- if (unlikely(queue->device->lost))
+ if (anv_device_is_lost(queue->device))
return VK_ERROR_DEVICE_LOST;
return vk_error(VK_ERROR_FEATURE_NOT_PRESENT);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_event, event, _event);
- if (unlikely(device->lost))
+ if (anv_device_is_lost(device))
return VK_ERROR_DEVICE_LOST;
if (!device->info.has_llc) {
&pTimestamps[d]);
if (ret != 0) {
- device->lost = TRUE;
+ anv_device_set_lost(device, "Failed to get a timestamp");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"Failed to read the TIMESTAMP register: %m");
}
int ret = device->no_hw ? 0 : anv_gem_execbuffer(device, execbuf);
if (ret != 0) {
/* We don't know the real error. */
- device->lost = true;
+ anv_device_set_lost(device, "execbuf2 failed: %m");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"execbuf2 failed: %m");
}
*/
result = vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"vkQueueSubmit() failed");
- device->lost = true;
+ anv_device_set_lost(device, "vkQueueSubmit() failed");
}
pthread_mutex_unlock(&device->mutex);
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_fence, fence, _fence);
- if (unlikely(device->lost))
+ if (anv_device_is_lost(device))
return VK_ERROR_DEVICE_LOST;
struct anv_fence_impl *impl =
return VK_NOT_READY;
} else {
/* We don't know the real error. */
- device->lost = true;
+ anv_device_set_lost(device, "drm_syncobj_wait failed: %m");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"drm_syncobj_wait failed: %m");
}
return VK_TIMEOUT;
} else {
/* We don't know the real error. */
- device->lost = true;
+ anv_device_set_lost(device, "drm_syncobj_wait failed: %m");
return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
"drm_syncobj_wait failed: %m");
}
}
done:
- if (unlikely(device->lost))
+ if (anv_device_is_lost(device))
return VK_ERROR_DEVICE_LOST;
return result;
{
ANV_FROM_HANDLE(anv_device, device, _device);
- if (unlikely(device->lost))
+ if (anv_device_is_lost(device))
return VK_ERROR_DEVICE_LOST;
if (anv_all_fences_syncobj(fenceCount, pFences)) {