[PATCH libXext 3/3] Add XSyncAwaitFence()

James Jones jajones at nvidia.com
Tue Sep 21 16:31:32 PDT 2010


Add the XSynceFence version of XSyncAwait().  Waits
for fence objects to reach the triggered state.

Signed-off-by: James Jones <jajones at nvidia.com>
Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
---
 include/X11/extensions/sync.h |    6 ++++++
 src/XSync.c                   |   21 +++++++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/X11/extensions/sync.h b/include/X11/extensions/sync.h
index 05a5a98..46cefac 100644
--- a/include/X11/extensions/sync.h
+++ b/include/X11/extensions/sync.h
@@ -364,6 +364,12 @@ extern Bool XSyncQueryFence(
     Bool* /*triggered*/
 );
 
+extern Bool XSyncAwaitFence(
+    Display* /*dpy*/,
+    const XSyncFence* /*fence_list*/,
+    int /*n_fences*/
+);
+
 _XFUNCPROTOEND
 
 #endif /* _SYNC_SERVER */
diff --git a/src/XSync.c b/src/XSync.c
index 0dcacc4..c1fcf86 100644
--- a/src/XSync.c
+++ b/src/XSync.c
@@ -875,6 +875,27 @@ XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered)
     return True;
 }
 
+Bool
+XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncAwaitFenceReq  *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncAwaitFence, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncAwaitFence;
+    SetReqLen(req, n_fences, n_fences);
+
+    Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
 /*
  *  Functions corresponding to the macros for manipulating 64-bit values
  */
-- 
1.7.1



More information about the xorg-devel mailing list