[Libva] [PATCH] va/x11: Require synchronisation to vblank with DRI2SwapBuffers

Chris Wilson chris at chris-wilson.co.uk
Thu Dec 24 07:42:37 PST 2015


By passing divisor=0, we imply we do not care about synchronisation of
this request to the vertical refresh - the spec says that if we miss the
target frame, the swap will be presented as quickly as possible and may
forgo waiting until the next vblank. By using divisor=1, we request that
the swap be presented upon the vertical refresh immediately following
recipe, enforcing the synchronisation to vblank and avoiding tearing.

Reported-and-tested-by: Lukas Hejtmanek <xhejtman at ics.muni.cz>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 va/x11/dri2_util.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/va/x11/dri2_util.c b/va/x11/dri2_util.c
index d076fb3..9ff5e95 100644
--- a/va/x11/dri2_util.c
+++ b/va/x11/dri2_util.c
@@ -95,8 +95,9 @@ dri2SwapBuffer(VADriverContextP ctx, struct dri_drawable *dri_drawable)
     if (dri2_drawable->has_backbuffer) {
         if (gsDRI2SwapAvailable) {
             CARD64 ret;
-            VA_DRI2SwapBuffers(ctx->native_dpy, dri_drawable->x_drawable, 0, 0,
-                               0, &ret);
+            VA_DRI2SwapBuffers(ctx->native_dpy, dri_drawable->x_drawable,
+			       0, 1, 0,
+			       &ret);
         } else {
             xrect.x = 0;
             xrect.y = 0;
-- 
2.6.4



More information about the Libva mailing list