From 1b5f91e14226799ef4ec6461de93fa9193ef2ebc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 31 May 2014 21:41:45 +0100 Subject: [PATCH] sna/dri2: Decouple spent flip If the flip is already completed before we finish the previous flip, the drawable has been replaced already and we can unchain the flip queue. Signed-off-by: Chris Wilson --- src/sna/sna_dri2.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index a832099c..497bd5bb 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -1786,11 +1786,24 @@ sna_dri2_flip_continue(struct sna *sna, struct sna_dri2_frame_event *info) if (bo != sna_pixmap(sna->front)->gpu_bo) return false; - info->count = sna_page_flip(sna, bo, info, info->pipe); - if (!info->count) - return false; + if (bo == sna->dri2.scanout[0].bo) { + DBG(("%s: flip chain already complete\n", __FUNCTION__)); - update_scanout(sna, info, bo, info->front->name); + if (info->draw) { + sna_dri2_remove_frame_event((WindowPtr)info->draw, info); + if (info->chain) + chain_swap(sna, info->draw, info->chain); + } + + info->draw = NULL; + return false; + } else { + info->count = sna_page_flip(sna, bo, info, info->pipe); + if (!info->count) + return false; + + update_scanout(sna, info, bo, info->front->name); + } } else { info->type = -info->mode;