venus: fix missing renderer destructions

With failed compatibility check, the created renderer must be destroyed
within vn_instance_init_renderer.

Cc: mesa-stable
Fixes: 25b8f4f714 ("venus: handle device probing properly.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34613>
(cherry picked from commit 2a4675ee9fa2742da9826d1b5fb064b6a0066713)
This commit is contained in:
Yiwei Zhang
2025-04-18 16:05:12 -07:00
committed by Eric Engestrom
parent 6f12ae221c
commit da4de27515
2 changed files with 10 additions and 3 deletions

View File

@@ -434,7 +434,7 @@
"description": "venus: fix missing renderer destructions",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "25b8f4f7143f2e022df245ba2e1a2ab3ed4a2f90",
"notes": null

View File

@@ -181,7 +181,7 @@ vn_instance_init_renderer(struct vn_instance *instance)
vn_log(instance, "wire format version %d != %d",
renderer_info->wire_format_version, version);
}
return VK_ERROR_INITIALIZATION_FAILED;
goto out_renderer_destroy;
}
version = vn_info_vk_xml_version();
@@ -197,7 +197,7 @@ vn_instance_init_renderer(struct vn_instance *instance)
VK_VERSION_MINOR(VN_MIN_RENDERER_VERSION),
VK_VERSION_PATCH(VN_MIN_RENDERER_VERSION));
}
return VK_ERROR_INITIALIZATION_FAILED;
goto out_renderer_destroy;
}
uint32_t spec_version =
@@ -226,6 +226,12 @@ vn_instance_init_renderer(struct vn_instance *instance)
}
return VK_SUCCESS;
out_renderer_destroy:
vn_renderer_destroy(instance->renderer, alloc);
/* needed by stub instance creation */
instance->renderer = NULL;
return VK_ERROR_INITIALIZATION_FAILED;
}
/* instance commands */
@@ -309,6 +315,7 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
result = vn_instance_init_renderer(instance);
if (result == VK_ERROR_INITIALIZATION_FAILED) {
assert(!instance->renderer);
*pInstance = instance_handle;
return VK_SUCCESS;
}