*pQueue = NULL;
}
-void
-anv_device_set_lost(struct anv_device *device, const char *msg, ...)
+VkResult
+_anv_device_set_lost(struct anv_device *device,
+ const char *file, int line,
+ const char *msg, ...)
{
- device->_lost = true;
+ VkResult err;
+ va_list ap;
- if (env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false)) {
- intel_loge("Device lost!");
+ device->_lost = true;
- va_list ap;
- va_start(ap, msg);
- intel_loge_v(msg, ap);
- va_end(ap);
+ va_start(ap, msg);
+ err = __vk_errorv(device->instance, device,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
+ VK_ERROR_DEVICE_LOST, file, line, msg, ap);
+ va_end(ap);
+ if (env_var_as_boolean("ANV_ABORT_ON_DEVICE_LOSS", false))
abort();
- }
+
+ return err;
}
VkResult
int ret = anv_gem_gpu_get_reset_stats(device, &active, &pending);
if (ret == -1) {
/* We don't know the real error. */
- 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");
+ return anv_device_set_lost(device, "get_reset_stats failed: %m");
}
if (active) {
- 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");
+ return anv_device_set_lost(device, "GPU hung on one of our command buffers");
} else if (pending) {
- 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 anv_device_set_lost(device, "GPU hung with commands in-flight");
}
return VK_SUCCESS;
return VK_NOT_READY;
} else if (ret == -1) {
/* We don't know the real error. */
- anv_device_set_lost(device, "gem wait failed: %m");
- return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
- "gem wait failed: %m");
+ return anv_device_set_lost(device, "gem wait failed: %m");
}
/* Query for device status after the busy call. If the BO we're checking
return VK_TIMEOUT;
} else if (ret == -1) {
/* We don't know the real error. */
- anv_device_set_lost(device, "gem wait failed: %m");
- return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
- "gem wait failed: %m");
+ return anv_device_set_lost(device, "gem wait failed: %m");
}
/* Query for device status after the wait. If the BO we're waiting on got
&pTimestamps[d]);
if (ret != 0) {
- 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");
+ return anv_device_set_lost(device, "Failed to read the TIMESTAMP "
+ "register: %m");
}
uint64_t device_period = DIV_ROUND_UP(1000000000, timestamp_frequency);
max_clock_period = MAX2(max_clock_period, device_period);
int ret = device->no_hw ? 0 : anv_gem_execbuffer(device, execbuf);
if (ret != 0) {
/* We don't know the real error. */
- anv_device_set_lost(device, "execbuf2 failed: %m");
- return vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
- "execbuf2 failed: %m");
+ return anv_device_set_lost(device, "execbuf2 failed: %m");
}
struct drm_i915_gem_exec_object2 *objects =
* VK_ERROR_DEVICE_LOST to ensure that clients do not attempt to
* submit the same job again to this device.
*/
- result = vk_errorf(device->instance, device, VK_ERROR_DEVICE_LOST,
- "vkQueueSubmit() failed");
- anv_device_set_lost(device, "vkQueueSubmit() failed");
+ result = anv_device_set_lost(device, "vkQueueSubmit() failed");
}
pthread_mutex_unlock(&device->mutex);
return VK_NOT_READY;
} else {
/* We don't know the real error. */
- 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 anv_device_set_lost(device, "drm_syncobj_wait failed: %m");
}
} else {
return VK_SUCCESS;
return VK_TIMEOUT;
} else {
/* We don't know the real error. */
- 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 anv_device_set_lost(device, "drm_syncobj_wait failed: %m");
}
} else {
return VK_SUCCESS;