Skip to content

vulkan/wsi: avoid double-free on drivers that allocate on the display fd

Iago Toral requested to merge itoral/mesa:v3dv_khr_display_fix_double_free into main

The implementation of KHR_display seems to assume the normal operation where swapchain memory is allocated in a render node and then imported into the display fd. In this mode of operation, the import operation creates new GEM handles on the display node that need to be freed when swapchain images are destroyed.

However, this is not how v3dv works. Due to hw constrints, v3dv needs to allocate memory for swapchain images directly on the display device, so the import operation will not create a new GEM object, causing a double-free when the images are destroyed.

This patch fixes this by giving drivers a chance to inform the common display code that it won't own the memory.

Merge request reports