anv: Switch to common GetDeviceQueues2 and DeviceWaitIdle

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
This commit is contained in:
Jason Ekstrand 2021-09-23 12:41:06 -05:00 committed by Marge Bot
parent 0e4266260a
commit cc9f34cdd6

View file

@ -3386,39 +3386,6 @@ VkResult anv_EnumerateInstanceLayerProperties(
return vk_error(VK_ERROR_LAYER_NOT_PRESENT);
}
void anv_GetDeviceQueue2(
VkDevice _device,
const VkDeviceQueueInfo2* pQueueInfo,
VkQueue* pQueue)
{
ANV_FROM_HANDLE(anv_device, device, _device);
struct anv_physical_device *pdevice = device->physical;
assert(pQueueInfo->queueFamilyIndex < pdevice->queue.family_count);
struct anv_queue_family *queue_family =
&pdevice->queue.families[pQueueInfo->queueFamilyIndex];
int idx_in_family = 0;
struct anv_queue *queue = NULL;
for (uint32_t i = 0; i < device->queue_count; i++) {
if (device->queues[i].family != queue_family)
continue;
if (idx_in_family == pQueueInfo->queueIndex) {
queue = &device->queues[i];
break;
}
idx_in_family++;
}
assert(queue != NULL);
if (queue && queue->vk.flags == pQueueInfo->flags)
*pQueue = anv_queue_to_handle(queue);
else
*pQueue = NULL;
}
void
_anv_device_report_lost(struct anv_device *device)
{
@ -3560,23 +3527,6 @@ anv_device_wait(struct anv_device *device, struct anv_bo *bo,
return anv_device_query_status(device);
}
VkResult anv_DeviceWaitIdle(
VkDevice _device)
{
ANV_FROM_HANDLE(anv_device, device, _device);
if (anv_device_is_lost(device))
return VK_ERROR_DEVICE_LOST;
for (uint32_t i = 0; i < device->queue_count; i++) {
VkResult res = anv_queue_submit_simple_batch(&device->queues[i], NULL);
if (res != VK_SUCCESS)
return res;
}
return VK_SUCCESS;
}
uint64_t
anv_vma_alloc(struct anv_device *device,
uint64_t size, uint64_t align,