From ba5ef49dcbf9e001231658ad8c6588649a2dbd57 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 19 Jan 2016 16:51:56 +0000 Subject: [PATCH 1/2] anv/wsi: Avoid stuck Wayland connection In acquire_next_image, we are waiting for a wl_buffer::release to arrive and release one of the buffers in our swapchain. Most compositors don't explicitly flush release events, so we may need to perform a roundtrip instead, to ensure the event arrives. Signed-off-by: Daniel Stone --- src/vulkan/anv_wsi_wayland.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index 5e8a3a56f68..c8f9cf27ab3 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -536,8 +536,8 @@ wsi_wl_swapchain_acquire_next_image(struct anv_swapchain *anv_chain, /* This time we do a blocking dispatch because we can't go * anywhere until we get an event. */ - int ret = wl_display_dispatch_queue(chain->display->display, - chain->queue); + int ret = wl_display_roundtrip_queue(chain->display->display, + chain->queue); if (ret < 0) return vk_error(VK_ERROR_OUT_OF_DATE_KHR); } From f9ca780ea4fa1b11639a880be501171017585f2c Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 19 Jan 2016 16:53:16 +0000 Subject: [PATCH 2/2] anv/wsi: Mark Wayland buffers as busy We were diligently setting Wayland buffers as non-busy, but nowhere in the code did we set them to busy when submitted to the server. This meant that acquire_next_image would only ever find the same buffer in a loop, over and over. Signed-off-by: Daniel Stone --- src/vulkan/anv_wsi_wayland.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index c8f9cf27ab3..28f0ed834df 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -584,6 +584,7 @@ wsi_wl_swapchain_queue_present(struct anv_swapchain *anv_chain, chain->fifo_ready = false; } + chain->images[image_index].busy = true; wl_surface_commit(chain->surface); wl_display_flush(chain->display->display);