mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
venus: fix the queue init failure path
The prior behavior can ignore certain failure result, and might also
clean up queues that are never initialized.
Fixes: ddd7533055 ("venus: initial support for queue/fence/semaphore")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
This commit is contained in:
parent
01a0bfc3f9
commit
cb8dfa4966
1 changed files with 9 additions and 11 deletions
|
|
@ -89,28 +89,26 @@ vn_device_init_queues(struct vn_device *dev,
|
||||||
if (!queues)
|
if (!queues)
|
||||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||||
|
|
||||||
VkResult result = VK_SUCCESS;
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++) {
|
for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++) {
|
||||||
|
VkResult result;
|
||||||
|
|
||||||
const VkDeviceQueueCreateInfo *queue_info =
|
const VkDeviceQueueCreateInfo *queue_info =
|
||||||
&create_info->pQueueCreateInfos[i];
|
&create_info->pQueueCreateInfos[i];
|
||||||
for (uint32_t j = 0; j < queue_info->queueCount; j++) {
|
for (uint32_t j = 0; j < queue_info->queueCount; j++) {
|
||||||
result = vn_queue_init(dev, &queues[count], queue_info, j);
|
result = vn_queue_init(dev, &queues[count], queue_info, j);
|
||||||
if (result != VK_SUCCESS)
|
|
||||||
break;
|
|
||||||
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != VK_SUCCESS) {
|
if (result != VK_SUCCESS) {
|
||||||
for (uint32_t i = 0; i < count; i++)
|
for (uint32_t k = 0; k < count; k++)
|
||||||
vn_queue_fini(&queues[i]);
|
vn_queue_fini(&queues[k]);
|
||||||
vk_free(alloc, queues);
|
vk_free(alloc, queues);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dev->queues = queues;
|
dev->queues = queues;
|
||||||
dev->queue_count = count;
|
dev->queue_count = count;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue