wsi/wl: Refactor out code to update current present ID.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27275>
This commit is contained in:
Hans-Kristian Arntzen 2024-01-25 16:15:33 +01:00 committed by Marge Bot
parent 820859a6ab
commit 1af7f41174

View file

@ -1920,6 +1920,17 @@ presentation_handle_sync_output(void *data,
{
}
static void
wsi_wl_presentation_update_present_id(struct wsi_wl_present_id *id)
{
/* present_ids.lock already held around dispatch */
if (id->present_id > id->chain->present_ids.max_completed)
id->chain->present_ids.max_completed = id->present_id;
wl_list_remove(&id->link);
vk_free(id->alloc, id);
}
static void
presentation_handle_presented(void *data,
struct wp_presentation_feedback *feedback,
@ -1929,14 +1940,8 @@ presentation_handle_presented(void *data,
uint32_t flags)
{
struct wsi_wl_present_id *id = data;
/* present_ids.lock already held around dispatch */
if (id->present_id > id->chain->present_ids.max_completed)
id->chain->present_ids.max_completed = id->present_id;
wsi_wl_presentation_update_present_id(id);
wp_presentation_feedback_destroy(feedback);
wl_list_remove(&id->link);
vk_free(id->alloc, id);
}
static void
@ -1944,14 +1949,8 @@ presentation_handle_discarded(void *data,
struct wp_presentation_feedback *feedback)
{
struct wsi_wl_present_id *id = data;
/* present_ids.lock already held around dispatch */
if (id->present_id > id->chain->present_ids.max_completed)
id->chain->present_ids.max_completed = id->present_id;
wsi_wl_presentation_update_present_id(id);
wp_presentation_feedback_destroy(feedback);
wl_list_remove(&id->link);
vk_free(id->alloc, id);
}
static const struct wp_presentation_feedback_listener