[PATCH 2/2] present: Fix use of vsynced pageflips and honor PresentOptionAsync.

Mario Kleiner mario.kleiner.de at gmail.com
Mon Nov 24 18:27:42 PST 2014


Pageflips for Pixmap presents were not synchronized to vblank
by default, as they should be, due to some missing init for
vblank->sync_flips. The PresentOptionAsync flag was completely
ignored for controlling this.

Vsynced flips only worked by accident on the intel-ddx, as that
driver doesn't report PresentCapabilityAsync support (tested
on Intel HD Ironlake and Intel HD 4000 IvyBridge + Linux 3.17).
This lack might be a bug in the intel-ddx itself?

On nouveau-ddx, which properly reports PresentCapabilityAsync,
this always caused non-vsynced pageflips and pretty ugly tearing.

This patch fixes the problem, as tested on top of XOrg 1.16.2
on nouveau and intel.

Please also apply to XOrg 1.16 stable.

Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
---
 present/present.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/present/present.c b/present/present.c
index d84bdef..f24a218 100644
--- a/present/present.c
+++ b/present/present.c
@@ -737,6 +737,10 @@ present_pixmap(WindowPtr window,
      */
     window_priv->msc = crtc_msc;
 
+    /* Clear async request if driver can't support it for pixmap present */
+    if (pixmap && (!screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync)))
+        options &= ~PresentOptionAsync;
+
     /* Adjust target_msc to match modulus
      */
     if (crtc_msc >= target_msc) {
@@ -828,9 +832,10 @@ present_pixmap(WindowPtr window,
     vblank->msc_offset = window_priv->msc_offset;
     vblank->notifies = notifies;
     vblank->num_notifies = num_notifies;
+    vblank->sync_flip = TRUE;
 
-    if (!screen_priv->info || !(screen_priv->info->capabilities & PresentCapabilityAsync))
-        vblank->sync_flip = TRUE;
+    if (options & PresentOptionAsync)
+        vblank->sync_flip = FALSE;
 
     if (pixmap && present_check_flip (target_crtc, window, pixmap, vblank->sync_flip, valid, x_off, y_off)) {
         vblank->flip = TRUE;
-- 
2.1.0



More information about the xorg-devel mailing list