From ee77951714ff4373261befde6e84f592cc1c769c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michel=20D=C3=A4nzer?= Date: Fri, 5 Jun 2020 18:12:33 +0200 Subject: [PATCH] loader/dri3: Add dri3_wait_for_event_locked full_sequence out parameter Preparation for the next commit, no functional change intended. Cc: mesa-stable Reviewed-by: Kenneth Graunke Part-of: --- src/loader/loader_dri3_helper.c | 12 +++++++++--- src/loader/loader_dri3_helper.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 95f93da0e3a..622c238d950 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -526,7 +526,8 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw, } static bool -dri3_wait_for_event_locked(struct loader_dri3_drawable *draw) +dri3_wait_for_event_locked(struct loader_dri3_drawable *draw, + unsigned *full_sequence) { xcb_generic_event_t *ev; xcb_present_generic_event_t *ge; @@ -536,6 +537,8 @@ dri3_wait_for_event_locked(struct loader_dri3_drawable *draw) /* Only have one thread waiting for events at a time */ if (draw->has_event_waiter) { cnd_wait(&draw->event_cnd, &draw->mtx); + if (full_sequence) + *full_sequence = draw->last_special_event_sequence; /* Another thread has updated the protected info, so retest. */ return true; } else { @@ -549,6 +552,9 @@ dri3_wait_for_event_locked(struct loader_dri3_drawable *draw) } if (!ev) return false; + draw->last_special_event_sequence = ev->full_sequence; + if (full_sequence) + *full_sequence = ev->full_sequence; ge = (void *) ev; dri3_handle_present_event(draw, ge); return true; @@ -619,7 +625,7 @@ loader_dri3_wait_for_sbc(struct loader_dri3_drawable *draw, target_sbc = draw->send_sbc; while (draw->recv_sbc < target_sbc) { - if (!dri3_wait_for_event_locked(draw)) { + if (!dri3_wait_for_event_locked(draw, NULL)) { mtx_unlock(&draw->mtx); return 0; } @@ -667,7 +673,7 @@ dri3_find_back(struct loader_dri3_drawable *draw) return id; } } - if (!dri3_wait_for_event_locked(draw)) { + if (!dri3_wait_for_event_locked(draw, NULL)) { mtx_unlock(&draw->mtx); return -1; } diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h index 663ce3c0e2f..c314e4c5a9d 100644 --- a/src/loader/loader_dri3_helper.h +++ b/src/loader/loader_dri3_helper.h @@ -174,6 +174,7 @@ struct loader_dri3_drawable { */ mtx_t mtx; cnd_t event_cnd; + unsigned last_special_event_sequence; bool has_event_waiter; }; -- 2.30.2