From 2203735887ab548b3ee004400d1b89149aae412c Mon Sep 17 00:00:00 2001 From: Axel Davy Date: Wed, 4 Nov 2015 18:42:42 +0100 Subject: [PATCH] present: Fix Async swap logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the spec, PresentOptionAsync should only trigger a different behaviour when the target msc has been reached. In this case if the driver is able to do async swaps, we use them to avoid a screen copy. When the target msc hasn't been reached yet, we want to use sync swaps. v2: Fix indentation and simplify checks for Async flips Signed-off-by: Axel Davy Reviewed-by: Michel Dänzer --- present/present.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/present/present.c b/present/present.c index 5900c2289..beb01dcbd 100644 --- a/present/present.c +++ b/present/present.c @@ -836,19 +836,20 @@ present_pixmap(WindowPtr window, vblank->notifies = notifies; vblank->num_notifies = num_notifies; - if (!(options & PresentOptionAsync)) - vblank->sync_flip = TRUE; - - if (!(options & PresentOptionCopy) && - !((options & PresentOptionAsync) && - (!screen_priv->info || - !(screen_priv->info->capabilities & PresentCapabilityAsync))) && - pixmap != NULL && - present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off)) - { - vblank->flip = TRUE; - if (vblank->sync_flip) + if (pixmap != NULL && + !(options & PresentOptionCopy) && + screen_priv->info) { + if (target_msc > crtc_msc && + present_check_flip (target_crtc, window, pixmap, TRUE, valid, x_off, y_off)) + { + vblank->flip = TRUE; + vblank->sync_flip = TRUE; target_msc--; + } else if ((screen_priv->info->capabilities & PresentCapabilityAsync) && + present_check_flip (target_crtc, window, pixmap, FALSE, valid, x_off, y_off)) + { + vblank->flip = TRUE; + } } if (wait_fence) {