summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2021-11-08 12:53:10 -0600
committerJason Ekstrand <jason@jlekstrand.net>2021-11-16 10:02:08 -0600
commit236ca763760861cff653696d6ed142429a604be6 (patch)
tree4a01d2f31670fc52416660e034b4295a0aedb9ec
parente9662e0154275408dea25f049cc55c79b0061b3b (diff)
anv: Wire up the new status check
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13427>
-rw-r--r--src/intel/vulkan/anv_device.c26
-rw-r--r--src/intel/vulkan/anv_private.h3
-rw-r--r--src/intel/vulkan/anv_queue.c2
-rw-r--r--src/intel/vulkan/genX_query.c2
4 files changed, 12 insertions, 21 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index a77152b30b3..9597cf9d361 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2925,6 +2925,8 @@ static struct intel_mapped_pinned_buffer_alloc aux_map_allocator = {
.free = intel_aux_map_buffer_free,
};
+static VkResult anv_device_check_status(struct vk_device *vk_device);
+
VkResult anv_CreateDevice(
VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo* pCreateInfo,
@@ -3018,6 +3020,8 @@ VkResult anv_CreateDevice(
goto fail_device;
}
+ device->vk.check_status = anv_device_check_status;
+
uint32_t num_queues = 0;
for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++)
num_queues += pCreateInfo->pQueueCreateInfos[i].queueCount;
@@ -3438,15 +3442,10 @@ VkResult anv_EnumerateInstanceLayerProperties(
return vk_error(NULL, VK_ERROR_LAYER_NOT_PRESENT);
}
-VkResult
-anv_device_query_status(struct anv_device *device)
+static VkResult
+anv_device_check_status(struct vk_device *vk_device)
{
- /* This isn't likely as most of the callers of this function already check
- * for it. However, it doesn't hurt to check and it potentially lets us
- * avoid an ioctl.
- */
- if (vk_device_is_lost(&device->vk))
- return VK_ERROR_DEVICE_LOST;
+ struct anv_device *device = container_of(vk_device, struct anv_device, vk);
uint32_t active, pending;
int ret = anv_gem_context_get_reset_stats(device->fd, device->context_id,
@@ -3486,7 +3485,7 @@ anv_device_bo_busy(struct anv_device *device, struct anv_bo *bo)
* likely means an ioctl, but we just did an ioctl to query the busy status
* so it's no great loss.
*/
- return anv_device_query_status(device);
+ return vk_device_check_status(&device->vk);
}
VkResult
@@ -3499,14 +3498,9 @@ anv_device_wait(struct anv_device *device, struct anv_bo *bo,
} else if (ret == -1) {
/* We don't know the real error. */
return vk_device_set_lost(&device->vk, "gem wait failed: %m");
+ } else {
+ return VK_SUCCESS;
}
-
- /* Query for device status after the wait. If the BO we're waiting on got
- * caught in a GPU hang we don't want to return VK_SUCCESS to the client
- * because it clearly doesn't have valid data. Yes, this most likely means
- * an ioctl, but we just did an ioctl to wait so it's no great loss.
- */
- return anv_device_query_status(device);
}
uint64_t
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index b6a3a0fc58a..b6b9239bc91 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -1311,9 +1311,6 @@ anv_mocs(const struct anv_device *device,
void anv_device_init_blorp(struct anv_device *device);
void anv_device_finish_blorp(struct anv_device *device);
-VkResult anv_device_query_status(struct anv_device *device);
-
-
enum anv_bo_alloc_flags {
/** Specifies that the BO must have a 32-bit address
*
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index c8a67a4a2f5..4bcfe99b801 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -1344,7 +1344,7 @@ VkResult anv_QueueSubmit2KHR(
* the kernel to kick us or we'll have to wait until the client waits on a
* fence before we actually know whether or not we've hung.
*/
- VkResult result = anv_device_query_status(device);
+ VkResult result = vk_device_check_status(&device->vk);
if (result != VK_SUCCESS)
return result;
diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c
index f66e7d5b399..e1e2692c700 100644
--- a/src/intel/vulkan/genX_query.c
+++ b/src/intel/vulkan/genX_query.c
@@ -420,7 +420,7 @@ wait_for_available(struct anv_device *device,
while (anv_gettime_ns() < abs_timeout) {
if (query_is_available(pool, query))
return VK_SUCCESS;
- VkResult status = anv_device_query_status(device);
+ VkResult status = vk_device_check_status(&device->vk);
if (status != VK_SUCCESS)
return status;
}