From 64b1b1f10da59f15a91141c9f76d7d09517f8ea8 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 23 Feb 2016 09:32:57 +0000 Subject: sna/dri2: Ensure the flipqueue is drained on pageflip failure If we fail to queue a flip for a CRTC, we attempt to restore the original mode. However, if the failure is on a second CRTC, the queued flip on the first will still complete causing us to process the event twice. References: https://bugs.freedesktop.org/show_bug.cgi?id=94250 Signed-off-by: Chris Wilson --- src/sna/sna_dri2.c | 7 +++++-- 1 file changed, 5 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 fcfbd9d9..9398c0a8 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -1914,6 +1914,7 @@ sna_dri2_flip(struct sna_dri2_event *info) return false; } + assert(!info->queued); if (!sna_page_flip(info->sna, bo, sna_dri2_flip_handler, info->type == FLIP_ASYNC ? NULL : info)) return false; @@ -2797,6 +2798,7 @@ sna_dri2_flip_continue(struct sna_dri2_event *info) if (bo != sna_pixmap(info->sna->front)->gpu_bo) return false; + assert(!info->queued); if (!sna_page_flip(info->sna, bo, sna_dri2_flip_handler, info)) return false; @@ -2868,8 +2870,9 @@ static void sna_dri2_flip_event(struct sna_dri2_event *flip) { struct sna *sna = flip->sna; - DBG(("%s flip=%p (pipe=%d, event=%d)\n", __FUNCTION__, flip, flip->pipe, flip->type)); - assert(flip->queued); + DBG(("%s flip=%p (pipe=%d, event=%d, queued?=%d)\n", __FUNCTION__, flip, flip->pipe, flip->type, flip->queued)); + if (!flip->queued) /* pageflip died whilst being queued */ + return; flip->queued = false; if (sna->dri2.flip_pending == flip) -- cgit v1.2.3