3 Copyright 1991, 1993, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of The Open Group shall
23 not be used in advertising or otherwise to promote the sale, use or
24 other dealings in this Software without prior written authorization
29 /***********************************************************
30 Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
31 and Olivetti Research Limited, Cambridge, England.
35 Permission to use, copy, modify, and distribute this software and its
36 documentation for any purpose and without fee is hereby granted,
37 provided that the above copyright notice appear in all copies and that
38 both that copyright notice and this permission notice appear in
39 supporting documentation, and that the names of Digital or Olivetti
40 not be used in advertising or publicity pertaining to distribution of the
41 software without specific, written prior permission.
43 DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
44 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
45 FITNESS, IN NO EVENT SHALL THEY BE LIABLE FOR ANY SPECIAL, INDIRECT OR
46 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
47 USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
48 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
49 PERFORMANCE OF THIS SOFTWARE.
51 ******************************************************************/
57 #include <X11/Xlibint.h>
58 #include <X11/extensions/Xext.h>
59 #include <X11/extensions/extutil.h>
60 #include <X11/extensions/sync.h>
61 #include <X11/extensions/syncproto.h>
63 static XExtensionInfo _sync_info_data;
64 static XExtensionInfo *sync_info = &_sync_info_data;
65 static const char *sync_extension_name = SYNC_NAME;
67 #define SyncCheckExtension(dpy,i,val) \
68 XextCheckExtension(dpy, i, sync_extension_name, val)
69 #define SyncSimpleCheckExtension(dpy,i) \
70 XextSimpleCheckExtension(dpy, i, sync_extension_name)
72 static int close_display(Display *dpy, XExtCodes *codes);
73 static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
74 static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
75 static char *error_string(Display *dpy, int code, XExtCodes *codes,
78 static XExtensionHooks sync_extension_hooks = {
83 NULL, /* create_font */
85 close_display, /* close_display */
86 wire_to_event, /* wire_to_event */
87 event_to_wire, /* event_to_wire */
89 error_string, /* error_string */
92 static const char *sync_error_list[] = {
98 typedef struct _SyncVersionInfoRec {
104 static /* const */ SyncVersionInfo supported_versions[] = {
105 { 3 /* major */, 0 /* minor */, 2 /* num_errors */ },
106 { 3 /* major */, 1 /* minor */, 3 /* num_errors */ },
109 #define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0]))
110 #define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL)
111 #define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info))
114 const SyncVersionInfo* GetVersionInfo(Display *dpy)
116 xSyncInitializeReply rep;
117 xSyncInitializeReq *req;
121 if (!XQueryExtension(dpy, sync_extension_name,
128 GetReq(SyncInitialize, req);
129 req->reqType = codes.major_opcode;
130 req->syncReqType = X_SyncInitialize;
131 req->majorVersion = SYNC_MAJOR_VERSION;
132 req->minorVersion = SYNC_MINOR_VERSION;
133 if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
142 for (i = 0; i < NUM_VERSIONS; i++) {
143 if (supported_versions[i].major == rep.majorVersion &&
144 supported_versions[i].minor == rep.minorVersion) {
145 return &supported_versions[i];
153 XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create)
155 XExtDisplayInfo *dpyinfo;
158 if (!(sync_info = XextCreateExtension())) return NULL;
161 if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) {
162 dpyinfo = XextAddDisplay(sync_info, dpy,
164 &sync_extension_hooks,
166 (XPointer)GetVersionInfo(dpy));
173 XExtDisplayInfo *find_display (Display *dpy)
175 return find_display_create_optional(dpy, True);
179 XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info)
182 char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
184 XExtDisplayInfo *info = find_display_create_optional(dpy, False);
185 int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0;
187 code -= codes->first_error;
188 if (code >= 0 && code < nerr) {
190 sprintf (tmp, "%s.%d", sync_extension_name, code);
191 XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n);
198 wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
200 XExtDisplayInfo *info = find_display(dpy);
201 XSyncCounterNotifyEvent *aevent;
202 xSyncCounterNotifyEvent *awire;
203 XSyncAlarmNotifyEvent *anl;
204 xSyncAlarmNotifyEvent *ane;
206 SyncCheckExtension(dpy, info, False);
208 switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
210 case XSyncCounterNotify:
211 awire = (xSyncCounterNotifyEvent *) wire;
212 aevent = (XSyncCounterNotifyEvent *) event;
213 aevent->type = awire->type & 0x7F;
214 aevent->serial = _XSetLastRequestRead(dpy,
215 (xGenericReply *) wire);
216 aevent->send_event = (awire->type & 0x80) != 0;
217 aevent->display = dpy;
218 aevent->counter = awire->counter;
219 XSyncIntsToValue(&aevent->wait_value, awire->wait_value_lo,
220 awire->wait_value_hi);
221 XSyncIntsToValue(&aevent->counter_value,
222 awire->counter_value_lo,
223 awire->counter_value_hi);
224 aevent->time = awire->time;
225 aevent->count = awire->count;
226 aevent->destroyed = awire->destroyed;
229 case XSyncAlarmNotify:
230 ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
231 anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
232 anl->type = ane->type & 0x7F;
233 anl->serial = _XSetLastRequestRead(dpy,
234 (xGenericReply *) wire);
235 anl->send_event = (ane->type & 0x80) != 0;
237 anl->alarm = ane->alarm;
238 XSyncIntsToValue(&anl->counter_value,
239 ane->counter_value_lo,
240 ane->counter_value_hi);
241 XSyncIntsToValue(&anl->alarm_value,
243 ane->alarm_value_hi);
244 anl->state = (XSyncAlarmState)ane->state;
245 anl->time = ane->time;
253 event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
255 XExtDisplayInfo *info = find_display(dpy);
256 XSyncCounterNotifyEvent *aevent;
257 xSyncCounterNotifyEvent *awire;
258 XSyncAlarmNotifyEvent *anl;
259 xSyncAlarmNotifyEvent *ane;
261 SyncCheckExtension(dpy, info, False);
263 switch ((event->type & 0x7F) - info->codes->first_event)
265 case XSyncCounterNotify:
266 awire = (xSyncCounterNotifyEvent *) wire;
267 aevent = (XSyncCounterNotifyEvent *) event;
268 awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
269 awire->sequenceNumber = aevent->serial & 0xFFFF;
270 awire->counter = aevent->counter;
271 awire->wait_value_lo = XSyncValueLow32(aevent->wait_value);
272 awire->wait_value_hi = XSyncValueHigh32(aevent->wait_value);
273 awire->counter_value_lo = XSyncValueLow32(aevent->counter_value);
274 awire->counter_value_hi = XSyncValueHigh32(aevent->counter_value);
275 awire->time = aevent->time;
276 awire->count = aevent->count;
277 awire->destroyed = aevent->destroyed;
280 case XSyncAlarmNotify:
281 ane = (xSyncAlarmNotifyEvent *) wire; /* ENCODING EVENT PTR */
282 anl = (XSyncAlarmNotifyEvent *) event; /* LIBRARY EVENT PTR */
283 ane->type = anl->type | (anl->send_event ? 0x80 : 0);
284 ane->sequenceNumber = anl->serial & 0xFFFF;
285 ane->alarm = anl->alarm;
286 ane->counter_value_lo = XSyncValueLow32(anl->counter_value);
287 ane->counter_value_hi = XSyncValueHigh32(anl->counter_value);
288 ane->alarm_value_lo = XSyncValueLow32(anl->alarm_value);
289 ane->alarm_value_hi = XSyncValueHigh32(anl->alarm_value);
290 ane->state = anl->state;
291 ane->time = anl->time;
300 int *event_base_return, int *error_base_return)
302 XExtDisplayInfo *info = find_display(dpy);
304 if (XextHasExtension(info))
306 *event_base_return = info->codes->first_event;
307 *error_base_return = info->codes->first_error;
317 int *major_version_return, int *minor_version_return)
319 XExtDisplayInfo *info = find_display(dpy);
321 SyncCheckExtension(dpy, info, False);
323 if (IS_VERSION_SUPPORTED(info)) {
324 *major_version_return = GET_VERSION(info)->major;
325 *minor_version_return = GET_VERSION(info)->minor;
334 XSyncListSystemCounters(Display *dpy, int *n_counters_return)
336 XExtDisplayInfo *info = find_display(dpy);
337 xSyncListSystemCountersReply rep;
338 xSyncListSystemCountersReq *req;
339 XSyncSystemCounter *list = NULL;
341 SyncCheckExtension(dpy, info, NULL);
344 GetReq(SyncListSystemCounters, req);
345 req->reqType = info->codes->major_opcode;
346 req->syncReqType = X_SyncListSystemCounters;
347 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
350 *n_counters_return = rep.nCounters;
351 if (rep.nCounters > 0)
353 xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter;
354 XSyncCounter counter;
358 list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter));
359 replylen = rep.length << 2;
360 pWireSysCounter = Xmalloc ((unsigned) replylen + sizeof(XSyncCounter));
361 /* +1 to leave room for last counter read-ahead */
363 if ((!list) || (!pWireSysCounter))
365 if (list) Xfree((char *) list);
366 if (pWireSysCounter) Xfree((char *) pWireSysCounter);
367 _XEatData(dpy, (unsigned long) replylen);
372 _XReadPad(dpy, (char *)pWireSysCounter, replylen);
374 counter = pWireSysCounter->counter;
375 for (i = 0; i < rep.nCounters; i++)
377 list[i].counter = counter;
378 XSyncIntsToValue(&list[i].resolution,
379 pWireSysCounter->resolution_lo,
380 pWireSysCounter->resolution_hi);
382 /* we may be about to clobber the counter field of the
383 * next syscounter because we have to add a null terminator
384 * to the counter name string. So we save the next counter
387 pNextWireSysCounter = (xSyncSystemCounter *)
388 (((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) +
389 pWireSysCounter->name_length + 3) & ~3));
390 counter = pNextWireSysCounter->counter;
392 list[i].name = ((char *)pWireSysCounter) +
393 SIZEOF(xSyncSystemCounter);
394 /* null-terminate the string */
395 *(list[i].name + pWireSysCounter->name_length) = '\0';
396 pWireSysCounter = pNextWireSysCounter;
407 XSyncFreeSystemCounterList(XSyncSystemCounter *list)
411 Xfree( ((char *)list[0].name) - SIZEOF(xSyncSystemCounter));
418 XSyncCreateCounter(Display *dpy, XSyncValue initial_value)
420 XExtDisplayInfo *info = find_display(dpy);
421 xSyncCreateCounterReq *req;
423 SyncCheckExtension(dpy, info, None);
426 GetReq(SyncCreateCounter, req);
427 req->reqType = info->codes->major_opcode;
428 req->syncReqType = X_SyncCreateCounter;
430 req->cid = XAllocID(dpy);
431 req->initial_value_lo = XSyncValueLow32(initial_value);
432 req->initial_value_hi = XSyncValueHigh32(initial_value);
440 XSyncSetCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
442 XExtDisplayInfo *info = find_display(dpy);
443 xSyncSetCounterReq *req;
445 SyncCheckExtension(dpy, info, False);
448 GetReq(SyncSetCounter, req);
449 req->reqType = info->codes->major_opcode;
450 req->syncReqType = X_SyncSetCounter;
452 req->value_lo = XSyncValueLow32(value);
453 req->value_hi = XSyncValueHigh32(value);
460 XSyncChangeCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
462 XExtDisplayInfo *info = find_display(dpy);
463 xSyncChangeCounterReq *req;
465 SyncCheckExtension(dpy, info, False);
468 GetReq(SyncChangeCounter, req);
469 req->reqType = info->codes->major_opcode;
470 req->syncReqType = X_SyncChangeCounter;
472 req->value_lo = XSyncValueLow32(value);
473 req->value_hi = XSyncValueHigh32(value);
480 XSyncDestroyCounter(Display *dpy, XSyncCounter counter)
482 XExtDisplayInfo *info = find_display(dpy);
483 xSyncDestroyCounterReq *req;
485 SyncCheckExtension(dpy, info, False);
488 GetReq(SyncDestroyCounter, req);
489 req->reqType = info->codes->major_opcode;
490 req->syncReqType = X_SyncDestroyCounter;
491 req->counter = counter;
499 XSyncQueryCounter(Display *dpy, XSyncCounter counter, XSyncValue *value_return)
501 XExtDisplayInfo *info = find_display(dpy);
502 xSyncQueryCounterReply rep;
503 xSyncQueryCounterReq *req;
505 SyncCheckExtension(dpy, info, False);
508 GetReq(SyncQueryCounter, req);
509 req->reqType = info->codes->major_opcode;
510 req->syncReqType = X_SyncQueryCounter;
511 req->counter = counter;
512 if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
518 XSyncIntsToValue(value_return, rep.value_lo, rep.value_hi);
527 XSyncAwait(Display *dpy, XSyncWaitCondition *wait_list, int n_conditions)
529 XExtDisplayInfo *info = find_display(dpy);
530 XSyncWaitCondition *wait_item = wait_list;
534 SyncCheckExtension(dpy, info, False);
537 GetReq(SyncAwait, req);
538 req->reqType = info->codes->major_opcode;
539 req->syncReqType = X_SyncAwait;
540 len = (n_conditions * SIZEOF(xSyncWaitCondition)) >> 2;
541 SetReqLen(req, len, len /* XXX */ );
543 while (n_conditions--)
545 xSyncWaitCondition wc;
546 wc.counter = wait_item->trigger.counter;
547 wc.value_type = wait_item->trigger.value_type;
548 wc.wait_value_lo = XSyncValueLow32(wait_item->trigger.wait_value);
549 wc.wait_value_hi = XSyncValueHigh32(wait_item->trigger.wait_value);
550 wc.test_type = wait_item->trigger.test_type;
551 wc.event_threshold_lo = XSyncValueLow32(wait_item->event_threshold);
552 wc.event_threshold_hi = XSyncValueHigh32(wait_item->event_threshold);
553 Data(dpy, (char *)&wc, SIZEOF(xSyncWaitCondition));
554 wait_item++; /* get next trigger */
563 _XProcessAlarmAttributes(Display *dpy, xSyncChangeAlarmReq *req,
564 unsigned long valuemask,
565 XSyncAlarmAttributes *attributes)
568 unsigned long values[32];
569 unsigned long *value = values;
570 unsigned int nvalues;
572 if (valuemask & XSyncCACounter)
573 *value++ = attributes->trigger.counter;
575 if (valuemask & XSyncCAValueType)
576 *value++ = attributes->trigger.value_type;
578 if (valuemask & XSyncCAValue)
580 *value++ = XSyncValueHigh32(attributes->trigger.wait_value);
581 *value++ = XSyncValueLow32(attributes->trigger.wait_value);
584 if (valuemask & XSyncCATestType)
585 *value++ = attributes->trigger.test_type;
587 if (valuemask & XSyncCADelta)
589 *value++ = XSyncValueHigh32(attributes->delta);
590 *value++ = XSyncValueLow32(attributes->delta);
593 if (valuemask & XSyncCAEvents)
594 *value++ = attributes->events;
596 /* N.B. the 'state' field cannot be set or changed */
597 req->length += (nvalues = value - values);
598 nvalues <<= 2; /* watch out for macros... */
600 Data32(dpy, (long *) values, (long) nvalues);
606 unsigned long values_mask,
607 XSyncAlarmAttributes *values)
609 XExtDisplayInfo *info = find_display(dpy);
610 xSyncCreateAlarmReq *req;
613 SyncCheckExtension(dpy, info, False);
616 GetReq(SyncCreateAlarm, req);
617 req->reqType = info->codes->major_opcode;
618 req->syncReqType = X_SyncCreateAlarm;
619 req->id = aid = XAllocID(dpy);
620 values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
621 | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
622 if ((req->valueMask = values_mask))
623 _XProcessAlarmAttributes(dpy, (xSyncChangeAlarmReq *) req,
624 values_mask, values);
631 XSyncDestroyAlarm(Display *dpy, XSyncAlarm alarm)
633 XExtDisplayInfo *info = find_display(dpy);
634 xSyncDestroyAlarmReq *req;
636 SyncCheckExtension(dpy, info, False);
639 GetReq(SyncDestroyAlarm, req);
640 req->reqType = info->codes->major_opcode;
641 req->syncReqType = X_SyncDestroyAlarm;
652 XSyncAlarmAttributes *values_return)
654 XExtDisplayInfo *info = find_display(dpy);
655 xSyncQueryAlarmReq *req;
656 xSyncQueryAlarmReply rep;
658 SyncCheckExtension(dpy, info, False);
661 GetReq(SyncQueryAlarm, req);
662 req->reqType = info->codes->major_opcode;
663 req->syncReqType = X_SyncQueryAlarm;
666 if (!(_XReply(dpy, (xReply *) & rep,
667 ((SIZEOF(xSyncQueryAlarmReply) - SIZEOF(xGenericReply)) >> 2), xFalse)))
674 values_return->trigger.counter = rep.counter;
675 values_return->trigger.value_type = (XSyncValueType)rep.value_type;
676 XSyncIntsToValue(&values_return->trigger.wait_value,
677 rep.wait_value_lo, rep.wait_value_hi);
678 values_return->trigger.test_type = (XSyncTestType)rep.test_type;
679 XSyncIntsToValue(&values_return->delta, rep.delta_lo,
681 values_return->events = rep.events;
682 values_return->state = (XSyncAlarmState)rep.state;
692 unsigned long values_mask,
693 XSyncAlarmAttributes *values)
695 XExtDisplayInfo *info = find_display(dpy);
696 xSyncChangeAlarmReq *req;
698 SyncCheckExtension(dpy, info, False);
701 GetReq(SyncChangeAlarm, req);
702 req->reqType = info->codes->major_opcode;
703 req->syncReqType = X_SyncChangeAlarm;
705 values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
706 | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
707 if ((req->valueMask = values_mask))
708 _XProcessAlarmAttributes(dpy, req, values_mask, values);
717 XID client_resource_id,
720 XExtDisplayInfo *info = find_display(dpy);
721 xSyncSetPriorityReq *req;
723 SyncCheckExtension(dpy, info, False);
726 GetReq(SyncSetPriority, req);
727 req->reqType = info->codes->major_opcode;
728 req->syncReqType = X_SyncSetPriority;
729 req->id = client_resource_id;
730 req->priority = priority;
737 XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority)
739 XExtDisplayInfo *info = find_display(dpy);
740 xSyncGetPriorityReply rep;
741 xSyncGetPriorityReq *req;
743 SyncCheckExtension(dpy, info, False);
746 GetReq(SyncGetPriority, req);
747 req->reqType = info->codes->major_opcode;
748 req->syncReqType = X_SyncGetPriority;
749 req->id = client_resource_id;
751 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
758 *return_priority = rep.priority;
766 XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered)
768 XExtDisplayInfo *info = find_display(dpy);
769 xSyncCreateFenceReq *req;
772 SyncCheckExtension(dpy, info, None);
775 GetReq(SyncCreateFence, req);
776 req->reqType = info->codes->major_opcode;
777 req->syncReqType = X_SyncCreateFence;
780 id = req->fid = XAllocID(dpy);
781 req->initially_triggered = initially_triggered;
789 XSyncTriggerFence(Display *dpy, XSyncFence fence)
791 XExtDisplayInfo *info = find_display(dpy);
792 xSyncTriggerFenceReq *req;
794 SyncCheckExtension(dpy, info, None);
797 GetReq(SyncTriggerFence, req);
798 req->reqType = info->codes->major_opcode;
799 req->syncReqType = X_SyncTriggerFence;
809 XSyncResetFence(Display *dpy, XSyncFence fence)
811 XExtDisplayInfo *info = find_display(dpy);
812 xSyncResetFenceReq *req;
814 SyncCheckExtension(dpy, info, None);
817 GetReq(SyncResetFence, req);
818 req->reqType = info->codes->major_opcode;
819 req->syncReqType = X_SyncResetFence;
829 XSyncDestroyFence(Display *dpy, XSyncFence fence)
831 XExtDisplayInfo *info = find_display(dpy);
832 xSyncDestroyFenceReq *req;
834 SyncCheckExtension(dpy, info, None);
837 GetReq(SyncDestroyFence, req);
838 req->reqType = info->codes->major_opcode;
839 req->syncReqType = X_SyncDestroyFence;
849 XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered)
851 XExtDisplayInfo *info = find_display(dpy);
852 xSyncQueryFenceReply rep;
853 xSyncQueryFenceReq *req;
855 SyncCheckExtension(dpy, info, None);
858 GetReq(SyncQueryFence, req);
859 req->reqType = info->codes->major_opcode;
860 req->syncReqType = X_SyncQueryFence;
863 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
870 *triggered = rep.triggered;
878 XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences)
880 XExtDisplayInfo *info = find_display(dpy);
881 xSyncAwaitFenceReq *req;
883 SyncCheckExtension(dpy, info, False);
886 GetReq(SyncAwaitFence, req);
887 req->reqType = info->codes->major_opcode;
888 req->syncReqType = X_SyncAwaitFence;
889 SetReqLen(req, n_fences, n_fences);
891 Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences);
899 * Functions corresponding to the macros for manipulating 64-bit values
903 XSyncIntToValue(XSyncValue *pv, int i)
905 _XSyncIntToValue(pv,i);
909 XSyncIntsToValue(XSyncValue *pv, unsigned int l, int h)
911 _XSyncIntsToValue(pv, l, h);
915 XSyncValueGreaterThan(XSyncValue a, XSyncValue b)
917 return _XSyncValueGreaterThan(a, b);
921 XSyncValueLessThan(XSyncValue a, XSyncValue b)
923 return _XSyncValueLessThan(a, b);
927 XSyncValueGreaterOrEqual(XSyncValue a, XSyncValue b)
929 return _XSyncValueGreaterOrEqual(a, b);
933 XSyncValueLessOrEqual(XSyncValue a, XSyncValue b)
935 return _XSyncValueLessOrEqual(a, b);
939 XSyncValueEqual(XSyncValue a, XSyncValue b)
941 return _XSyncValueEqual(a, b);
945 XSyncValueIsNegative(XSyncValue v)
947 return _XSyncValueIsNegative(v);
951 XSyncValueIsZero(XSyncValue a)
953 return _XSyncValueIsZero(a);
957 XSyncValueIsPositive(XSyncValue v)
959 return _XSyncValueIsPositive(v);
963 XSyncValueLow32(XSyncValue v)
965 return _XSyncValueLow32(v);
969 XSyncValueHigh32(XSyncValue v)
971 return _XSyncValueHigh32(v);
975 XSyncValueAdd(XSyncValue *presult, XSyncValue a, XSyncValue b, Bool *poverflow)
977 _XSyncValueAdd(presult, a, b, poverflow);
983 XSyncValue a, XSyncValue b,
986 _XSyncValueSubtract(presult, a, b, poverflow);
990 XSyncMaxValue(XSyncValue *pv)
996 XSyncMinValue(XSyncValue *pv)