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>
This commit is contained in:
@@ -2925,6 +2925,8 @@ static struct intel_mapped_pinned_buffer_alloc aux_map_allocator = {
|
|||||||
.free = intel_aux_map_buffer_free,
|
.free = intel_aux_map_buffer_free,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static VkResult anv_device_check_status(struct vk_device *vk_device);
|
||||||
|
|
||||||
VkResult anv_CreateDevice(
|
VkResult anv_CreateDevice(
|
||||||
VkPhysicalDevice physicalDevice,
|
VkPhysicalDevice physicalDevice,
|
||||||
const VkDeviceCreateInfo* pCreateInfo,
|
const VkDeviceCreateInfo* pCreateInfo,
|
||||||
@@ -3018,6 +3020,8 @@ VkResult anv_CreateDevice(
|
|||||||
goto fail_device;
|
goto fail_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device->vk.check_status = anv_device_check_status;
|
||||||
|
|
||||||
uint32_t num_queues = 0;
|
uint32_t num_queues = 0;
|
||||||
for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++)
|
for (uint32_t i = 0; i < pCreateInfo->queueCreateInfoCount; i++)
|
||||||
num_queues += pCreateInfo->pQueueCreateInfos[i].queueCount;
|
num_queues += pCreateInfo->pQueueCreateInfos[i].queueCount;
|
||||||
@@ -3438,15 +3442,10 @@ VkResult anv_EnumerateInstanceLayerProperties(
|
|||||||
return vk_error(NULL, VK_ERROR_LAYER_NOT_PRESENT);
|
return vk_error(NULL, VK_ERROR_LAYER_NOT_PRESENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
static VkResult
|
||||||
anv_device_query_status(struct anv_device *device)
|
anv_device_check_status(struct vk_device *vk_device)
|
||||||
{
|
{
|
||||||
/* This isn't likely as most of the callers of this function already check
|
struct anv_device *device = container_of(vk_device, struct anv_device, vk);
|
||||||
* 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;
|
|
||||||
|
|
||||||
uint32_t active, pending;
|
uint32_t active, pending;
|
||||||
int ret = anv_gem_context_get_reset_stats(device->fd, device->context_id,
|
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
|
* likely means an ioctl, but we just did an ioctl to query the busy status
|
||||||
* so it's no great loss.
|
* so it's no great loss.
|
||||||
*/
|
*/
|
||||||
return anv_device_query_status(device);
|
return vk_device_check_status(&device->vk);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
@@ -3499,14 +3498,9 @@ anv_device_wait(struct anv_device *device, struct anv_bo *bo,
|
|||||||
} else if (ret == -1) {
|
} else if (ret == -1) {
|
||||||
/* We don't know the real error. */
|
/* We don't know the real error. */
|
||||||
return vk_device_set_lost(&device->vk, "gem wait failed: %m");
|
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
|
uint64_t
|
||||||
|
@@ -1311,9 +1311,6 @@ anv_mocs(const struct anv_device *device,
|
|||||||
void anv_device_init_blorp(struct anv_device *device);
|
void anv_device_init_blorp(struct anv_device *device);
|
||||||
void anv_device_finish_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 {
|
enum anv_bo_alloc_flags {
|
||||||
/** Specifies that the BO must have a 32-bit address
|
/** Specifies that the BO must have a 32-bit address
|
||||||
*
|
*
|
||||||
|
@@ -1344,7 +1344,7 @@ VkResult anv_QueueSubmit2KHR(
|
|||||||
* the kernel to kick us or we'll have to wait until the client waits on a
|
* 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.
|
* 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)
|
if (result != VK_SUCCESS)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@@ -420,7 +420,7 @@ wait_for_available(struct anv_device *device,
|
|||||||
while (anv_gettime_ns() < abs_timeout) {
|
while (anv_gettime_ns() < abs_timeout) {
|
||||||
if (query_is_available(pool, query))
|
if (query_is_available(pool, query))
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
VkResult status = anv_device_query_status(device);
|
VkResult status = vk_device_check_status(&device->vk);
|
||||||
if (status != VK_SUCCESS)
|
if (status != VK_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user