[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    [PATCH 2/2] present: Fix use of vsynced pageflips and honor PresentOptionAsync.
From:       Mario Kleiner <mario.kleiner.de () gmail ! com>
Date:       2014-11-25 2:27:42
Message-ID: 1416882462-17294-3-git-send-email-mario.kleiner.de () gmail ! com
[Download RAW message or body]

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@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

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic