[Mesa-dev] [PATCH 3/3] dri3: Add a synchronisation point for texture-from-pixmap

Chris Wilson chris at chris-wilson.co.uk
Sat Oct 22 10:00:53 UTC 2016


This applies a synchronisation point to GetBuffers() such that binding a
texture-from-pixmap its rendering is serialised with X. This matches the
synchronisation point inside DRI2, but it is also arguable that implied
sync should be explicitly handled by the client by calling glXWaitX()
following the binding of all textures. However, currently glXWaitX()
only operates on the bound drawable and does not actually flush all
Pixmaps associated with the bound context.

This fixes an issue (output lag) where the compositor calls glXWaitX()
prior to acquiring the damage region from X and binding the
texture-from-pixmap. This works in DRI2 as texture binding flushes the
rendering to the Pixmap.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 src/loader/loader_dri3_helper.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index f4f6d53..41257f9 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1417,6 +1417,15 @@ loader_dri3_get_buffers(__DRIdrawable *driDrawable,
 
       if (!front)
          return false;
+
+      if (draw->sync_fence) {
+         xshmfence_reset(draw->shm_fence);
+
+         xcb_sync_trigger_fence(draw->conn, draw->sync_fence);
+         xcb_flush(draw->conn);
+
+         xshmfence_await(draw->shm_fence);
+      }
    } else {
       dri3_free_buffers(driDrawable, loader_dri3_buffer_front, draw);
       draw->have_fake_front = 0;
-- 
2.9.3



More information about the mesa-dev mailing list