etc/protocols - sync with NetBSD-8
[minix.git] / external / mit / xorg / lib / libxcb / files / sync.c
blob96ba34be64d5b77bd101e675ef143e0f1bd918d2
1 /*
2 * This file generated automatically from sync.xml by c_client.py.
3 * Edit at your peril.
4 */
6 #ifdef HAVE_CONFIG_H
7 #include "config.h"
8 #endif
9 #include <stdlib.h>
10 #include <string.h>
11 #include <assert.h>
12 #include <stddef.h> /* for offsetof() */
13 #include "xcbext.h"
14 #include "sync.h"
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
19 xcb_extension_t xcb_sync_id = { "SYNC", 0 };
21 void
22 xcb_sync_alarm_next (xcb_sync_alarm_iterator_t *i /**< */)
24 --i->rem;
25 ++i->data;
26 i->index += sizeof(xcb_sync_alarm_t);
29 xcb_generic_iterator_t
30 xcb_sync_alarm_end (xcb_sync_alarm_iterator_t i /**< */)
32 xcb_generic_iterator_t ret;
33 ret.data = i.data + i.rem;
34 ret.index = i.index + ((char *) ret.data - (char *) i.data);
35 ret.rem = 0;
36 return ret;
39 void
40 xcb_sync_counter_next (xcb_sync_counter_iterator_t *i /**< */)
42 --i->rem;
43 ++i->data;
44 i->index += sizeof(xcb_sync_counter_t);
47 xcb_generic_iterator_t
48 xcb_sync_counter_end (xcb_sync_counter_iterator_t i /**< */)
50 xcb_generic_iterator_t ret;
51 ret.data = i.data + i.rem;
52 ret.index = i.index + ((char *) ret.data - (char *) i.data);
53 ret.rem = 0;
54 return ret;
57 void
58 xcb_sync_fence_next (xcb_sync_fence_iterator_t *i /**< */)
60 --i->rem;
61 ++i->data;
62 i->index += sizeof(xcb_sync_fence_t);
65 xcb_generic_iterator_t
66 xcb_sync_fence_end (xcb_sync_fence_iterator_t i /**< */)
68 xcb_generic_iterator_t ret;
69 ret.data = i.data + i.rem;
70 ret.index = i.index + ((char *) ret.data - (char *) i.data);
71 ret.rem = 0;
72 return ret;
75 void
76 xcb_sync_int64_next (xcb_sync_int64_iterator_t *i /**< */)
78 --i->rem;
79 ++i->data;
80 i->index += sizeof(xcb_sync_int64_t);
83 xcb_generic_iterator_t
84 xcb_sync_int64_end (xcb_sync_int64_iterator_t i /**< */)
86 xcb_generic_iterator_t ret;
87 ret.data = i.data + i.rem;
88 ret.index = i.index + ((char *) ret.data - (char *) i.data);
89 ret.rem = 0;
90 return ret;
93 int
94 xcb_sync_systemcounter_sizeof (const void *_buffer /**< */)
96 char *xcb_tmp = (char *)_buffer;
97 const xcb_sync_systemcounter_t *_aux = (xcb_sync_systemcounter_t *)_buffer;
98 unsigned int xcb_buffer_len = 0;
99 unsigned int xcb_block_len = 0;
100 unsigned int xcb_pad = 0;
101 unsigned int xcb_align_to = 0;
104 xcb_block_len += sizeof(xcb_sync_systemcounter_t);
105 xcb_tmp += xcb_block_len;
106 xcb_buffer_len += xcb_block_len;
107 xcb_block_len = 0;
108 /* name */
109 xcb_block_len += _aux->name_len * sizeof(char);
110 xcb_tmp += xcb_block_len;
111 xcb_align_to = ALIGNOF(char);
112 /* insert padding */
113 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
114 xcb_buffer_len += xcb_block_len + xcb_pad;
115 if (0 != xcb_pad) {
116 xcb_tmp += xcb_pad;
117 xcb_pad = 0;
119 xcb_block_len = 0;
121 return xcb_buffer_len;
124 char *
125 xcb_sync_systemcounter_name (const xcb_sync_systemcounter_t *R /**< */)
127 return (char *) (R + 1);
131 xcb_sync_systemcounter_name_length (const xcb_sync_systemcounter_t *R /**< */)
133 return R->name_len;
136 xcb_generic_iterator_t
137 xcb_sync_systemcounter_name_end (const xcb_sync_systemcounter_t *R /**< */)
139 xcb_generic_iterator_t i;
140 i.data = ((char *) (R + 1)) + (R->name_len);
141 i.rem = 0;
142 i.index = (char *) i.data - (char *) R;
143 return i;
146 void
147 xcb_sync_systemcounter_next (xcb_sync_systemcounter_iterator_t *i /**< */)
149 xcb_sync_systemcounter_t *R = i->data;
150 xcb_generic_iterator_t child;
151 child.data = (xcb_sync_systemcounter_t *)(((char *)R) + xcb_sync_systemcounter_sizeof(R));
152 i->index = (char *) child.data - (char *) i->data;
153 --i->rem;
154 i->data = (xcb_sync_systemcounter_t *) child.data;
157 xcb_generic_iterator_t
158 xcb_sync_systemcounter_end (xcb_sync_systemcounter_iterator_t i /**< */)
160 xcb_generic_iterator_t ret;
161 while(i.rem > 0)
162 xcb_sync_systemcounter_next(&i);
163 ret.data = i.data;
164 ret.rem = i.rem;
165 ret.index = i.index;
166 return ret;
169 void
170 xcb_sync_trigger_next (xcb_sync_trigger_iterator_t *i /**< */)
172 --i->rem;
173 ++i->data;
174 i->index += sizeof(xcb_sync_trigger_t);
177 xcb_generic_iterator_t
178 xcb_sync_trigger_end (xcb_sync_trigger_iterator_t i /**< */)
180 xcb_generic_iterator_t ret;
181 ret.data = i.data + i.rem;
182 ret.index = i.index + ((char *) ret.data - (char *) i.data);
183 ret.rem = 0;
184 return ret;
187 void
188 xcb_sync_waitcondition_next (xcb_sync_waitcondition_iterator_t *i /**< */)
190 --i->rem;
191 ++i->data;
192 i->index += sizeof(xcb_sync_waitcondition_t);
195 xcb_generic_iterator_t
196 xcb_sync_waitcondition_end (xcb_sync_waitcondition_iterator_t i /**< */)
198 xcb_generic_iterator_t ret;
199 ret.data = i.data + i.rem;
200 ret.index = i.index + ((char *) ret.data - (char *) i.data);
201 ret.rem = 0;
202 return ret;
205 xcb_sync_initialize_cookie_t
206 xcb_sync_initialize (xcb_connection_t *c /**< */,
207 uint8_t desired_major_version /**< */,
208 uint8_t desired_minor_version /**< */)
210 static const xcb_protocol_request_t xcb_req = {
211 /* count */ 2,
212 /* ext */ &xcb_sync_id,
213 /* opcode */ XCB_SYNC_INITIALIZE,
214 /* isvoid */ 0
217 struct iovec xcb_parts[4];
218 xcb_sync_initialize_cookie_t xcb_ret;
219 xcb_sync_initialize_request_t xcb_out;
221 xcb_out.desired_major_version = desired_major_version;
222 xcb_out.desired_minor_version = desired_minor_version;
224 xcb_parts[2].iov_base = (char *) &xcb_out;
225 xcb_parts[2].iov_len = sizeof(xcb_out);
226 xcb_parts[3].iov_base = 0;
227 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
229 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
230 return xcb_ret;
233 xcb_sync_initialize_cookie_t
234 xcb_sync_initialize_unchecked (xcb_connection_t *c /**< */,
235 uint8_t desired_major_version /**< */,
236 uint8_t desired_minor_version /**< */)
238 static const xcb_protocol_request_t xcb_req = {
239 /* count */ 2,
240 /* ext */ &xcb_sync_id,
241 /* opcode */ XCB_SYNC_INITIALIZE,
242 /* isvoid */ 0
245 struct iovec xcb_parts[4];
246 xcb_sync_initialize_cookie_t xcb_ret;
247 xcb_sync_initialize_request_t xcb_out;
249 xcb_out.desired_major_version = desired_major_version;
250 xcb_out.desired_minor_version = desired_minor_version;
252 xcb_parts[2].iov_base = (char *) &xcb_out;
253 xcb_parts[2].iov_len = sizeof(xcb_out);
254 xcb_parts[3].iov_base = 0;
255 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
257 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
258 return xcb_ret;
261 xcb_sync_initialize_reply_t *
262 xcb_sync_initialize_reply (xcb_connection_t *c /**< */,
263 xcb_sync_initialize_cookie_t cookie /**< */,
264 xcb_generic_error_t **e /**< */)
266 return (xcb_sync_initialize_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
270 xcb_sync_list_system_counters_sizeof (const void *_buffer /**< */)
272 char *xcb_tmp = (char *)_buffer;
273 const xcb_sync_list_system_counters_reply_t *_aux = (xcb_sync_list_system_counters_reply_t *)_buffer;
274 unsigned int xcb_buffer_len = 0;
275 unsigned int xcb_block_len = 0;
276 unsigned int xcb_pad = 0;
277 unsigned int xcb_align_to = 0;
279 unsigned int i;
280 unsigned int xcb_tmp_len;
282 xcb_block_len += sizeof(xcb_sync_list_system_counters_reply_t);
283 xcb_tmp += xcb_block_len;
284 xcb_buffer_len += xcb_block_len;
285 xcb_block_len = 0;
286 /* counters */
287 for(i=0; i<_aux->counters_len; i++) {
288 xcb_tmp_len = xcb_sync_systemcounter_sizeof(xcb_tmp);
289 xcb_block_len += xcb_tmp_len;
290 xcb_tmp += xcb_tmp_len;
292 xcb_align_to = ALIGNOF(xcb_sync_systemcounter_t);
293 /* insert padding */
294 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
295 xcb_buffer_len += xcb_block_len + xcb_pad;
296 if (0 != xcb_pad) {
297 xcb_tmp += xcb_pad;
298 xcb_pad = 0;
300 xcb_block_len = 0;
302 return xcb_buffer_len;
305 xcb_sync_list_system_counters_cookie_t
306 xcb_sync_list_system_counters (xcb_connection_t *c /**< */)
308 static const xcb_protocol_request_t xcb_req = {
309 /* count */ 2,
310 /* ext */ &xcb_sync_id,
311 /* opcode */ XCB_SYNC_LIST_SYSTEM_COUNTERS,
312 /* isvoid */ 0
315 struct iovec xcb_parts[4];
316 xcb_sync_list_system_counters_cookie_t xcb_ret;
317 xcb_sync_list_system_counters_request_t xcb_out;
320 xcb_parts[2].iov_base = (char *) &xcb_out;
321 xcb_parts[2].iov_len = sizeof(xcb_out);
322 xcb_parts[3].iov_base = 0;
323 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
325 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
326 return xcb_ret;
329 xcb_sync_list_system_counters_cookie_t
330 xcb_sync_list_system_counters_unchecked (xcb_connection_t *c /**< */)
332 static const xcb_protocol_request_t xcb_req = {
333 /* count */ 2,
334 /* ext */ &xcb_sync_id,
335 /* opcode */ XCB_SYNC_LIST_SYSTEM_COUNTERS,
336 /* isvoid */ 0
339 struct iovec xcb_parts[4];
340 xcb_sync_list_system_counters_cookie_t xcb_ret;
341 xcb_sync_list_system_counters_request_t xcb_out;
344 xcb_parts[2].iov_base = (char *) &xcb_out;
345 xcb_parts[2].iov_len = sizeof(xcb_out);
346 xcb_parts[3].iov_base = 0;
347 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
349 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
350 return xcb_ret;
354 xcb_sync_list_system_counters_counters_length (const xcb_sync_list_system_counters_reply_t *R /**< */)
356 return R->counters_len;
359 xcb_sync_systemcounter_iterator_t
360 xcb_sync_list_system_counters_counters_iterator (const xcb_sync_list_system_counters_reply_t *R /**< */)
362 xcb_sync_systemcounter_iterator_t i;
363 i.data = (xcb_sync_systemcounter_t *) (R + 1);
364 i.rem = R->counters_len;
365 i.index = (char *) i.data - (char *) R;
366 return i;
369 xcb_sync_list_system_counters_reply_t *
370 xcb_sync_list_system_counters_reply (xcb_connection_t *c /**< */,
371 xcb_sync_list_system_counters_cookie_t cookie /**< */,
372 xcb_generic_error_t **e /**< */)
374 return (xcb_sync_list_system_counters_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
377 xcb_void_cookie_t
378 xcb_sync_create_counter_checked (xcb_connection_t *c /**< */,
379 xcb_sync_counter_t id /**< */,
380 xcb_sync_int64_t initial_value /**< */)
382 static const xcb_protocol_request_t xcb_req = {
383 /* count */ 2,
384 /* ext */ &xcb_sync_id,
385 /* opcode */ XCB_SYNC_CREATE_COUNTER,
386 /* isvoid */ 1
389 struct iovec xcb_parts[4];
390 xcb_void_cookie_t xcb_ret;
391 xcb_sync_create_counter_request_t xcb_out;
393 xcb_out.id = id;
394 xcb_out.initial_value = initial_value;
396 xcb_parts[2].iov_base = (char *) &xcb_out;
397 xcb_parts[2].iov_len = sizeof(xcb_out);
398 xcb_parts[3].iov_base = 0;
399 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
401 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
402 return xcb_ret;
405 xcb_void_cookie_t
406 xcb_sync_create_counter (xcb_connection_t *c /**< */,
407 xcb_sync_counter_t id /**< */,
408 xcb_sync_int64_t initial_value /**< */)
410 static const xcb_protocol_request_t xcb_req = {
411 /* count */ 2,
412 /* ext */ &xcb_sync_id,
413 /* opcode */ XCB_SYNC_CREATE_COUNTER,
414 /* isvoid */ 1
417 struct iovec xcb_parts[4];
418 xcb_void_cookie_t xcb_ret;
419 xcb_sync_create_counter_request_t xcb_out;
421 xcb_out.id = id;
422 xcb_out.initial_value = initial_value;
424 xcb_parts[2].iov_base = (char *) &xcb_out;
425 xcb_parts[2].iov_len = sizeof(xcb_out);
426 xcb_parts[3].iov_base = 0;
427 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
429 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
430 return xcb_ret;
433 xcb_void_cookie_t
434 xcb_sync_destroy_counter_checked (xcb_connection_t *c /**< */,
435 xcb_sync_counter_t counter /**< */)
437 static const xcb_protocol_request_t xcb_req = {
438 /* count */ 2,
439 /* ext */ &xcb_sync_id,
440 /* opcode */ XCB_SYNC_DESTROY_COUNTER,
441 /* isvoid */ 1
444 struct iovec xcb_parts[4];
445 xcb_void_cookie_t xcb_ret;
446 xcb_sync_destroy_counter_request_t xcb_out;
448 xcb_out.counter = counter;
450 xcb_parts[2].iov_base = (char *) &xcb_out;
451 xcb_parts[2].iov_len = sizeof(xcb_out);
452 xcb_parts[3].iov_base = 0;
453 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
455 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
456 return xcb_ret;
459 xcb_void_cookie_t
460 xcb_sync_destroy_counter (xcb_connection_t *c /**< */,
461 xcb_sync_counter_t counter /**< */)
463 static const xcb_protocol_request_t xcb_req = {
464 /* count */ 2,
465 /* ext */ &xcb_sync_id,
466 /* opcode */ XCB_SYNC_DESTROY_COUNTER,
467 /* isvoid */ 1
470 struct iovec xcb_parts[4];
471 xcb_void_cookie_t xcb_ret;
472 xcb_sync_destroy_counter_request_t xcb_out;
474 xcb_out.counter = counter;
476 xcb_parts[2].iov_base = (char *) &xcb_out;
477 xcb_parts[2].iov_len = sizeof(xcb_out);
478 xcb_parts[3].iov_base = 0;
479 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
481 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
482 return xcb_ret;
485 xcb_sync_query_counter_cookie_t
486 xcb_sync_query_counter (xcb_connection_t *c /**< */,
487 xcb_sync_counter_t counter /**< */)
489 static const xcb_protocol_request_t xcb_req = {
490 /* count */ 2,
491 /* ext */ &xcb_sync_id,
492 /* opcode */ XCB_SYNC_QUERY_COUNTER,
493 /* isvoid */ 0
496 struct iovec xcb_parts[4];
497 xcb_sync_query_counter_cookie_t xcb_ret;
498 xcb_sync_query_counter_request_t xcb_out;
500 xcb_out.counter = counter;
502 xcb_parts[2].iov_base = (char *) &xcb_out;
503 xcb_parts[2].iov_len = sizeof(xcb_out);
504 xcb_parts[3].iov_base = 0;
505 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
507 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
508 return xcb_ret;
511 xcb_sync_query_counter_cookie_t
512 xcb_sync_query_counter_unchecked (xcb_connection_t *c /**< */,
513 xcb_sync_counter_t counter /**< */)
515 static const xcb_protocol_request_t xcb_req = {
516 /* count */ 2,
517 /* ext */ &xcb_sync_id,
518 /* opcode */ XCB_SYNC_QUERY_COUNTER,
519 /* isvoid */ 0
522 struct iovec xcb_parts[4];
523 xcb_sync_query_counter_cookie_t xcb_ret;
524 xcb_sync_query_counter_request_t xcb_out;
526 xcb_out.counter = counter;
528 xcb_parts[2].iov_base = (char *) &xcb_out;
529 xcb_parts[2].iov_len = sizeof(xcb_out);
530 xcb_parts[3].iov_base = 0;
531 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
533 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
534 return xcb_ret;
537 xcb_sync_query_counter_reply_t *
538 xcb_sync_query_counter_reply (xcb_connection_t *c /**< */,
539 xcb_sync_query_counter_cookie_t cookie /**< */,
540 xcb_generic_error_t **e /**< */)
542 return (xcb_sync_query_counter_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
546 xcb_sync_await_sizeof (const void *_buffer /**< */,
547 uint32_t wait_list_len /**< */)
549 char *xcb_tmp = (char *)_buffer;
550 unsigned int xcb_buffer_len = 0;
551 unsigned int xcb_block_len = 0;
552 unsigned int xcb_pad = 0;
553 unsigned int xcb_align_to = 0;
556 xcb_block_len += sizeof(xcb_sync_await_request_t);
557 xcb_tmp += xcb_block_len;
558 xcb_buffer_len += xcb_block_len;
559 xcb_block_len = 0;
560 /* wait_list */
561 xcb_block_len += wait_list_len * sizeof(xcb_sync_waitcondition_t);
562 xcb_tmp += xcb_block_len;
563 xcb_align_to = ALIGNOF(xcb_sync_waitcondition_t);
564 /* insert padding */
565 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
566 xcb_buffer_len += xcb_block_len + xcb_pad;
567 if (0 != xcb_pad) {
568 xcb_tmp += xcb_pad;
569 xcb_pad = 0;
571 xcb_block_len = 0;
573 return xcb_buffer_len;
576 xcb_void_cookie_t
577 xcb_sync_await_checked (xcb_connection_t *c /**< */,
578 uint32_t wait_list_len /**< */,
579 const xcb_sync_waitcondition_t *wait_list /**< */)
581 static const xcb_protocol_request_t xcb_req = {
582 /* count */ 4,
583 /* ext */ &xcb_sync_id,
584 /* opcode */ XCB_SYNC_AWAIT,
585 /* isvoid */ 1
588 struct iovec xcb_parts[6];
589 xcb_void_cookie_t xcb_ret;
590 xcb_sync_await_request_t xcb_out;
593 xcb_parts[2].iov_base = (char *) &xcb_out;
594 xcb_parts[2].iov_len = sizeof(xcb_out);
595 xcb_parts[3].iov_base = 0;
596 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
597 /* xcb_sync_waitcondition_t wait_list */
598 xcb_parts[4].iov_base = (char *) wait_list;
599 xcb_parts[4].iov_len = wait_list_len * sizeof(xcb_sync_waitcondition_t);
600 xcb_parts[5].iov_base = 0;
601 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
603 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
604 return xcb_ret;
607 xcb_void_cookie_t
608 xcb_sync_await (xcb_connection_t *c /**< */,
609 uint32_t wait_list_len /**< */,
610 const xcb_sync_waitcondition_t *wait_list /**< */)
612 static const xcb_protocol_request_t xcb_req = {
613 /* count */ 4,
614 /* ext */ &xcb_sync_id,
615 /* opcode */ XCB_SYNC_AWAIT,
616 /* isvoid */ 1
619 struct iovec xcb_parts[6];
620 xcb_void_cookie_t xcb_ret;
621 xcb_sync_await_request_t xcb_out;
624 xcb_parts[2].iov_base = (char *) &xcb_out;
625 xcb_parts[2].iov_len = sizeof(xcb_out);
626 xcb_parts[3].iov_base = 0;
627 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
628 /* xcb_sync_waitcondition_t wait_list */
629 xcb_parts[4].iov_base = (char *) wait_list;
630 xcb_parts[4].iov_len = wait_list_len * sizeof(xcb_sync_waitcondition_t);
631 xcb_parts[5].iov_base = 0;
632 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
634 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
635 return xcb_ret;
638 xcb_void_cookie_t
639 xcb_sync_change_counter_checked (xcb_connection_t *c /**< */,
640 xcb_sync_counter_t counter /**< */,
641 xcb_sync_int64_t amount /**< */)
643 static const xcb_protocol_request_t xcb_req = {
644 /* count */ 2,
645 /* ext */ &xcb_sync_id,
646 /* opcode */ XCB_SYNC_CHANGE_COUNTER,
647 /* isvoid */ 1
650 struct iovec xcb_parts[4];
651 xcb_void_cookie_t xcb_ret;
652 xcb_sync_change_counter_request_t xcb_out;
654 xcb_out.counter = counter;
655 xcb_out.amount = amount;
657 xcb_parts[2].iov_base = (char *) &xcb_out;
658 xcb_parts[2].iov_len = sizeof(xcb_out);
659 xcb_parts[3].iov_base = 0;
660 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
662 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
663 return xcb_ret;
666 xcb_void_cookie_t
667 xcb_sync_change_counter (xcb_connection_t *c /**< */,
668 xcb_sync_counter_t counter /**< */,
669 xcb_sync_int64_t amount /**< */)
671 static const xcb_protocol_request_t xcb_req = {
672 /* count */ 2,
673 /* ext */ &xcb_sync_id,
674 /* opcode */ XCB_SYNC_CHANGE_COUNTER,
675 /* isvoid */ 1
678 struct iovec xcb_parts[4];
679 xcb_void_cookie_t xcb_ret;
680 xcb_sync_change_counter_request_t xcb_out;
682 xcb_out.counter = counter;
683 xcb_out.amount = amount;
685 xcb_parts[2].iov_base = (char *) &xcb_out;
686 xcb_parts[2].iov_len = sizeof(xcb_out);
687 xcb_parts[3].iov_base = 0;
688 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
690 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
691 return xcb_ret;
694 xcb_void_cookie_t
695 xcb_sync_set_counter_checked (xcb_connection_t *c /**< */,
696 xcb_sync_counter_t counter /**< */,
697 xcb_sync_int64_t value /**< */)
699 static const xcb_protocol_request_t xcb_req = {
700 /* count */ 2,
701 /* ext */ &xcb_sync_id,
702 /* opcode */ XCB_SYNC_SET_COUNTER,
703 /* isvoid */ 1
706 struct iovec xcb_parts[4];
707 xcb_void_cookie_t xcb_ret;
708 xcb_sync_set_counter_request_t xcb_out;
710 xcb_out.counter = counter;
711 xcb_out.value = value;
713 xcb_parts[2].iov_base = (char *) &xcb_out;
714 xcb_parts[2].iov_len = sizeof(xcb_out);
715 xcb_parts[3].iov_base = 0;
716 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
718 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
719 return xcb_ret;
722 xcb_void_cookie_t
723 xcb_sync_set_counter (xcb_connection_t *c /**< */,
724 xcb_sync_counter_t counter /**< */,
725 xcb_sync_int64_t value /**< */)
727 static const xcb_protocol_request_t xcb_req = {
728 /* count */ 2,
729 /* ext */ &xcb_sync_id,
730 /* opcode */ XCB_SYNC_SET_COUNTER,
731 /* isvoid */ 1
734 struct iovec xcb_parts[4];
735 xcb_void_cookie_t xcb_ret;
736 xcb_sync_set_counter_request_t xcb_out;
738 xcb_out.counter = counter;
739 xcb_out.value = value;
741 xcb_parts[2].iov_base = (char *) &xcb_out;
742 xcb_parts[2].iov_len = sizeof(xcb_out);
743 xcb_parts[3].iov_base = 0;
744 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
746 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
747 return xcb_ret;
751 xcb_sync_create_alarm_value_list_serialize (void **_buffer /**< */,
752 uint32_t value_mask /**< */,
753 const xcb_sync_create_alarm_value_list_t *_aux /**< */)
755 char *xcb_out = *_buffer;
756 unsigned int xcb_buffer_len = 0;
757 unsigned int xcb_align_to = 0;
759 unsigned int xcb_pad = 0;
760 char xcb_pad0[3] = {0, 0, 0};
761 struct iovec xcb_parts[7];
762 unsigned int xcb_parts_idx = 0;
763 unsigned int xcb_block_len = 0;
764 unsigned int i;
765 char *xcb_tmp;
767 if(value_mask & XCB_SYNC_CA_COUNTER) {
768 /* xcb_sync_create_alarm_value_list_t.counter */
769 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->counter;
770 xcb_block_len += sizeof(xcb_sync_counter_t);
771 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_counter_t);
772 xcb_parts_idx++;
773 xcb_align_to = ALIGNOF(xcb_sync_counter_t);
775 if(value_mask & XCB_SYNC_CA_VALUE_TYPE) {
776 /* xcb_sync_create_alarm_value_list_t.valueType */
777 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valueType;
778 xcb_block_len += sizeof(uint32_t);
779 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
780 xcb_parts_idx++;
781 xcb_align_to = ALIGNOF(uint32_t);
783 if(value_mask & XCB_SYNC_CA_VALUE) {
784 /* xcb_sync_create_alarm_value_list_t.value */
785 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->value;
786 xcb_block_len += sizeof(xcb_sync_int64_t);
787 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t);
788 xcb_parts_idx++;
789 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
791 if(value_mask & XCB_SYNC_CA_TEST_TYPE) {
792 /* xcb_sync_create_alarm_value_list_t.testType */
793 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->testType;
794 xcb_block_len += sizeof(uint32_t);
795 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
796 xcb_parts_idx++;
797 xcb_align_to = ALIGNOF(uint32_t);
799 if(value_mask & XCB_SYNC_CA_DELTA) {
800 /* xcb_sync_create_alarm_value_list_t.delta */
801 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->delta;
802 xcb_block_len += sizeof(xcb_sync_int64_t);
803 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t);
804 xcb_parts_idx++;
805 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
807 if(value_mask & XCB_SYNC_CA_EVENTS) {
808 /* xcb_sync_create_alarm_value_list_t.events */
809 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->events;
810 xcb_block_len += sizeof(uint32_t);
811 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
812 xcb_parts_idx++;
813 xcb_align_to = ALIGNOF(uint32_t);
815 /* insert padding */
816 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
817 xcb_buffer_len += xcb_block_len + xcb_pad;
818 if (0 != xcb_pad) {
819 xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
820 xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
821 xcb_parts_idx++;
822 xcb_pad = 0;
824 xcb_block_len = 0;
826 if (NULL == xcb_out) {
827 /* allocate memory */
828 xcb_out = malloc(xcb_buffer_len);
829 *_buffer = xcb_out;
832 xcb_tmp = xcb_out;
833 for(i=0; i<xcb_parts_idx; i++) {
834 if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
835 memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
836 if (0 != xcb_parts[i].iov_len)
837 xcb_tmp += xcb_parts[i].iov_len;
840 return xcb_buffer_len;
844 xcb_sync_create_alarm_value_list_unpack (const void *_buffer /**< */,
845 uint32_t value_mask /**< */,
846 xcb_sync_create_alarm_value_list_t *_aux /**< */)
848 char *xcb_tmp = (char *)_buffer;
849 unsigned int xcb_buffer_len = 0;
850 unsigned int xcb_block_len = 0;
851 unsigned int xcb_pad = 0;
852 unsigned int xcb_align_to = 0;
855 if(value_mask & XCB_SYNC_CA_COUNTER) {
856 /* xcb_sync_create_alarm_value_list_t.counter */
857 _aux->counter = *(xcb_sync_counter_t *)xcb_tmp;
858 xcb_block_len += sizeof(xcb_sync_counter_t);
859 xcb_tmp += sizeof(xcb_sync_counter_t);
860 xcb_align_to = ALIGNOF(xcb_sync_counter_t);
862 if(value_mask & XCB_SYNC_CA_VALUE_TYPE) {
863 /* xcb_sync_create_alarm_value_list_t.valueType */
864 _aux->valueType = *(uint32_t *)xcb_tmp;
865 xcb_block_len += sizeof(uint32_t);
866 xcb_tmp += sizeof(uint32_t);
867 xcb_align_to = ALIGNOF(uint32_t);
869 if(value_mask & XCB_SYNC_CA_VALUE) {
870 /* xcb_sync_create_alarm_value_list_t.value */
871 _aux->value = *(xcb_sync_int64_t *)xcb_tmp;
872 xcb_block_len += sizeof(xcb_sync_int64_t);
873 xcb_tmp += sizeof(xcb_sync_int64_t);
874 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
876 if(value_mask & XCB_SYNC_CA_TEST_TYPE) {
877 /* xcb_sync_create_alarm_value_list_t.testType */
878 _aux->testType = *(uint32_t *)xcb_tmp;
879 xcb_block_len += sizeof(uint32_t);
880 xcb_tmp += sizeof(uint32_t);
881 xcb_align_to = ALIGNOF(uint32_t);
883 if(value_mask & XCB_SYNC_CA_DELTA) {
884 /* xcb_sync_create_alarm_value_list_t.delta */
885 _aux->delta = *(xcb_sync_int64_t *)xcb_tmp;
886 xcb_block_len += sizeof(xcb_sync_int64_t);
887 xcb_tmp += sizeof(xcb_sync_int64_t);
888 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
890 if(value_mask & XCB_SYNC_CA_EVENTS) {
891 /* xcb_sync_create_alarm_value_list_t.events */
892 _aux->events = *(uint32_t *)xcb_tmp;
893 xcb_block_len += sizeof(uint32_t);
894 xcb_tmp += sizeof(uint32_t);
895 xcb_align_to = ALIGNOF(uint32_t);
897 /* insert padding */
898 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
899 xcb_buffer_len += xcb_block_len + xcb_pad;
900 if (0 != xcb_pad) {
901 xcb_tmp += xcb_pad;
902 xcb_pad = 0;
904 xcb_block_len = 0;
906 return xcb_buffer_len;
910 xcb_sync_create_alarm_value_list_sizeof (const void *_buffer /**< */,
911 uint32_t value_mask /**< */)
913 xcb_sync_create_alarm_value_list_t _aux;
914 return xcb_sync_create_alarm_value_list_unpack(_buffer, value_mask, &_aux);
917 xcb_void_cookie_t
918 xcb_sync_create_alarm_checked (xcb_connection_t *c /**< */,
919 xcb_sync_alarm_t id /**< */,
920 uint32_t value_mask /**< */,
921 const void *value_list /**< */)
923 static const xcb_protocol_request_t xcb_req = {
924 /* count */ 3,
925 /* ext */ &xcb_sync_id,
926 /* opcode */ XCB_SYNC_CREATE_ALARM,
927 /* isvoid */ 1
930 struct iovec xcb_parts[5];
931 xcb_void_cookie_t xcb_ret;
932 xcb_sync_create_alarm_request_t xcb_out;
934 xcb_out.id = id;
935 xcb_out.value_mask = value_mask;
937 xcb_parts[2].iov_base = (char *) &xcb_out;
938 xcb_parts[2].iov_len = sizeof(xcb_out);
939 xcb_parts[3].iov_base = 0;
940 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
941 /* xcb_sync_create_alarm_value_list_t value_list */
942 xcb_parts[4].iov_base = (char *) value_list;
943 xcb_parts[4].iov_len =
944 xcb_sync_create_alarm_value_list_sizeof (value_list, value_mask);
946 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
947 return xcb_ret;
950 xcb_void_cookie_t
951 xcb_sync_create_alarm (xcb_connection_t *c /**< */,
952 xcb_sync_alarm_t id /**< */,
953 uint32_t value_mask /**< */,
954 const void *value_list /**< */)
956 static const xcb_protocol_request_t xcb_req = {
957 /* count */ 3,
958 /* ext */ &xcb_sync_id,
959 /* opcode */ XCB_SYNC_CREATE_ALARM,
960 /* isvoid */ 1
963 struct iovec xcb_parts[5];
964 xcb_void_cookie_t xcb_ret;
965 xcb_sync_create_alarm_request_t xcb_out;
967 xcb_out.id = id;
968 xcb_out.value_mask = value_mask;
970 xcb_parts[2].iov_base = (char *) &xcb_out;
971 xcb_parts[2].iov_len = sizeof(xcb_out);
972 xcb_parts[3].iov_base = 0;
973 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
974 /* xcb_sync_create_alarm_value_list_t value_list */
975 xcb_parts[4].iov_base = (char *) value_list;
976 xcb_parts[4].iov_len =
977 xcb_sync_create_alarm_value_list_sizeof (value_list, value_mask);
979 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
980 return xcb_ret;
983 xcb_void_cookie_t
984 xcb_sync_create_alarm_aux_checked (xcb_connection_t *c /**< */,
985 xcb_sync_alarm_t id /**< */,
986 uint32_t value_mask /**< */,
987 const xcb_sync_create_alarm_value_list_t *value_list /**< */)
989 static const xcb_protocol_request_t xcb_req = {
990 /* count */ 3,
991 /* ext */ &xcb_sync_id,
992 /* opcode */ XCB_SYNC_CREATE_ALARM,
993 /* isvoid */ 1
996 struct iovec xcb_parts[5];
997 xcb_void_cookie_t xcb_ret;
998 xcb_sync_create_alarm_request_t xcb_out;
999 void *xcb_aux0 = 0;
1001 xcb_out.id = id;
1002 xcb_out.value_mask = value_mask;
1004 xcb_parts[2].iov_base = (char *) &xcb_out;
1005 xcb_parts[2].iov_len = sizeof(xcb_out);
1006 xcb_parts[3].iov_base = 0;
1007 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1008 /* xcb_sync_create_alarm_value_list_t value_list */
1009 xcb_parts[4].iov_len =
1010 xcb_sync_create_alarm_value_list_serialize (&xcb_aux0, value_mask, value_list);
1011 xcb_parts[4].iov_base = xcb_aux0;
1013 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1014 free(xcb_aux0);
1015 return xcb_ret;
1018 xcb_void_cookie_t
1019 xcb_sync_create_alarm_aux (xcb_connection_t *c /**< */,
1020 xcb_sync_alarm_t id /**< */,
1021 uint32_t value_mask /**< */,
1022 const xcb_sync_create_alarm_value_list_t *value_list /**< */)
1024 static const xcb_protocol_request_t xcb_req = {
1025 /* count */ 3,
1026 /* ext */ &xcb_sync_id,
1027 /* opcode */ XCB_SYNC_CREATE_ALARM,
1028 /* isvoid */ 1
1031 struct iovec xcb_parts[5];
1032 xcb_void_cookie_t xcb_ret;
1033 xcb_sync_create_alarm_request_t xcb_out;
1034 void *xcb_aux0 = 0;
1036 xcb_out.id = id;
1037 xcb_out.value_mask = value_mask;
1039 xcb_parts[2].iov_base = (char *) &xcb_out;
1040 xcb_parts[2].iov_len = sizeof(xcb_out);
1041 xcb_parts[3].iov_base = 0;
1042 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1043 /* xcb_sync_create_alarm_value_list_t value_list */
1044 xcb_parts[4].iov_len =
1045 xcb_sync_create_alarm_value_list_serialize (&xcb_aux0, value_mask, value_list);
1046 xcb_parts[4].iov_base = xcb_aux0;
1048 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1049 free(xcb_aux0);
1050 return xcb_ret;
1054 xcb_sync_change_alarm_value_list_serialize (void **_buffer /**< */,
1055 uint32_t value_mask /**< */,
1056 const xcb_sync_change_alarm_value_list_t *_aux /**< */)
1058 char *xcb_out = *_buffer;
1059 unsigned int xcb_buffer_len = 0;
1060 unsigned int xcb_align_to = 0;
1062 unsigned int xcb_pad = 0;
1063 char xcb_pad0[3] = {0, 0, 0};
1064 struct iovec xcb_parts[7];
1065 unsigned int xcb_parts_idx = 0;
1066 unsigned int xcb_block_len = 0;
1067 unsigned int i;
1068 char *xcb_tmp;
1070 if(value_mask & XCB_SYNC_CA_COUNTER) {
1071 /* xcb_sync_change_alarm_value_list_t.counter */
1072 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->counter;
1073 xcb_block_len += sizeof(xcb_sync_counter_t);
1074 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_counter_t);
1075 xcb_parts_idx++;
1076 xcb_align_to = ALIGNOF(xcb_sync_counter_t);
1078 if(value_mask & XCB_SYNC_CA_VALUE_TYPE) {
1079 /* xcb_sync_change_alarm_value_list_t.valueType */
1080 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->valueType;
1081 xcb_block_len += sizeof(uint32_t);
1082 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
1083 xcb_parts_idx++;
1084 xcb_align_to = ALIGNOF(uint32_t);
1086 if(value_mask & XCB_SYNC_CA_VALUE) {
1087 /* xcb_sync_change_alarm_value_list_t.value */
1088 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->value;
1089 xcb_block_len += sizeof(xcb_sync_int64_t);
1090 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t);
1091 xcb_parts_idx++;
1092 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
1094 if(value_mask & XCB_SYNC_CA_TEST_TYPE) {
1095 /* xcb_sync_change_alarm_value_list_t.testType */
1096 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->testType;
1097 xcb_block_len += sizeof(uint32_t);
1098 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
1099 xcb_parts_idx++;
1100 xcb_align_to = ALIGNOF(uint32_t);
1102 if(value_mask & XCB_SYNC_CA_DELTA) {
1103 /* xcb_sync_change_alarm_value_list_t.delta */
1104 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->delta;
1105 xcb_block_len += sizeof(xcb_sync_int64_t);
1106 xcb_parts[xcb_parts_idx].iov_len = sizeof(xcb_sync_int64_t);
1107 xcb_parts_idx++;
1108 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
1110 if(value_mask & XCB_SYNC_CA_EVENTS) {
1111 /* xcb_sync_change_alarm_value_list_t.events */
1112 xcb_parts[xcb_parts_idx].iov_base = (char *) &_aux->events;
1113 xcb_block_len += sizeof(uint32_t);
1114 xcb_parts[xcb_parts_idx].iov_len = sizeof(uint32_t);
1115 xcb_parts_idx++;
1116 xcb_align_to = ALIGNOF(uint32_t);
1118 /* insert padding */
1119 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1120 xcb_buffer_len += xcb_block_len + xcb_pad;
1121 if (0 != xcb_pad) {
1122 xcb_parts[xcb_parts_idx].iov_base = xcb_pad0;
1123 xcb_parts[xcb_parts_idx].iov_len = xcb_pad;
1124 xcb_parts_idx++;
1125 xcb_pad = 0;
1127 xcb_block_len = 0;
1129 if (NULL == xcb_out) {
1130 /* allocate memory */
1131 xcb_out = malloc(xcb_buffer_len);
1132 *_buffer = xcb_out;
1135 xcb_tmp = xcb_out;
1136 for(i=0; i<xcb_parts_idx; i++) {
1137 if (0 != xcb_parts[i].iov_base && 0 != xcb_parts[i].iov_len)
1138 memcpy(xcb_tmp, xcb_parts[i].iov_base, xcb_parts[i].iov_len);
1139 if (0 != xcb_parts[i].iov_len)
1140 xcb_tmp += xcb_parts[i].iov_len;
1143 return xcb_buffer_len;
1147 xcb_sync_change_alarm_value_list_unpack (const void *_buffer /**< */,
1148 uint32_t value_mask /**< */,
1149 xcb_sync_change_alarm_value_list_t *_aux /**< */)
1151 char *xcb_tmp = (char *)_buffer;
1152 unsigned int xcb_buffer_len = 0;
1153 unsigned int xcb_block_len = 0;
1154 unsigned int xcb_pad = 0;
1155 unsigned int xcb_align_to = 0;
1158 if(value_mask & XCB_SYNC_CA_COUNTER) {
1159 /* xcb_sync_change_alarm_value_list_t.counter */
1160 _aux->counter = *(xcb_sync_counter_t *)xcb_tmp;
1161 xcb_block_len += sizeof(xcb_sync_counter_t);
1162 xcb_tmp += sizeof(xcb_sync_counter_t);
1163 xcb_align_to = ALIGNOF(xcb_sync_counter_t);
1165 if(value_mask & XCB_SYNC_CA_VALUE_TYPE) {
1166 /* xcb_sync_change_alarm_value_list_t.valueType */
1167 _aux->valueType = *(uint32_t *)xcb_tmp;
1168 xcb_block_len += sizeof(uint32_t);
1169 xcb_tmp += sizeof(uint32_t);
1170 xcb_align_to = ALIGNOF(uint32_t);
1172 if(value_mask & XCB_SYNC_CA_VALUE) {
1173 /* xcb_sync_change_alarm_value_list_t.value */
1174 _aux->value = *(xcb_sync_int64_t *)xcb_tmp;
1175 xcb_block_len += sizeof(xcb_sync_int64_t);
1176 xcb_tmp += sizeof(xcb_sync_int64_t);
1177 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
1179 if(value_mask & XCB_SYNC_CA_TEST_TYPE) {
1180 /* xcb_sync_change_alarm_value_list_t.testType */
1181 _aux->testType = *(uint32_t *)xcb_tmp;
1182 xcb_block_len += sizeof(uint32_t);
1183 xcb_tmp += sizeof(uint32_t);
1184 xcb_align_to = ALIGNOF(uint32_t);
1186 if(value_mask & XCB_SYNC_CA_DELTA) {
1187 /* xcb_sync_change_alarm_value_list_t.delta */
1188 _aux->delta = *(xcb_sync_int64_t *)xcb_tmp;
1189 xcb_block_len += sizeof(xcb_sync_int64_t);
1190 xcb_tmp += sizeof(xcb_sync_int64_t);
1191 xcb_align_to = ALIGNOF(xcb_sync_int64_t);
1193 if(value_mask & XCB_SYNC_CA_EVENTS) {
1194 /* xcb_sync_change_alarm_value_list_t.events */
1195 _aux->events = *(uint32_t *)xcb_tmp;
1196 xcb_block_len += sizeof(uint32_t);
1197 xcb_tmp += sizeof(uint32_t);
1198 xcb_align_to = ALIGNOF(uint32_t);
1200 /* insert padding */
1201 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1202 xcb_buffer_len += xcb_block_len + xcb_pad;
1203 if (0 != xcb_pad) {
1204 xcb_tmp += xcb_pad;
1205 xcb_pad = 0;
1207 xcb_block_len = 0;
1209 return xcb_buffer_len;
1213 xcb_sync_change_alarm_value_list_sizeof (const void *_buffer /**< */,
1214 uint32_t value_mask /**< */)
1216 xcb_sync_change_alarm_value_list_t _aux;
1217 return xcb_sync_change_alarm_value_list_unpack(_buffer, value_mask, &_aux);
1220 xcb_void_cookie_t
1221 xcb_sync_change_alarm_checked (xcb_connection_t *c /**< */,
1222 xcb_sync_alarm_t id /**< */,
1223 uint32_t value_mask /**< */,
1224 const void *value_list /**< */)
1226 static const xcb_protocol_request_t xcb_req = {
1227 /* count */ 3,
1228 /* ext */ &xcb_sync_id,
1229 /* opcode */ XCB_SYNC_CHANGE_ALARM,
1230 /* isvoid */ 1
1233 struct iovec xcb_parts[5];
1234 xcb_void_cookie_t xcb_ret;
1235 xcb_sync_change_alarm_request_t xcb_out;
1237 xcb_out.id = id;
1238 xcb_out.value_mask = value_mask;
1240 xcb_parts[2].iov_base = (char *) &xcb_out;
1241 xcb_parts[2].iov_len = sizeof(xcb_out);
1242 xcb_parts[3].iov_base = 0;
1243 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1244 /* xcb_sync_change_alarm_value_list_t value_list */
1245 xcb_parts[4].iov_base = (char *) value_list;
1246 xcb_parts[4].iov_len =
1247 xcb_sync_change_alarm_value_list_sizeof (value_list, value_mask);
1249 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1250 return xcb_ret;
1253 xcb_void_cookie_t
1254 xcb_sync_change_alarm (xcb_connection_t *c /**< */,
1255 xcb_sync_alarm_t id /**< */,
1256 uint32_t value_mask /**< */,
1257 const void *value_list /**< */)
1259 static const xcb_protocol_request_t xcb_req = {
1260 /* count */ 3,
1261 /* ext */ &xcb_sync_id,
1262 /* opcode */ XCB_SYNC_CHANGE_ALARM,
1263 /* isvoid */ 1
1266 struct iovec xcb_parts[5];
1267 xcb_void_cookie_t xcb_ret;
1268 xcb_sync_change_alarm_request_t xcb_out;
1270 xcb_out.id = id;
1271 xcb_out.value_mask = value_mask;
1273 xcb_parts[2].iov_base = (char *) &xcb_out;
1274 xcb_parts[2].iov_len = sizeof(xcb_out);
1275 xcb_parts[3].iov_base = 0;
1276 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1277 /* xcb_sync_change_alarm_value_list_t value_list */
1278 xcb_parts[4].iov_base = (char *) value_list;
1279 xcb_parts[4].iov_len =
1280 xcb_sync_change_alarm_value_list_sizeof (value_list, value_mask);
1282 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1283 return xcb_ret;
1286 xcb_void_cookie_t
1287 xcb_sync_change_alarm_aux_checked (xcb_connection_t *c /**< */,
1288 xcb_sync_alarm_t id /**< */,
1289 uint32_t value_mask /**< */,
1290 const xcb_sync_change_alarm_value_list_t *value_list /**< */)
1292 static const xcb_protocol_request_t xcb_req = {
1293 /* count */ 3,
1294 /* ext */ &xcb_sync_id,
1295 /* opcode */ XCB_SYNC_CHANGE_ALARM,
1296 /* isvoid */ 1
1299 struct iovec xcb_parts[5];
1300 xcb_void_cookie_t xcb_ret;
1301 xcb_sync_change_alarm_request_t xcb_out;
1302 void *xcb_aux0 = 0;
1304 xcb_out.id = id;
1305 xcb_out.value_mask = value_mask;
1307 xcb_parts[2].iov_base = (char *) &xcb_out;
1308 xcb_parts[2].iov_len = sizeof(xcb_out);
1309 xcb_parts[3].iov_base = 0;
1310 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1311 /* xcb_sync_change_alarm_value_list_t value_list */
1312 xcb_parts[4].iov_len =
1313 xcb_sync_change_alarm_value_list_serialize (&xcb_aux0, value_mask, value_list);
1314 xcb_parts[4].iov_base = xcb_aux0;
1316 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1317 free(xcb_aux0);
1318 return xcb_ret;
1321 xcb_void_cookie_t
1322 xcb_sync_change_alarm_aux (xcb_connection_t *c /**< */,
1323 xcb_sync_alarm_t id /**< */,
1324 uint32_t value_mask /**< */,
1325 const xcb_sync_change_alarm_value_list_t *value_list /**< */)
1327 static const xcb_protocol_request_t xcb_req = {
1328 /* count */ 3,
1329 /* ext */ &xcb_sync_id,
1330 /* opcode */ XCB_SYNC_CHANGE_ALARM,
1331 /* isvoid */ 1
1334 struct iovec xcb_parts[5];
1335 xcb_void_cookie_t xcb_ret;
1336 xcb_sync_change_alarm_request_t xcb_out;
1337 void *xcb_aux0 = 0;
1339 xcb_out.id = id;
1340 xcb_out.value_mask = value_mask;
1342 xcb_parts[2].iov_base = (char *) &xcb_out;
1343 xcb_parts[2].iov_len = sizeof(xcb_out);
1344 xcb_parts[3].iov_base = 0;
1345 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1346 /* xcb_sync_change_alarm_value_list_t value_list */
1347 xcb_parts[4].iov_len =
1348 xcb_sync_change_alarm_value_list_serialize (&xcb_aux0, value_mask, value_list);
1349 xcb_parts[4].iov_base = xcb_aux0;
1351 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1352 free(xcb_aux0);
1353 return xcb_ret;
1356 xcb_void_cookie_t
1357 xcb_sync_destroy_alarm_checked (xcb_connection_t *c /**< */,
1358 xcb_sync_alarm_t alarm /**< */)
1360 static const xcb_protocol_request_t xcb_req = {
1361 /* count */ 2,
1362 /* ext */ &xcb_sync_id,
1363 /* opcode */ XCB_SYNC_DESTROY_ALARM,
1364 /* isvoid */ 1
1367 struct iovec xcb_parts[4];
1368 xcb_void_cookie_t xcb_ret;
1369 xcb_sync_destroy_alarm_request_t xcb_out;
1371 xcb_out.alarm = alarm;
1373 xcb_parts[2].iov_base = (char *) &xcb_out;
1374 xcb_parts[2].iov_len = sizeof(xcb_out);
1375 xcb_parts[3].iov_base = 0;
1376 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1378 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1379 return xcb_ret;
1382 xcb_void_cookie_t
1383 xcb_sync_destroy_alarm (xcb_connection_t *c /**< */,
1384 xcb_sync_alarm_t alarm /**< */)
1386 static const xcb_protocol_request_t xcb_req = {
1387 /* count */ 2,
1388 /* ext */ &xcb_sync_id,
1389 /* opcode */ XCB_SYNC_DESTROY_ALARM,
1390 /* isvoid */ 1
1393 struct iovec xcb_parts[4];
1394 xcb_void_cookie_t xcb_ret;
1395 xcb_sync_destroy_alarm_request_t xcb_out;
1397 xcb_out.alarm = alarm;
1399 xcb_parts[2].iov_base = (char *) &xcb_out;
1400 xcb_parts[2].iov_len = sizeof(xcb_out);
1401 xcb_parts[3].iov_base = 0;
1402 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1404 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1405 return xcb_ret;
1408 xcb_sync_query_alarm_cookie_t
1409 xcb_sync_query_alarm (xcb_connection_t *c /**< */,
1410 xcb_sync_alarm_t alarm /**< */)
1412 static const xcb_protocol_request_t xcb_req = {
1413 /* count */ 2,
1414 /* ext */ &xcb_sync_id,
1415 /* opcode */ XCB_SYNC_QUERY_ALARM,
1416 /* isvoid */ 0
1419 struct iovec xcb_parts[4];
1420 xcb_sync_query_alarm_cookie_t xcb_ret;
1421 xcb_sync_query_alarm_request_t xcb_out;
1423 xcb_out.alarm = alarm;
1425 xcb_parts[2].iov_base = (char *) &xcb_out;
1426 xcb_parts[2].iov_len = sizeof(xcb_out);
1427 xcb_parts[3].iov_base = 0;
1428 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1430 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1431 return xcb_ret;
1434 xcb_sync_query_alarm_cookie_t
1435 xcb_sync_query_alarm_unchecked (xcb_connection_t *c /**< */,
1436 xcb_sync_alarm_t alarm /**< */)
1438 static const xcb_protocol_request_t xcb_req = {
1439 /* count */ 2,
1440 /* ext */ &xcb_sync_id,
1441 /* opcode */ XCB_SYNC_QUERY_ALARM,
1442 /* isvoid */ 0
1445 struct iovec xcb_parts[4];
1446 xcb_sync_query_alarm_cookie_t xcb_ret;
1447 xcb_sync_query_alarm_request_t xcb_out;
1449 xcb_out.alarm = alarm;
1451 xcb_parts[2].iov_base = (char *) &xcb_out;
1452 xcb_parts[2].iov_len = sizeof(xcb_out);
1453 xcb_parts[3].iov_base = 0;
1454 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1456 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1457 return xcb_ret;
1460 xcb_sync_query_alarm_reply_t *
1461 xcb_sync_query_alarm_reply (xcb_connection_t *c /**< */,
1462 xcb_sync_query_alarm_cookie_t cookie /**< */,
1463 xcb_generic_error_t **e /**< */)
1465 return (xcb_sync_query_alarm_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1468 xcb_void_cookie_t
1469 xcb_sync_set_priority_checked (xcb_connection_t *c /**< */,
1470 uint32_t id /**< */,
1471 int32_t priority /**< */)
1473 static const xcb_protocol_request_t xcb_req = {
1474 /* count */ 2,
1475 /* ext */ &xcb_sync_id,
1476 /* opcode */ XCB_SYNC_SET_PRIORITY,
1477 /* isvoid */ 1
1480 struct iovec xcb_parts[4];
1481 xcb_void_cookie_t xcb_ret;
1482 xcb_sync_set_priority_request_t xcb_out;
1484 xcb_out.id = id;
1485 xcb_out.priority = priority;
1487 xcb_parts[2].iov_base = (char *) &xcb_out;
1488 xcb_parts[2].iov_len = sizeof(xcb_out);
1489 xcb_parts[3].iov_base = 0;
1490 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1492 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1493 return xcb_ret;
1496 xcb_void_cookie_t
1497 xcb_sync_set_priority (xcb_connection_t *c /**< */,
1498 uint32_t id /**< */,
1499 int32_t priority /**< */)
1501 static const xcb_protocol_request_t xcb_req = {
1502 /* count */ 2,
1503 /* ext */ &xcb_sync_id,
1504 /* opcode */ XCB_SYNC_SET_PRIORITY,
1505 /* isvoid */ 1
1508 struct iovec xcb_parts[4];
1509 xcb_void_cookie_t xcb_ret;
1510 xcb_sync_set_priority_request_t xcb_out;
1512 xcb_out.id = id;
1513 xcb_out.priority = priority;
1515 xcb_parts[2].iov_base = (char *) &xcb_out;
1516 xcb_parts[2].iov_len = sizeof(xcb_out);
1517 xcb_parts[3].iov_base = 0;
1518 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1520 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1521 return xcb_ret;
1524 xcb_sync_get_priority_cookie_t
1525 xcb_sync_get_priority (xcb_connection_t *c /**< */,
1526 uint32_t id /**< */)
1528 static const xcb_protocol_request_t xcb_req = {
1529 /* count */ 2,
1530 /* ext */ &xcb_sync_id,
1531 /* opcode */ XCB_SYNC_GET_PRIORITY,
1532 /* isvoid */ 0
1535 struct iovec xcb_parts[4];
1536 xcb_sync_get_priority_cookie_t xcb_ret;
1537 xcb_sync_get_priority_request_t xcb_out;
1539 xcb_out.id = id;
1541 xcb_parts[2].iov_base = (char *) &xcb_out;
1542 xcb_parts[2].iov_len = sizeof(xcb_out);
1543 xcb_parts[3].iov_base = 0;
1544 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1546 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1547 return xcb_ret;
1550 xcb_sync_get_priority_cookie_t
1551 xcb_sync_get_priority_unchecked (xcb_connection_t *c /**< */,
1552 uint32_t id /**< */)
1554 static const xcb_protocol_request_t xcb_req = {
1555 /* count */ 2,
1556 /* ext */ &xcb_sync_id,
1557 /* opcode */ XCB_SYNC_GET_PRIORITY,
1558 /* isvoid */ 0
1561 struct iovec xcb_parts[4];
1562 xcb_sync_get_priority_cookie_t xcb_ret;
1563 xcb_sync_get_priority_request_t xcb_out;
1565 xcb_out.id = id;
1567 xcb_parts[2].iov_base = (char *) &xcb_out;
1568 xcb_parts[2].iov_len = sizeof(xcb_out);
1569 xcb_parts[3].iov_base = 0;
1570 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1572 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1573 return xcb_ret;
1576 xcb_sync_get_priority_reply_t *
1577 xcb_sync_get_priority_reply (xcb_connection_t *c /**< */,
1578 xcb_sync_get_priority_cookie_t cookie /**< */,
1579 xcb_generic_error_t **e /**< */)
1581 return (xcb_sync_get_priority_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1584 xcb_void_cookie_t
1585 xcb_sync_create_fence_checked (xcb_connection_t *c /**< */,
1586 xcb_drawable_t drawable /**< */,
1587 xcb_sync_fence_t fence /**< */,
1588 uint8_t initially_triggered /**< */)
1590 static const xcb_protocol_request_t xcb_req = {
1591 /* count */ 2,
1592 /* ext */ &xcb_sync_id,
1593 /* opcode */ XCB_SYNC_CREATE_FENCE,
1594 /* isvoid */ 1
1597 struct iovec xcb_parts[4];
1598 xcb_void_cookie_t xcb_ret;
1599 xcb_sync_create_fence_request_t xcb_out;
1601 xcb_out.drawable = drawable;
1602 xcb_out.fence = fence;
1603 xcb_out.initially_triggered = initially_triggered;
1605 xcb_parts[2].iov_base = (char *) &xcb_out;
1606 xcb_parts[2].iov_len = sizeof(xcb_out);
1607 xcb_parts[3].iov_base = 0;
1608 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1610 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1611 return xcb_ret;
1614 xcb_void_cookie_t
1615 xcb_sync_create_fence (xcb_connection_t *c /**< */,
1616 xcb_drawable_t drawable /**< */,
1617 xcb_sync_fence_t fence /**< */,
1618 uint8_t initially_triggered /**< */)
1620 static const xcb_protocol_request_t xcb_req = {
1621 /* count */ 2,
1622 /* ext */ &xcb_sync_id,
1623 /* opcode */ XCB_SYNC_CREATE_FENCE,
1624 /* isvoid */ 1
1627 struct iovec xcb_parts[4];
1628 xcb_void_cookie_t xcb_ret;
1629 xcb_sync_create_fence_request_t xcb_out;
1631 xcb_out.drawable = drawable;
1632 xcb_out.fence = fence;
1633 xcb_out.initially_triggered = initially_triggered;
1635 xcb_parts[2].iov_base = (char *) &xcb_out;
1636 xcb_parts[2].iov_len = sizeof(xcb_out);
1637 xcb_parts[3].iov_base = 0;
1638 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1640 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1641 return xcb_ret;
1644 xcb_void_cookie_t
1645 xcb_sync_trigger_fence_checked (xcb_connection_t *c /**< */,
1646 xcb_sync_fence_t fence /**< */)
1648 static const xcb_protocol_request_t xcb_req = {
1649 /* count */ 2,
1650 /* ext */ &xcb_sync_id,
1651 /* opcode */ XCB_SYNC_TRIGGER_FENCE,
1652 /* isvoid */ 1
1655 struct iovec xcb_parts[4];
1656 xcb_void_cookie_t xcb_ret;
1657 xcb_sync_trigger_fence_request_t xcb_out;
1659 xcb_out.fence = fence;
1661 xcb_parts[2].iov_base = (char *) &xcb_out;
1662 xcb_parts[2].iov_len = sizeof(xcb_out);
1663 xcb_parts[3].iov_base = 0;
1664 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1666 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1667 return xcb_ret;
1670 xcb_void_cookie_t
1671 xcb_sync_trigger_fence (xcb_connection_t *c /**< */,
1672 xcb_sync_fence_t fence /**< */)
1674 static const xcb_protocol_request_t xcb_req = {
1675 /* count */ 2,
1676 /* ext */ &xcb_sync_id,
1677 /* opcode */ XCB_SYNC_TRIGGER_FENCE,
1678 /* isvoid */ 1
1681 struct iovec xcb_parts[4];
1682 xcb_void_cookie_t xcb_ret;
1683 xcb_sync_trigger_fence_request_t xcb_out;
1685 xcb_out.fence = fence;
1687 xcb_parts[2].iov_base = (char *) &xcb_out;
1688 xcb_parts[2].iov_len = sizeof(xcb_out);
1689 xcb_parts[3].iov_base = 0;
1690 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1692 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1693 return xcb_ret;
1696 xcb_void_cookie_t
1697 xcb_sync_reset_fence_checked (xcb_connection_t *c /**< */,
1698 xcb_sync_fence_t fence /**< */)
1700 static const xcb_protocol_request_t xcb_req = {
1701 /* count */ 2,
1702 /* ext */ &xcb_sync_id,
1703 /* opcode */ XCB_SYNC_RESET_FENCE,
1704 /* isvoid */ 1
1707 struct iovec xcb_parts[4];
1708 xcb_void_cookie_t xcb_ret;
1709 xcb_sync_reset_fence_request_t xcb_out;
1711 xcb_out.fence = fence;
1713 xcb_parts[2].iov_base = (char *) &xcb_out;
1714 xcb_parts[2].iov_len = sizeof(xcb_out);
1715 xcb_parts[3].iov_base = 0;
1716 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1718 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1719 return xcb_ret;
1722 xcb_void_cookie_t
1723 xcb_sync_reset_fence (xcb_connection_t *c /**< */,
1724 xcb_sync_fence_t fence /**< */)
1726 static const xcb_protocol_request_t xcb_req = {
1727 /* count */ 2,
1728 /* ext */ &xcb_sync_id,
1729 /* opcode */ XCB_SYNC_RESET_FENCE,
1730 /* isvoid */ 1
1733 struct iovec xcb_parts[4];
1734 xcb_void_cookie_t xcb_ret;
1735 xcb_sync_reset_fence_request_t xcb_out;
1737 xcb_out.fence = fence;
1739 xcb_parts[2].iov_base = (char *) &xcb_out;
1740 xcb_parts[2].iov_len = sizeof(xcb_out);
1741 xcb_parts[3].iov_base = 0;
1742 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1744 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1745 return xcb_ret;
1748 xcb_void_cookie_t
1749 xcb_sync_destroy_fence_checked (xcb_connection_t *c /**< */,
1750 xcb_sync_fence_t fence /**< */)
1752 static const xcb_protocol_request_t xcb_req = {
1753 /* count */ 2,
1754 /* ext */ &xcb_sync_id,
1755 /* opcode */ XCB_SYNC_DESTROY_FENCE,
1756 /* isvoid */ 1
1759 struct iovec xcb_parts[4];
1760 xcb_void_cookie_t xcb_ret;
1761 xcb_sync_destroy_fence_request_t xcb_out;
1763 xcb_out.fence = fence;
1765 xcb_parts[2].iov_base = (char *) &xcb_out;
1766 xcb_parts[2].iov_len = sizeof(xcb_out);
1767 xcb_parts[3].iov_base = 0;
1768 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1770 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1771 return xcb_ret;
1774 xcb_void_cookie_t
1775 xcb_sync_destroy_fence (xcb_connection_t *c /**< */,
1776 xcb_sync_fence_t fence /**< */)
1778 static const xcb_protocol_request_t xcb_req = {
1779 /* count */ 2,
1780 /* ext */ &xcb_sync_id,
1781 /* opcode */ XCB_SYNC_DESTROY_FENCE,
1782 /* isvoid */ 1
1785 struct iovec xcb_parts[4];
1786 xcb_void_cookie_t xcb_ret;
1787 xcb_sync_destroy_fence_request_t xcb_out;
1789 xcb_out.fence = fence;
1791 xcb_parts[2].iov_base = (char *) &xcb_out;
1792 xcb_parts[2].iov_len = sizeof(xcb_out);
1793 xcb_parts[3].iov_base = 0;
1794 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1796 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1797 return xcb_ret;
1800 xcb_sync_query_fence_cookie_t
1801 xcb_sync_query_fence (xcb_connection_t *c /**< */,
1802 xcb_sync_fence_t fence /**< */)
1804 static const xcb_protocol_request_t xcb_req = {
1805 /* count */ 2,
1806 /* ext */ &xcb_sync_id,
1807 /* opcode */ XCB_SYNC_QUERY_FENCE,
1808 /* isvoid */ 0
1811 struct iovec xcb_parts[4];
1812 xcb_sync_query_fence_cookie_t xcb_ret;
1813 xcb_sync_query_fence_request_t xcb_out;
1815 xcb_out.fence = fence;
1817 xcb_parts[2].iov_base = (char *) &xcb_out;
1818 xcb_parts[2].iov_len = sizeof(xcb_out);
1819 xcb_parts[3].iov_base = 0;
1820 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1822 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1823 return xcb_ret;
1826 xcb_sync_query_fence_cookie_t
1827 xcb_sync_query_fence_unchecked (xcb_connection_t *c /**< */,
1828 xcb_sync_fence_t fence /**< */)
1830 static const xcb_protocol_request_t xcb_req = {
1831 /* count */ 2,
1832 /* ext */ &xcb_sync_id,
1833 /* opcode */ XCB_SYNC_QUERY_FENCE,
1834 /* isvoid */ 0
1837 struct iovec xcb_parts[4];
1838 xcb_sync_query_fence_cookie_t xcb_ret;
1839 xcb_sync_query_fence_request_t xcb_out;
1841 xcb_out.fence = fence;
1843 xcb_parts[2].iov_base = (char *) &xcb_out;
1844 xcb_parts[2].iov_len = sizeof(xcb_out);
1845 xcb_parts[3].iov_base = 0;
1846 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1848 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1849 return xcb_ret;
1852 xcb_sync_query_fence_reply_t *
1853 xcb_sync_query_fence_reply (xcb_connection_t *c /**< */,
1854 xcb_sync_query_fence_cookie_t cookie /**< */,
1855 xcb_generic_error_t **e /**< */)
1857 return (xcb_sync_query_fence_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1861 xcb_sync_await_fence_sizeof (const void *_buffer /**< */,
1862 uint32_t fence_list_len /**< */)
1864 char *xcb_tmp = (char *)_buffer;
1865 unsigned int xcb_buffer_len = 0;
1866 unsigned int xcb_block_len = 0;
1867 unsigned int xcb_pad = 0;
1868 unsigned int xcb_align_to = 0;
1871 xcb_block_len += sizeof(xcb_sync_await_fence_request_t);
1872 xcb_tmp += xcb_block_len;
1873 xcb_buffer_len += xcb_block_len;
1874 xcb_block_len = 0;
1875 /* fence_list */
1876 xcb_block_len += fence_list_len * sizeof(xcb_sync_fence_t);
1877 xcb_tmp += xcb_block_len;
1878 xcb_align_to = ALIGNOF(xcb_sync_fence_t);
1879 /* insert padding */
1880 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1881 xcb_buffer_len += xcb_block_len + xcb_pad;
1882 if (0 != xcb_pad) {
1883 xcb_tmp += xcb_pad;
1884 xcb_pad = 0;
1886 xcb_block_len = 0;
1888 return xcb_buffer_len;
1891 xcb_void_cookie_t
1892 xcb_sync_await_fence_checked (xcb_connection_t *c /**< */,
1893 uint32_t fence_list_len /**< */,
1894 const xcb_sync_fence_t *fence_list /**< */)
1896 static const xcb_protocol_request_t xcb_req = {
1897 /* count */ 4,
1898 /* ext */ &xcb_sync_id,
1899 /* opcode */ XCB_SYNC_AWAIT_FENCE,
1900 /* isvoid */ 1
1903 struct iovec xcb_parts[6];
1904 xcb_void_cookie_t xcb_ret;
1905 xcb_sync_await_fence_request_t xcb_out;
1908 xcb_parts[2].iov_base = (char *) &xcb_out;
1909 xcb_parts[2].iov_len = sizeof(xcb_out);
1910 xcb_parts[3].iov_base = 0;
1911 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1912 /* xcb_sync_fence_t fence_list */
1913 xcb_parts[4].iov_base = (char *) fence_list;
1914 xcb_parts[4].iov_len = fence_list_len * sizeof(xcb_sync_fence_t);
1915 xcb_parts[5].iov_base = 0;
1916 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1918 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1919 return xcb_ret;
1922 xcb_void_cookie_t
1923 xcb_sync_await_fence (xcb_connection_t *c /**< */,
1924 uint32_t fence_list_len /**< */,
1925 const xcb_sync_fence_t *fence_list /**< */)
1927 static const xcb_protocol_request_t xcb_req = {
1928 /* count */ 4,
1929 /* ext */ &xcb_sync_id,
1930 /* opcode */ XCB_SYNC_AWAIT_FENCE,
1931 /* isvoid */ 1
1934 struct iovec xcb_parts[6];
1935 xcb_void_cookie_t xcb_ret;
1936 xcb_sync_await_fence_request_t xcb_out;
1939 xcb_parts[2].iov_base = (char *) &xcb_out;
1940 xcb_parts[2].iov_len = sizeof(xcb_out);
1941 xcb_parts[3].iov_base = 0;
1942 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1943 /* xcb_sync_fence_t fence_list */
1944 xcb_parts[4].iov_base = (char *) fence_list;
1945 xcb_parts[4].iov_len = fence_list_len * sizeof(xcb_sync_fence_t);
1946 xcb_parts[5].iov_base = 0;
1947 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1949 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1950 return xcb_ret;