From 928050d4e4b0ee958be897d148b60328e9207228 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 19 Jan 2016 08:49:18 +0000 Subject: sna/dri2: Catch setting signal=true when we have no drawable Signed-off-by: Chris Wilson --- src/sna/sna_dri2.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/sna/sna_dri2.c') diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index 63c49327..0e184567 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -1507,6 +1507,7 @@ draw_current_msc(DrawablePtr draw, xf86CrtcPtr crtc, uint64_t msc) { struct dri2_window *priv; + assert(draw); if (draw->type != DRAWABLE_WINDOW) return msc; @@ -1595,6 +1596,8 @@ static void fake_swap_complete(struct sna *sna, ClientPtr client, { const struct ust_msc *swap; + assert(draw); + swap = sna_crtc_last_swap(crtc); DBG(("%s(type=%d): draw=%ld, pipe=%d, frame=%lld [msc %lld], tv=%d.%06d\n", __FUNCTION__, type, (long)draw->id, crtc ? sna_crtc_pipe(crtc) : -1, @@ -1716,6 +1719,8 @@ sna_dri2_client_gone(CallbackListPtr *list, void *closure, void *data) event->client = NULL; event->draw = NULL; + event->keepalive = 1; + assert(!event->signal); if (!event->queued) sna_dri2_event_free(event); @@ -1751,6 +1756,7 @@ sna_dri2_add_event(struct sna *sna, struct dri2_window *priv; struct sna_dri2_event *info, *chain; + assert(draw != NULL); assert(draw->type == DRAWABLE_WINDOW); DBG(("%s: adding event to window %ld)\n", __FUNCTION__, (long)draw->id)); @@ -1852,6 +1858,8 @@ void sna_dri2_destroy_window(WindowPtr win) info->signal = false; info->draw = NULL; + info->keepalive = 1; + assert(!info->signal); list_del(&info->link); chain = info->chain; @@ -2636,8 +2644,10 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event) else __sna_dri2_copy_event(info, info->sync | DRI2_BO); - info->keepalive++; - info->signal = true; + if (info->draw) { + info->keepalive++; + info->signal = true; + } } if (--info->keepalive) { @@ -2729,6 +2739,7 @@ sna_dri2_immediate_blit(struct sna *sna, bool signal = chain->signal; DBG(("%s: swap elision, unblocking client\n", __FUNCTION__)); + assert(chain->draw); chain->signal = true; frame_swap_complete(chain, DRI2_EXCHANGE_COMPLETE); chain->signal = signal; @@ -3072,6 +3083,7 @@ sna_dri2_schedule_flip(ClientPtr client, DrawablePtr draw, xf86CrtcPtr crtc, } else { info->flip_continue = FLIP_COMPLETE; signal = info->signal; + assert(info->draw); info->signal = true; goto new_back; } @@ -3363,6 +3375,7 @@ skip: info->type = SWAP_COMPLETE; info->event_complete = func; info->event_data = data; + assert(info->draw); info->signal = true; info->front = sna_dri2_reference_buffer(front); -- cgit v1.2.3