mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 17:10:32 +01:00
vulkan/wsi/headless: do not destroy images that are never created
Currently the image creation failure handling codepath of wsi_headless_surface_create_swapchain() just calls wsi_headless_swapchain_destroy() , which will try to destroy all `image_count` of images. However, some of these images might never be successfully created because of the failure, which leads to double-free. Set image_count to the number of successfully created images before calling wsi_headless_swapchin_destroy() to prevent over-destroying. Fixes dEQP-VK.wsi.headless.swapchain.simulate_oom.* on lavapipe and pvr, although some of the tests got QualityWarning saying "Creating swapchain did not succeed, callback limit exceeded" on lavapipe (Pass on pvr). Cc: mesa-stable Signed-off-by: Icenowy Zheng <uwu@icenowy.me> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39039>
This commit is contained in:
parent
bb17ad3f08
commit
e8c81652c9
1 changed files with 4 additions and 1 deletions
|
|
@ -406,8 +406,11 @@ wsi_headless_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
|
|||
for (uint32_t i = 0; i < chain->base.image_count; i++) {
|
||||
result = wsi_create_image(&chain->base, &chain->base.image_info,
|
||||
&chain->images[i].base);
|
||||
if (result != VK_SUCCESS)
|
||||
if (result != VK_SUCCESS) {
|
||||
/* Record how many images need to be torn down */
|
||||
chain->base.image_count = i;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
chain->images[i].busy_on_host = false;
|
||||
chain->images[i].busy_on_device = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue