diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/loader/loader_dri3_helper.c | 36 | ||||
-rw-r--r-- | src/loader/loader_dri3_helper.h | 4 |
2 files changed, 18 insertions, 22 deletions
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 8f8efcb6463..fbda3d635c7 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -382,8 +382,7 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw, draw->ust = ce->ust; draw->msc = ce->msc; - } else { - draw->recv_msc_serial = ce->serial; + } else if (ce->serial == draw->eid) { draw->notify_ust = ce->ust; draw->notify_msc = ce->msc; } @@ -452,28 +451,29 @@ loader_dri3_wait_for_msc(struct loader_dri3_drawable *draw, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc) { - uint32_t msc_serial; - - msc_serial = ++draw->send_msc_serial; - xcb_present_notify_msc(draw->conn, - draw->drawable, - msc_serial, - target_msc, - divisor, - remainder); + xcb_void_cookie_t cookie = xcb_present_notify_msc(draw->conn, + draw->drawable, + draw->eid, + target_msc, + divisor, + remainder); + xcb_generic_event_t *ev; + unsigned full_sequence; mtx_lock(&draw->mtx); xcb_flush(draw->conn); /* Wait for the event */ - if (draw->special_event) { - while ((int32_t) (msc_serial - draw->recv_msc_serial) > 0) { - if (!dri3_wait_for_event_locked(draw)) { - mtx_unlock(&draw->mtx); - return false; - } + do { + ev = xcb_wait_for_special_event(draw->conn, draw->special_event); + if (!ev) { + mtx_unlock(&draw->mtx); + return false; } - } + + full_sequence = ev->full_sequence; + dri3_handle_present_event(draw, (void *) ev); + } while (full_sequence != cookie.sequence || draw->notify_msc < target_msc); *ust = draw->notify_ust; *msc = draw->notify_msc; diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h index 0dd37e91717..4ce98b8c59f 100644 --- a/src/loader/loader_dri3_helper.h +++ b/src/loader/loader_dri3_helper.h @@ -137,10 +137,6 @@ struct loader_dri3_drawable { /* Last received UST/MSC values from present notify msc event */ uint64_t notify_ust, notify_msc; - /* Serial numbers for tracking wait_for_msc events */ - uint32_t send_msc_serial; - uint32_t recv_msc_serial; - struct loader_dri3_buffer *buffers[LOADER_DRI3_NUM_BUFFERS]; int cur_back; int num_back; |