render/vulkan: wait for DMA-BUF fences

The Vulkan spec doesn't guarantee that the driver will wait for
implicitly synchronized client buffers before texturing from them.
radv happens to perform the wait, but anv doesn't.

Fix this by extracting implicit fences from DMA-BUFs, importing
them into Vulkan as a VkSemaphore objects, and make the render pass
wait on these VkSemaphores.
This commit is contained in:
Simon Ser 2022-12-02 19:15:16 +01:00 committed by Simon Zeni
parent 30219cf76b
commit 8456ac6fa9
4 changed files with 119 additions and 3 deletions

View file

@ -217,6 +217,12 @@ void vulkan_texture_destroy(struct wlr_vk_texture *texture) {
vulkan_free_ds(texture->renderer, texture->ds_pool, texture->ds);
}
for (size_t i = 0; i < WLR_DMABUF_MAX_PLANES; i++) {
if (texture->foreign_semaphores[i] != VK_NULL_HANDLE) {
vkDestroySemaphore(dev, texture->foreign_semaphores[i], NULL);
}
}
vkDestroyImageView(dev, texture->image_view, NULL);
vkDestroyImage(dev, texture->image, NULL);