xref: /netbsd-src/external/mit/xorg/lib/libxcb/files/present.c (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 /*
2  * This file generated automatically from present.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
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 "present.h"
15 
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
18 #include "render.h"
19 #include "randr.h"
20 #include "shape.h"
21 #include "xfixes.h"
22 #include "sync.h"
23 
24 xcb_extension_t xcb_present_id = { "Present", 0 };
25 
26 
27 /*****************************************************************************
28  **
29  ** void xcb_present_notify_next
30  **
31  ** @param xcb_present_notify_iterator_t *i
32  ** @returns void
33  **
34  *****************************************************************************/
35 
36 void
37 xcb_present_notify_next (xcb_present_notify_iterator_t *i  /**< */)
38 {
39     --i->rem;
40     ++i->data;
41     i->index += sizeof(xcb_present_notify_t);
42 }
43 
44 
45 /*****************************************************************************
46  **
47  ** xcb_generic_iterator_t xcb_present_notify_end
48  **
49  ** @param xcb_present_notify_iterator_t i
50  ** @returns xcb_generic_iterator_t
51  **
52  *****************************************************************************/
53 
54 xcb_generic_iterator_t
55 xcb_present_notify_end (xcb_present_notify_iterator_t i  /**< */)
56 {
57     xcb_generic_iterator_t ret;
58     ret.data = i.data + i.rem;
59     ret.index = i.index + ((char *) ret.data - (char *) i.data);
60     ret.rem = 0;
61     return ret;
62 }
63 
64 
65 /*****************************************************************************
66  **
67  ** xcb_present_query_version_cookie_t xcb_present_query_version
68  **
69  ** @param xcb_connection_t *c
70  ** @param uint32_t          major_version
71  ** @param uint32_t          minor_version
72  ** @returns xcb_present_query_version_cookie_t
73  **
74  *****************************************************************************/
75 
76 xcb_present_query_version_cookie_t
77 xcb_present_query_version (xcb_connection_t *c  /**< */,
78                            uint32_t          major_version  /**< */,
79                            uint32_t          minor_version  /**< */)
80 {
81     static const xcb_protocol_request_t xcb_req = {
82         /* count */ 2,
83         /* ext */ &xcb_present_id,
84         /* opcode */ XCB_PRESENT_QUERY_VERSION,
85         /* isvoid */ 0
86     };
87 
88     struct iovec xcb_parts[4];
89     xcb_present_query_version_cookie_t xcb_ret;
90     xcb_present_query_version_request_t xcb_out;
91 
92     xcb_out.major_version = major_version;
93     xcb_out.minor_version = minor_version;
94 
95     xcb_parts[2].iov_base = (char *) &xcb_out;
96     xcb_parts[2].iov_len = sizeof(xcb_out);
97     xcb_parts[3].iov_base = 0;
98     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
99 
100     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
101     return xcb_ret;
102 }
103 
104 
105 /*****************************************************************************
106  **
107  ** xcb_present_query_version_cookie_t xcb_present_query_version_unchecked
108  **
109  ** @param xcb_connection_t *c
110  ** @param uint32_t          major_version
111  ** @param uint32_t          minor_version
112  ** @returns xcb_present_query_version_cookie_t
113  **
114  *****************************************************************************/
115 
116 xcb_present_query_version_cookie_t
117 xcb_present_query_version_unchecked (xcb_connection_t *c  /**< */,
118                                      uint32_t          major_version  /**< */,
119                                      uint32_t          minor_version  /**< */)
120 {
121     static const xcb_protocol_request_t xcb_req = {
122         /* count */ 2,
123         /* ext */ &xcb_present_id,
124         /* opcode */ XCB_PRESENT_QUERY_VERSION,
125         /* isvoid */ 0
126     };
127 
128     struct iovec xcb_parts[4];
129     xcb_present_query_version_cookie_t xcb_ret;
130     xcb_present_query_version_request_t xcb_out;
131 
132     xcb_out.major_version = major_version;
133     xcb_out.minor_version = minor_version;
134 
135     xcb_parts[2].iov_base = (char *) &xcb_out;
136     xcb_parts[2].iov_len = sizeof(xcb_out);
137     xcb_parts[3].iov_base = 0;
138     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
139 
140     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
141     return xcb_ret;
142 }
143 
144 
145 /*****************************************************************************
146  **
147  ** xcb_present_query_version_reply_t * xcb_present_query_version_reply
148  **
149  ** @param xcb_connection_t                    *c
150  ** @param xcb_present_query_version_cookie_t   cookie
151  ** @param xcb_generic_error_t                **e
152  ** @returns xcb_present_query_version_reply_t *
153  **
154  *****************************************************************************/
155 
156 xcb_present_query_version_reply_t *
157 xcb_present_query_version_reply (xcb_connection_t                    *c  /**< */,
158                                  xcb_present_query_version_cookie_t   cookie  /**< */,
159                                  xcb_generic_error_t                **e  /**< */)
160 {
161     return (xcb_present_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
162 }
163 
164 int
165 xcb_present_pixmap_sizeof (const void  *_buffer  /**< */,
166                            uint32_t     notifies_len  /**< */)
167 {
168     char *xcb_tmp = (char *)_buffer;
169     unsigned int xcb_buffer_len = 0;
170     unsigned int xcb_block_len = 0;
171     unsigned int xcb_pad = 0;
172     unsigned int xcb_align_to = 0;
173 
174 
175     xcb_block_len += sizeof(xcb_present_pixmap_request_t);
176     xcb_tmp += xcb_block_len;
177     xcb_buffer_len += xcb_block_len;
178     xcb_block_len = 0;
179     /* notifies */
180     xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
181     xcb_tmp += xcb_block_len;
182     xcb_align_to = ALIGNOF(xcb_present_notify_t);
183     /* insert padding */
184     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
185     xcb_buffer_len += xcb_block_len + xcb_pad;
186     if (0 != xcb_pad) {
187         xcb_tmp += xcb_pad;
188         xcb_pad = 0;
189     }
190     xcb_block_len = 0;
191 
192     return xcb_buffer_len;
193 }
194 
195 
196 /*****************************************************************************
197  **
198  ** xcb_void_cookie_t xcb_present_pixmap_checked
199  **
200  ** @param xcb_connection_t           *c
201  ** @param xcb_window_t                window
202  ** @param xcb_pixmap_t                pixmap
203  ** @param uint32_t                    serial
204  ** @param xcb_xfixes_region_t         valid
205  ** @param xcb_xfixes_region_t         update
206  ** @param int16_t                     x_off
207  ** @param int16_t                     y_off
208  ** @param xcb_randr_crtc_t            target_crtc
209  ** @param xcb_sync_fence_t            wait_fence
210  ** @param xcb_sync_fence_t            idle_fence
211  ** @param uint32_t                    options
212  ** @param uint64_t                    target_msc
213  ** @param uint64_t                    divisor
214  ** @param uint64_t                    remainder
215  ** @param uint32_t                    notifies_len
216  ** @param const xcb_present_notify_t *notifies
217  ** @returns xcb_void_cookie_t
218  **
219  *****************************************************************************/
220 
221 xcb_void_cookie_t
222 xcb_present_pixmap_checked (xcb_connection_t           *c  /**< */,
223                             xcb_window_t                window  /**< */,
224                             xcb_pixmap_t                pixmap  /**< */,
225                             uint32_t                    serial  /**< */,
226                             xcb_xfixes_region_t         valid  /**< */,
227                             xcb_xfixes_region_t         update  /**< */,
228                             int16_t                     x_off  /**< */,
229                             int16_t                     y_off  /**< */,
230                             xcb_randr_crtc_t            target_crtc  /**< */,
231                             xcb_sync_fence_t            wait_fence  /**< */,
232                             xcb_sync_fence_t            idle_fence  /**< */,
233                             uint32_t                    options  /**< */,
234                             uint64_t                    target_msc  /**< */,
235                             uint64_t                    divisor  /**< */,
236                             uint64_t                    remainder  /**< */,
237                             uint32_t                    notifies_len  /**< */,
238                             const xcb_present_notify_t *notifies  /**< */)
239 {
240     static const xcb_protocol_request_t xcb_req = {
241         /* count */ 4,
242         /* ext */ &xcb_present_id,
243         /* opcode */ XCB_PRESENT_PIXMAP,
244         /* isvoid */ 1
245     };
246 
247     struct iovec xcb_parts[6];
248     xcb_void_cookie_t xcb_ret;
249     xcb_present_pixmap_request_t xcb_out;
250 
251     xcb_out.window = window;
252     xcb_out.pixmap = pixmap;
253     xcb_out.serial = serial;
254     xcb_out.valid = valid;
255     xcb_out.update = update;
256     xcb_out.x_off = x_off;
257     xcb_out.y_off = y_off;
258     xcb_out.target_crtc = target_crtc;
259     xcb_out.wait_fence = wait_fence;
260     xcb_out.idle_fence = idle_fence;
261     xcb_out.options = options;
262     memset(xcb_out.pad0, 0, 4);
263     xcb_out.target_msc = target_msc;
264     xcb_out.divisor = divisor;
265     xcb_out.remainder = remainder;
266 
267     xcb_parts[2].iov_base = (char *) &xcb_out;
268     xcb_parts[2].iov_len = sizeof(xcb_out);
269     xcb_parts[3].iov_base = 0;
270     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
271     /* xcb_present_notify_t notifies */
272     xcb_parts[4].iov_base = (char *) notifies;
273     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
274     xcb_parts[5].iov_base = 0;
275     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
276 
277     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
278     return xcb_ret;
279 }
280 
281 
282 /*****************************************************************************
283  **
284  ** xcb_void_cookie_t xcb_present_pixmap
285  **
286  ** @param xcb_connection_t           *c
287  ** @param xcb_window_t                window
288  ** @param xcb_pixmap_t                pixmap
289  ** @param uint32_t                    serial
290  ** @param xcb_xfixes_region_t         valid
291  ** @param xcb_xfixes_region_t         update
292  ** @param int16_t                     x_off
293  ** @param int16_t                     y_off
294  ** @param xcb_randr_crtc_t            target_crtc
295  ** @param xcb_sync_fence_t            wait_fence
296  ** @param xcb_sync_fence_t            idle_fence
297  ** @param uint32_t                    options
298  ** @param uint64_t                    target_msc
299  ** @param uint64_t                    divisor
300  ** @param uint64_t                    remainder
301  ** @param uint32_t                    notifies_len
302  ** @param const xcb_present_notify_t *notifies
303  ** @returns xcb_void_cookie_t
304  **
305  *****************************************************************************/
306 
307 xcb_void_cookie_t
308 xcb_present_pixmap (xcb_connection_t           *c  /**< */,
309                     xcb_window_t                window  /**< */,
310                     xcb_pixmap_t                pixmap  /**< */,
311                     uint32_t                    serial  /**< */,
312                     xcb_xfixes_region_t         valid  /**< */,
313                     xcb_xfixes_region_t         update  /**< */,
314                     int16_t                     x_off  /**< */,
315                     int16_t                     y_off  /**< */,
316                     xcb_randr_crtc_t            target_crtc  /**< */,
317                     xcb_sync_fence_t            wait_fence  /**< */,
318                     xcb_sync_fence_t            idle_fence  /**< */,
319                     uint32_t                    options  /**< */,
320                     uint64_t                    target_msc  /**< */,
321                     uint64_t                    divisor  /**< */,
322                     uint64_t                    remainder  /**< */,
323                     uint32_t                    notifies_len  /**< */,
324                     const xcb_present_notify_t *notifies  /**< */)
325 {
326     static const xcb_protocol_request_t xcb_req = {
327         /* count */ 4,
328         /* ext */ &xcb_present_id,
329         /* opcode */ XCB_PRESENT_PIXMAP,
330         /* isvoid */ 1
331     };
332 
333     struct iovec xcb_parts[6];
334     xcb_void_cookie_t xcb_ret;
335     xcb_present_pixmap_request_t xcb_out;
336 
337     xcb_out.window = window;
338     xcb_out.pixmap = pixmap;
339     xcb_out.serial = serial;
340     xcb_out.valid = valid;
341     xcb_out.update = update;
342     xcb_out.x_off = x_off;
343     xcb_out.y_off = y_off;
344     xcb_out.target_crtc = target_crtc;
345     xcb_out.wait_fence = wait_fence;
346     xcb_out.idle_fence = idle_fence;
347     xcb_out.options = options;
348     memset(xcb_out.pad0, 0, 4);
349     xcb_out.target_msc = target_msc;
350     xcb_out.divisor = divisor;
351     xcb_out.remainder = remainder;
352 
353     xcb_parts[2].iov_base = (char *) &xcb_out;
354     xcb_parts[2].iov_len = sizeof(xcb_out);
355     xcb_parts[3].iov_base = 0;
356     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
357     /* xcb_present_notify_t notifies */
358     xcb_parts[4].iov_base = (char *) notifies;
359     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
360     xcb_parts[5].iov_base = 0;
361     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
362 
363     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
364     return xcb_ret;
365 }
366 
367 
368 /*****************************************************************************
369  **
370  ** xcb_void_cookie_t xcb_present_notify_msc_checked
371  **
372  ** @param xcb_connection_t *c
373  ** @param xcb_window_t      window
374  ** @param uint32_t          serial
375  ** @param uint64_t          target_msc
376  ** @param uint64_t          divisor
377  ** @param uint64_t          remainder
378  ** @returns xcb_void_cookie_t
379  **
380  *****************************************************************************/
381 
382 xcb_void_cookie_t
383 xcb_present_notify_msc_checked (xcb_connection_t *c  /**< */,
384                                 xcb_window_t      window  /**< */,
385                                 uint32_t          serial  /**< */,
386                                 uint64_t          target_msc  /**< */,
387                                 uint64_t          divisor  /**< */,
388                                 uint64_t          remainder  /**< */)
389 {
390     static const xcb_protocol_request_t xcb_req = {
391         /* count */ 2,
392         /* ext */ &xcb_present_id,
393         /* opcode */ XCB_PRESENT_NOTIFY_MSC,
394         /* isvoid */ 1
395     };
396 
397     struct iovec xcb_parts[4];
398     xcb_void_cookie_t xcb_ret;
399     xcb_present_notify_msc_request_t xcb_out;
400 
401     xcb_out.window = window;
402     xcb_out.serial = serial;
403     memset(xcb_out.pad0, 0, 4);
404     xcb_out.target_msc = target_msc;
405     xcb_out.divisor = divisor;
406     xcb_out.remainder = remainder;
407 
408     xcb_parts[2].iov_base = (char *) &xcb_out;
409     xcb_parts[2].iov_len = sizeof(xcb_out);
410     xcb_parts[3].iov_base = 0;
411     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
412 
413     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
414     return xcb_ret;
415 }
416 
417 
418 /*****************************************************************************
419  **
420  ** xcb_void_cookie_t xcb_present_notify_msc
421  **
422  ** @param xcb_connection_t *c
423  ** @param xcb_window_t      window
424  ** @param uint32_t          serial
425  ** @param uint64_t          target_msc
426  ** @param uint64_t          divisor
427  ** @param uint64_t          remainder
428  ** @returns xcb_void_cookie_t
429  **
430  *****************************************************************************/
431 
432 xcb_void_cookie_t
433 xcb_present_notify_msc (xcb_connection_t *c  /**< */,
434                         xcb_window_t      window  /**< */,
435                         uint32_t          serial  /**< */,
436                         uint64_t          target_msc  /**< */,
437                         uint64_t          divisor  /**< */,
438                         uint64_t          remainder  /**< */)
439 {
440     static const xcb_protocol_request_t xcb_req = {
441         /* count */ 2,
442         /* ext */ &xcb_present_id,
443         /* opcode */ XCB_PRESENT_NOTIFY_MSC,
444         /* isvoid */ 1
445     };
446 
447     struct iovec xcb_parts[4];
448     xcb_void_cookie_t xcb_ret;
449     xcb_present_notify_msc_request_t xcb_out;
450 
451     xcb_out.window = window;
452     xcb_out.serial = serial;
453     memset(xcb_out.pad0, 0, 4);
454     xcb_out.target_msc = target_msc;
455     xcb_out.divisor = divisor;
456     xcb_out.remainder = remainder;
457 
458     xcb_parts[2].iov_base = (char *) &xcb_out;
459     xcb_parts[2].iov_len = sizeof(xcb_out);
460     xcb_parts[3].iov_base = 0;
461     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
462 
463     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
464     return xcb_ret;
465 }
466 
467 
468 /*****************************************************************************
469  **
470  ** void xcb_present_event_next
471  **
472  ** @param xcb_present_event_iterator_t *i
473  ** @returns void
474  **
475  *****************************************************************************/
476 
477 void
478 xcb_present_event_next (xcb_present_event_iterator_t *i  /**< */)
479 {
480     --i->rem;
481     ++i->data;
482     i->index += sizeof(xcb_present_event_t);
483 }
484 
485 
486 /*****************************************************************************
487  **
488  ** xcb_generic_iterator_t xcb_present_event_end
489  **
490  ** @param xcb_present_event_iterator_t i
491  ** @returns xcb_generic_iterator_t
492  **
493  *****************************************************************************/
494 
495 xcb_generic_iterator_t
496 xcb_present_event_end (xcb_present_event_iterator_t i  /**< */)
497 {
498     xcb_generic_iterator_t ret;
499     ret.data = i.data + i.rem;
500     ret.index = i.index + ((char *) ret.data - (char *) i.data);
501     ret.rem = 0;
502     return ret;
503 }
504 
505 
506 /*****************************************************************************
507  **
508  ** xcb_void_cookie_t xcb_present_select_input_checked
509  **
510  ** @param xcb_connection_t    *c
511  ** @param xcb_present_event_t  eid
512  ** @param xcb_window_t         window
513  ** @param uint32_t             event_mask
514  ** @returns xcb_void_cookie_t
515  **
516  *****************************************************************************/
517 
518 xcb_void_cookie_t
519 xcb_present_select_input_checked (xcb_connection_t    *c  /**< */,
520                                   xcb_present_event_t  eid  /**< */,
521                                   xcb_window_t         window  /**< */,
522                                   uint32_t             event_mask  /**< */)
523 {
524     static const xcb_protocol_request_t xcb_req = {
525         /* count */ 2,
526         /* ext */ &xcb_present_id,
527         /* opcode */ XCB_PRESENT_SELECT_INPUT,
528         /* isvoid */ 1
529     };
530 
531     struct iovec xcb_parts[4];
532     xcb_void_cookie_t xcb_ret;
533     xcb_present_select_input_request_t xcb_out;
534 
535     xcb_out.eid = eid;
536     xcb_out.window = window;
537     xcb_out.event_mask = event_mask;
538 
539     xcb_parts[2].iov_base = (char *) &xcb_out;
540     xcb_parts[2].iov_len = sizeof(xcb_out);
541     xcb_parts[3].iov_base = 0;
542     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
543 
544     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
545     return xcb_ret;
546 }
547 
548 
549 /*****************************************************************************
550  **
551  ** xcb_void_cookie_t xcb_present_select_input
552  **
553  ** @param xcb_connection_t    *c
554  ** @param xcb_present_event_t  eid
555  ** @param xcb_window_t         window
556  ** @param uint32_t             event_mask
557  ** @returns xcb_void_cookie_t
558  **
559  *****************************************************************************/
560 
561 xcb_void_cookie_t
562 xcb_present_select_input (xcb_connection_t    *c  /**< */,
563                           xcb_present_event_t  eid  /**< */,
564                           xcb_window_t         window  /**< */,
565                           uint32_t             event_mask  /**< */)
566 {
567     static const xcb_protocol_request_t xcb_req = {
568         /* count */ 2,
569         /* ext */ &xcb_present_id,
570         /* opcode */ XCB_PRESENT_SELECT_INPUT,
571         /* isvoid */ 1
572     };
573 
574     struct iovec xcb_parts[4];
575     xcb_void_cookie_t xcb_ret;
576     xcb_present_select_input_request_t xcb_out;
577 
578     xcb_out.eid = eid;
579     xcb_out.window = window;
580     xcb_out.event_mask = event_mask;
581 
582     xcb_parts[2].iov_base = (char *) &xcb_out;
583     xcb_parts[2].iov_len = sizeof(xcb_out);
584     xcb_parts[3].iov_base = 0;
585     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
586 
587     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
588     return xcb_ret;
589 }
590 
591 
592 /*****************************************************************************
593  **
594  ** xcb_present_query_capabilities_cookie_t xcb_present_query_capabilities
595  **
596  ** @param xcb_connection_t *c
597  ** @param uint32_t          target
598  ** @returns xcb_present_query_capabilities_cookie_t
599  **
600  *****************************************************************************/
601 
602 xcb_present_query_capabilities_cookie_t
603 xcb_present_query_capabilities (xcb_connection_t *c  /**< */,
604                                 uint32_t          target  /**< */)
605 {
606     static const xcb_protocol_request_t xcb_req = {
607         /* count */ 2,
608         /* ext */ &xcb_present_id,
609         /* opcode */ XCB_PRESENT_QUERY_CAPABILITIES,
610         /* isvoid */ 0
611     };
612 
613     struct iovec xcb_parts[4];
614     xcb_present_query_capabilities_cookie_t xcb_ret;
615     xcb_present_query_capabilities_request_t xcb_out;
616 
617     xcb_out.target = target;
618 
619     xcb_parts[2].iov_base = (char *) &xcb_out;
620     xcb_parts[2].iov_len = sizeof(xcb_out);
621     xcb_parts[3].iov_base = 0;
622     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
623 
624     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
625     return xcb_ret;
626 }
627 
628 
629 /*****************************************************************************
630  **
631  ** xcb_present_query_capabilities_cookie_t xcb_present_query_capabilities_unchecked
632  **
633  ** @param xcb_connection_t *c
634  ** @param uint32_t          target
635  ** @returns xcb_present_query_capabilities_cookie_t
636  **
637  *****************************************************************************/
638 
639 xcb_present_query_capabilities_cookie_t
640 xcb_present_query_capabilities_unchecked (xcb_connection_t *c  /**< */,
641                                           uint32_t          target  /**< */)
642 {
643     static const xcb_protocol_request_t xcb_req = {
644         /* count */ 2,
645         /* ext */ &xcb_present_id,
646         /* opcode */ XCB_PRESENT_QUERY_CAPABILITIES,
647         /* isvoid */ 0
648     };
649 
650     struct iovec xcb_parts[4];
651     xcb_present_query_capabilities_cookie_t xcb_ret;
652     xcb_present_query_capabilities_request_t xcb_out;
653 
654     xcb_out.target = target;
655 
656     xcb_parts[2].iov_base = (char *) &xcb_out;
657     xcb_parts[2].iov_len = sizeof(xcb_out);
658     xcb_parts[3].iov_base = 0;
659     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
660 
661     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
662     return xcb_ret;
663 }
664 
665 
666 /*****************************************************************************
667  **
668  ** xcb_present_query_capabilities_reply_t * xcb_present_query_capabilities_reply
669  **
670  ** @param xcb_connection_t                         *c
671  ** @param xcb_present_query_capabilities_cookie_t   cookie
672  ** @param xcb_generic_error_t                     **e
673  ** @returns xcb_present_query_capabilities_reply_t *
674  **
675  *****************************************************************************/
676 
677 xcb_present_query_capabilities_reply_t *
678 xcb_present_query_capabilities_reply (xcb_connection_t                         *c  /**< */,
679                                       xcb_present_query_capabilities_cookie_t   cookie  /**< */,
680                                       xcb_generic_error_t                     **e  /**< */)
681 {
682     return (xcb_present_query_capabilities_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
683 }
684 
685 int
686 xcb_present_redirect_notify_sizeof (const void  *_buffer  /**< */,
687                                     uint32_t     notifies_len  /**< */)
688 {
689     char *xcb_tmp = (char *)_buffer;
690     unsigned int xcb_buffer_len = 0;
691     unsigned int xcb_block_len = 0;
692     unsigned int xcb_pad = 0;
693     unsigned int xcb_align_to = 0;
694 
695 
696     xcb_block_len += sizeof(xcb_present_redirect_notify_event_t);
697     xcb_tmp += xcb_block_len;
698     xcb_buffer_len += xcb_block_len;
699     xcb_block_len = 0;
700     /* notifies */
701     xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
702     xcb_tmp += xcb_block_len;
703     xcb_align_to = ALIGNOF(xcb_present_notify_t);
704     /* insert padding */
705     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
706     xcb_buffer_len += xcb_block_len + xcb_pad;
707     if (0 != xcb_pad) {
708         xcb_tmp += xcb_pad;
709         xcb_pad = 0;
710     }
711     xcb_block_len = 0;
712 
713     return xcb_buffer_len;
714 }
715 
716