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 <Wei.Zhao@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39475>
This commit is contained in:
Wei Zhao 2026-01-23 13:19:03 +08:00 committed by Marge Bot
parent feb3e8f46e
commit a8272bf0f1

View file

@ -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);