From a8272bf0f1f9229d73252b03d0fb32d563396a9c Mon Sep 17 00:00:00 2001 From: Wei Zhao Date: Fri, 23 Jan 2026 13:19:03 +0800 Subject: [PATCH] vulkan/wsi/wayland: use roundtrip instead of flush on swapchain free Use wl_display_roundtrip() instead of wl_display_flush() when freeing a swapchain to ensure the compositor has processed buffer release events before continuing. wl_display_flush() only sends pending requests without waiting for the compositor to process them. When rapidly creating and destroying large swapchain buffers, buffer references may not be released quickly enough (e.g., during CTS testing), causing memory to accumulate. Using wl_display_roundtrip() ensures synchronization with the compositor, allowing buffers to be released promptly. Signed-off-by: Wei Zhao Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/vulkan/wsi/wsi_common_wayland.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 083777f42ac..9717b77f9c8 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -3363,7 +3363,7 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain, */ struct wsi_wl_surface *wsi_wl_surface = chain->wsi_wl_surface; if (!chain->retired) - wl_display_flush(wsi_wl_surface->display->wl_display); + wl_display_roundtrip(wsi_wl_surface->display->wl_display); if (chain->frame) wl_callback_destroy(chain->frame);