<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Redraw lag on Ivy Bridge since 1f6dfc9df678"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=97914#c18">Comment # 18</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Redraw lag on Ivy Bridge since 1f6dfc9df678"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=97914">bug 97914</a>
              from <span class="vcard"><a class="email" href="mailto:chris@chris-wilson.co.uk" title="Chris Wilson <chris@chris-wilson.co.uk>"> <span class="fn">Chris Wilson</span></a>
</span></b>
        <pre>Small bug in the dri3 code failed to setup the sync:

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index f55f766..d192edf 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1103,9 +1103,9 @@ dri3_update_drawable(__DRIdrawable *driDrawable,
          draw->is_pixmap = true;
          xcb_unregister_for_special_event(draw->conn, draw->special_event);
          draw->special_event = NULL;
-
-         dri3_attach_sync(draw);
       }
+
+      dri3_attach_sync(draw);
    }
    dri3_flush_present_events(draw);
    return true;

but that alone is not enough. The bug stems from rendering done by X between
the glXWaitX() at the start of the cycle and the extraction of the damage
rectangles. In DRI2 this is papered over by the flush from glXWaitX() being
delayed until the texture-from-pixmap operation. We either need the same
invalidation (+ flush) using dri3. In compton, the issue goes away with:

diff --git a/src/opengl.c b/src/opengl.c
index 5a98f4e..5e38599 100644
--- a/src/opengl.c
+++ b/src/opengl.c
@@ -1041,6 +1041,7 @@ glx_set_clip(session_t *ps, XserverRegion reg, const
reg_data_t *pcache_reg) {
   if (!rects) {
     nrects = 0;
     rects = rects_free = XFixesFetchRegion(ps->dpy, reg, &nrects);
+    glXWaitX();
   }
   // Use one empty rectangle if the region is empty
   if (!nrects) {</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>