diff --git a/present/present_vblank.c b/present/present_vblank.c index 72a8b2e3e..7b83bc630 100644 --- a/present/present_vblank.c +++ b/present/present_vblank.c @@ -40,6 +40,20 @@ present_vblank_notify(present_vblank_ptr vblank, CARD8 kind, CARD8 mode, uint64_ } } +static Bool +present_want_async_flip(uint32_t options, uint32_t capabilities) +{ + if (options & PresentOptionAsync && + capabilities & PresentCapabilityAsync) + return TRUE; + + if (options & PresentOptionAsyncMayTear && + capabilities & PresentCapabilityAsyncMayTear) + return TRUE; + + return FALSE; +} + /* The memory vblank points to must be 0-initialized before calling this function. * * If this function returns FALSE, present_vblank_destroy must be called to clean @@ -118,15 +132,14 @@ present_vblank_init(present_vblank_ptr vblank, if (pixmap != NULL && !(options & PresentOptionCopy) && screen_priv->check_flip) { - if (msc_is_after(target_msc, crtc_msc) && - screen_priv->check_flip (target_crtc, window, pixmap, TRUE, valid, x_off, y_off, &reason)) - { - vblank->flip = TRUE; - vblank->sync_flip = TRUE; - } else if ((capabilities & PresentAllAsyncCapabilities) && - screen_priv->check_flip (target_crtc, window, pixmap, FALSE, valid, x_off, y_off, &reason)) + + Bool sync_flip = !present_want_async_flip(options, capabilities); + + if (screen_priv->check_flip (target_crtc, window, pixmap, + sync_flip, valid, x_off, y_off, &reason)) { vblank->flip = TRUE; + vblank->sync_flip = sync_flip; } } vblank->reason = reason;