wsi/wayland: Do not assert that all present IDs have been waited on.
authorHans-Kristian Arntzen <post@arntzen-software.no>
Tue, 2 May 2023 11:31:37 +0000 (13:31 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 3 May 2023 16:09:10 +0000 (16:09 +0000)
EXT_swapchain_maintenance1 allows destruction when the swapchain fence
is complete. That may signal before we have dispatched all present
waits. Just discard those presentation feedbacks.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22682>

src/vulkan/wsi/wsi_common_wayland.c

index d2ec332..46b700c 100644 (file)
@@ -2118,7 +2118,17 @@ wsi_wl_swapchain_chain_free(struct wsi_wl_swapchain *chain,
 
    if (chain->present_ids.wp_presentation) {
       assert(!chain->present_ids.dispatch_in_progress);
-      assert(wl_list_empty(&chain->present_ids.outstanding_list));
+
+      /* In VK_EXT_swapchain_maintenance1 there is no requirement to wait for all present IDs to be complete.
+       * Waiting for the swapchain fence is enough.
+       * Just clean up anything user did not wait for. */
+      struct wsi_wl_present_id *id, *tmp;
+      wl_list_for_each_safe(id, tmp, &chain->present_ids.outstanding_list, link) {
+         wp_presentation_feedback_destroy(id->feedback);
+         wl_list_remove(&id->link);
+         vk_free(id->alloc, id);
+      }
+
       wl_proxy_wrapper_destroy(chain->present_ids.wp_presentation);
       pthread_cond_destroy(&chain->present_ids.list_advanced);
       pthread_mutex_destroy(&chain->present_ids.lock);