[PATCH xserver (v3) 03/10] Add XSyncQueryFence()

James Jones jajones at nvidia.com
Sun Dec 5 19:25:28 PST 2010


Allows callers to query whether or not a given
fence sync object is currently triggered.

Signed-off-by: James Jones <jajones at nvidia.com>
Reviewed-by: Aaron Plattner <aplattner at nvidia.com>
Reviewed-by: Robert Morell <rmorell at nvidia.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
---
 Xext/sync.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/Xext/sync.c b/Xext/sync.c
index 147eab8..16daa63 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1836,6 +1836,38 @@ ProcSyncDestroyFence(ClientPtr client)
     return client->noClientException;
 }
 
+static int
+ProcSyncQueryFence(ClientPtr client)
+{
+    REQUEST(xSyncQueryFenceReq);
+    xSyncQueryFenceReply rep;
+    SyncFence *pFence;
+    int rc;
+
+    REQUEST_SIZE_MATCH(xSyncQueryFenceReq);
+
+    rc = dixLookupResourceByType((pointer *)&pFence, stuff->fid,
+				 RTFence, client, DixReadAccess);
+    if (rc != Success)
+	return rc;
+
+    rep.type = X_Reply;
+    rep.length = 0;
+    rep.sequenceNumber = client->sequence;
+
+    rep.triggered = pFence->triggered;
+
+    if (client->swapped)
+    {
+	char n;
+	swaps(&rep.sequenceNumber, n);
+	swapl(&rep.length, n);
+    }
+
+    WriteToClient(client, sizeof(xSyncQueryFenceReply), (char *) &rep);
+    return client->noClientException;
+}
+
 /*
  * ** Given an extension request, call the appropriate request procedure
  */
@@ -1882,6 +1914,8 @@ ProcSyncDispatch(ClientPtr client)
 	return ProcSyncResetFence(client);
       case X_SyncDestroyFence:
 	return ProcSyncDestroyFence(client);
+      case X_SyncQueryFence:
+	return ProcSyncQueryFence(client);
       default:
 	return BadRequest;
     }
@@ -2134,6 +2168,19 @@ SProcSyncDestroyFence(ClientPtr client)
 }
 
 static int
+SProcSyncQueryFence(ClientPtr client)
+{
+    REQUEST(xSyncQueryFenceReq);
+    char   n;
+
+    swaps(&stuff->length, n);
+    REQUEST_SIZE_MATCH (xSyncQueryFenceReq);
+    swapl(&stuff->fid, n);
+
+    return ProcSyncQueryFence(client);
+}
+
+static int
 SProcSyncDispatch(ClientPtr client)
 {
     REQUEST(xReq);
@@ -2176,6 +2223,8 @@ SProcSyncDispatch(ClientPtr client)
 	return SProcSyncResetFence(client);
       case X_SyncDestroyFence:
 	return SProcSyncDestroyFence(client);
+      case X_SyncQueryFence:
+	return SProcSyncQueryFence(client);
       default:
 	return BadRequest;
     }
-- 
1.7.1



More information about the xorg-devel mailing list