xref: /netbsd/external/mit/xorg/lib/libxcb/files/dri2.c (revision 6550d01e)
1 /*
2  * This file generated automatically from dri2.xml by c_client.py.
3  * Edit at your peril.
4  */
5 
6 #include <string.h>
7 #include <assert.h>
8 #include "xcbext.h"
9 #include "dri2.h"
10 #include "xproto.h"
11 
12 xcb_extension_t xcb_dri2_id = { "DRI2", 0 };
13 
14 
15 /*****************************************************************************
16  **
17  ** void xcb_dri2_dri2_buffer_next
18  **
19  ** @param xcb_dri2_dri2_buffer_iterator_t *i
20  ** @returns void
21  **
22  *****************************************************************************/
23 
24 void
25 xcb_dri2_dri2_buffer_next (xcb_dri2_dri2_buffer_iterator_t *i  /**< */)
26 {
27     --i->rem;
28     ++i->data;
29     i->index += sizeof(xcb_dri2_dri2_buffer_t);
30 }
31 
32 
33 /*****************************************************************************
34  **
35  ** xcb_generic_iterator_t xcb_dri2_dri2_buffer_end
36  **
37  ** @param xcb_dri2_dri2_buffer_iterator_t i
38  ** @returns xcb_generic_iterator_t
39  **
40  *****************************************************************************/
41 
42 xcb_generic_iterator_t
43 xcb_dri2_dri2_buffer_end (xcb_dri2_dri2_buffer_iterator_t i  /**< */)
44 {
45     xcb_generic_iterator_t ret;
46     ret.data = i.data + i.rem;
47     ret.index = i.index + ((char *) ret.data - (char *) i.data);
48     ret.rem = 0;
49     return ret;
50 }
51 
52 
53 /*****************************************************************************
54  **
55  ** void xcb_dri2_attach_format_next
56  **
57  ** @param xcb_dri2_attach_format_iterator_t *i
58  ** @returns void
59  **
60  *****************************************************************************/
61 
62 void
63 xcb_dri2_attach_format_next (xcb_dri2_attach_format_iterator_t *i  /**< */)
64 {
65     --i->rem;
66     ++i->data;
67     i->index += sizeof(xcb_dri2_attach_format_t);
68 }
69 
70 
71 /*****************************************************************************
72  **
73  ** xcb_generic_iterator_t xcb_dri2_attach_format_end
74  **
75  ** @param xcb_dri2_attach_format_iterator_t i
76  ** @returns xcb_generic_iterator_t
77  **
78  *****************************************************************************/
79 
80 xcb_generic_iterator_t
81 xcb_dri2_attach_format_end (xcb_dri2_attach_format_iterator_t i  /**< */)
82 {
83     xcb_generic_iterator_t ret;
84     ret.data = i.data + i.rem;
85     ret.index = i.index + ((char *) ret.data - (char *) i.data);
86     ret.rem = 0;
87     return ret;
88 }
89 
90 
91 /*****************************************************************************
92  **
93  ** xcb_dri2_query_version_cookie_t xcb_dri2_query_version
94  **
95  ** @param xcb_connection_t *c
96  ** @param uint32_t          major_version
97  ** @param uint32_t          minor_version
98  ** @returns xcb_dri2_query_version_cookie_t
99  **
100  *****************************************************************************/
101 
102 xcb_dri2_query_version_cookie_t
103 xcb_dri2_query_version (xcb_connection_t *c  /**< */,
104                         uint32_t          major_version  /**< */,
105                         uint32_t          minor_version  /**< */)
106 {
107     static const xcb_protocol_request_t xcb_req = {
108         /* count */ 2,
109         /* ext */ &xcb_dri2_id,
110         /* opcode */ XCB_DRI2_QUERY_VERSION,
111         /* isvoid */ 0
112     };
113 
114     struct iovec xcb_parts[4];
115     xcb_dri2_query_version_cookie_t xcb_ret;
116     xcb_dri2_query_version_request_t xcb_out;
117 
118     xcb_out.major_version = major_version;
119     xcb_out.minor_version = minor_version;
120 
121     xcb_parts[2].iov_base = (char *) &xcb_out;
122     xcb_parts[2].iov_len = sizeof(xcb_out);
123     xcb_parts[3].iov_base = 0;
124     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
125     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
126     return xcb_ret;
127 }
128 
129 
130 /*****************************************************************************
131  **
132  ** xcb_dri2_query_version_cookie_t xcb_dri2_query_version_unchecked
133  **
134  ** @param xcb_connection_t *c
135  ** @param uint32_t          major_version
136  ** @param uint32_t          minor_version
137  ** @returns xcb_dri2_query_version_cookie_t
138  **
139  *****************************************************************************/
140 
141 xcb_dri2_query_version_cookie_t
142 xcb_dri2_query_version_unchecked (xcb_connection_t *c  /**< */,
143                                   uint32_t          major_version  /**< */,
144                                   uint32_t          minor_version  /**< */)
145 {
146     static const xcb_protocol_request_t xcb_req = {
147         /* count */ 2,
148         /* ext */ &xcb_dri2_id,
149         /* opcode */ XCB_DRI2_QUERY_VERSION,
150         /* isvoid */ 0
151     };
152 
153     struct iovec xcb_parts[4];
154     xcb_dri2_query_version_cookie_t xcb_ret;
155     xcb_dri2_query_version_request_t xcb_out;
156 
157     xcb_out.major_version = major_version;
158     xcb_out.minor_version = minor_version;
159 
160     xcb_parts[2].iov_base = (char *) &xcb_out;
161     xcb_parts[2].iov_len = sizeof(xcb_out);
162     xcb_parts[3].iov_base = 0;
163     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
164     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
165     return xcb_ret;
166 }
167 
168 
169 /*****************************************************************************
170  **
171  ** xcb_dri2_query_version_reply_t * xcb_dri2_query_version_reply
172  **
173  ** @param xcb_connection_t                 *c
174  ** @param xcb_dri2_query_version_cookie_t   cookie
175  ** @param xcb_generic_error_t             **e
176  ** @returns xcb_dri2_query_version_reply_t *
177  **
178  *****************************************************************************/
179 
180 xcb_dri2_query_version_reply_t *
181 xcb_dri2_query_version_reply (xcb_connection_t                 *c  /**< */,
182                               xcb_dri2_query_version_cookie_t   cookie  /**< */,
183                               xcb_generic_error_t             **e  /**< */)
184 {
185     return (xcb_dri2_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
186 }
187 
188 
189 /*****************************************************************************
190  **
191  ** xcb_dri2_connect_cookie_t xcb_dri2_connect
192  **
193  ** @param xcb_connection_t *c
194  ** @param xcb_window_t      window
195  ** @param uint32_t          driver_type
196  ** @returns xcb_dri2_connect_cookie_t
197  **
198  *****************************************************************************/
199 
200 xcb_dri2_connect_cookie_t
201 xcb_dri2_connect (xcb_connection_t *c  /**< */,
202                   xcb_window_t      window  /**< */,
203                   uint32_t          driver_type  /**< */)
204 {
205     static const xcb_protocol_request_t xcb_req = {
206         /* count */ 2,
207         /* ext */ &xcb_dri2_id,
208         /* opcode */ XCB_DRI2_CONNECT,
209         /* isvoid */ 0
210     };
211 
212     struct iovec xcb_parts[4];
213     xcb_dri2_connect_cookie_t xcb_ret;
214     xcb_dri2_connect_request_t xcb_out;
215 
216     xcb_out.window = window;
217     xcb_out.driver_type = driver_type;
218 
219     xcb_parts[2].iov_base = (char *) &xcb_out;
220     xcb_parts[2].iov_len = sizeof(xcb_out);
221     xcb_parts[3].iov_base = 0;
222     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
223     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
224     return xcb_ret;
225 }
226 
227 
228 /*****************************************************************************
229  **
230  ** xcb_dri2_connect_cookie_t xcb_dri2_connect_unchecked
231  **
232  ** @param xcb_connection_t *c
233  ** @param xcb_window_t      window
234  ** @param uint32_t          driver_type
235  ** @returns xcb_dri2_connect_cookie_t
236  **
237  *****************************************************************************/
238 
239 xcb_dri2_connect_cookie_t
240 xcb_dri2_connect_unchecked (xcb_connection_t *c  /**< */,
241                             xcb_window_t      window  /**< */,
242                             uint32_t          driver_type  /**< */)
243 {
244     static const xcb_protocol_request_t xcb_req = {
245         /* count */ 2,
246         /* ext */ &xcb_dri2_id,
247         /* opcode */ XCB_DRI2_CONNECT,
248         /* isvoid */ 0
249     };
250 
251     struct iovec xcb_parts[4];
252     xcb_dri2_connect_cookie_t xcb_ret;
253     xcb_dri2_connect_request_t xcb_out;
254 
255     xcb_out.window = window;
256     xcb_out.driver_type = driver_type;
257 
258     xcb_parts[2].iov_base = (char *) &xcb_out;
259     xcb_parts[2].iov_len = sizeof(xcb_out);
260     xcb_parts[3].iov_base = 0;
261     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
262     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
263     return xcb_ret;
264 }
265 
266 
267 /*****************************************************************************
268  **
269  ** char * xcb_dri2_connect_driver_name
270  **
271  ** @param const xcb_dri2_connect_reply_t *R
272  ** @returns char *
273  **
274  *****************************************************************************/
275 
276 char *
277 xcb_dri2_connect_driver_name (const xcb_dri2_connect_reply_t *R  /**< */)
278 {
279     return (char *) (R + 1);
280 }
281 
282 
283 /*****************************************************************************
284  **
285  ** int xcb_dri2_connect_driver_name_length
286  **
287  ** @param const xcb_dri2_connect_reply_t *R
288  ** @returns int
289  **
290  *****************************************************************************/
291 
292 int
293 xcb_dri2_connect_driver_name_length (const xcb_dri2_connect_reply_t *R  /**< */)
294 {
295     return R->driver_name_length;
296 }
297 
298 
299 /*****************************************************************************
300  **
301  ** xcb_generic_iterator_t xcb_dri2_connect_driver_name_end
302  **
303  ** @param const xcb_dri2_connect_reply_t *R
304  ** @returns xcb_generic_iterator_t
305  **
306  *****************************************************************************/
307 
308 xcb_generic_iterator_t
309 xcb_dri2_connect_driver_name_end (const xcb_dri2_connect_reply_t *R  /**< */)
310 {
311     xcb_generic_iterator_t i;
312     i.data = ((char *) (R + 1)) + (R->driver_name_length);
313     i.rem = 0;
314     i.index = (char *) i.data - (char *) R;
315     return i;
316 }
317 
318 
319 /*****************************************************************************
320  **
321  ** char * xcb_dri2_connect_device_name
322  **
323  ** @param const xcb_dri2_connect_reply_t *R
324  ** @returns char *
325  **
326  *****************************************************************************/
327 
328 char *
329 xcb_dri2_connect_device_name (const xcb_dri2_connect_reply_t *R  /**< */)
330 {
331     xcb_generic_iterator_t prev = xcb_dri2_connect_driver_name_end(R);
332     return (char *) ((char *) prev.data + XCB_TYPE_PAD(char, prev.index) + 0);
333 }
334 
335 
336 /*****************************************************************************
337  **
338  ** int xcb_dri2_connect_device_name_length
339  **
340  ** @param const xcb_dri2_connect_reply_t *R
341  ** @returns int
342  **
343  *****************************************************************************/
344 
345 int
346 xcb_dri2_connect_device_name_length (const xcb_dri2_connect_reply_t *R  /**< */)
347 {
348     return R->device_name_length;
349 }
350 
351 
352 /*****************************************************************************
353  **
354  ** xcb_generic_iterator_t xcb_dri2_connect_device_name_end
355  **
356  ** @param const xcb_dri2_connect_reply_t *R
357  ** @returns xcb_generic_iterator_t
358  **
359  *****************************************************************************/
360 
361 xcb_generic_iterator_t
362 xcb_dri2_connect_device_name_end (const xcb_dri2_connect_reply_t *R  /**< */)
363 {
364     xcb_generic_iterator_t i;
365     xcb_generic_iterator_t child = xcb_dri2_connect_driver_name_end(R);
366     i.data = ((char *) child.data) + (R->device_name_length);
367     i.rem = 0;
368     i.index = (char *) i.data - (char *) R;
369     return i;
370 }
371 
372 
373 /*****************************************************************************
374  **
375  ** xcb_dri2_connect_reply_t * xcb_dri2_connect_reply
376  **
377  ** @param xcb_connection_t           *c
378  ** @param xcb_dri2_connect_cookie_t   cookie
379  ** @param xcb_generic_error_t       **e
380  ** @returns xcb_dri2_connect_reply_t *
381  **
382  *****************************************************************************/
383 
384 xcb_dri2_connect_reply_t *
385 xcb_dri2_connect_reply (xcb_connection_t           *c  /**< */,
386                         xcb_dri2_connect_cookie_t   cookie  /**< */,
387                         xcb_generic_error_t       **e  /**< */)
388 {
389     return (xcb_dri2_connect_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
390 }
391 
392 
393 /*****************************************************************************
394  **
395  ** xcb_dri2_authenticate_cookie_t xcb_dri2_authenticate
396  **
397  ** @param xcb_connection_t *c
398  ** @param xcb_window_t      window
399  ** @param uint32_t          magic
400  ** @returns xcb_dri2_authenticate_cookie_t
401  **
402  *****************************************************************************/
403 
404 xcb_dri2_authenticate_cookie_t
405 xcb_dri2_authenticate (xcb_connection_t *c  /**< */,
406                        xcb_window_t      window  /**< */,
407                        uint32_t          magic  /**< */)
408 {
409     static const xcb_protocol_request_t xcb_req = {
410         /* count */ 2,
411         /* ext */ &xcb_dri2_id,
412         /* opcode */ XCB_DRI2_AUTHENTICATE,
413         /* isvoid */ 0
414     };
415 
416     struct iovec xcb_parts[4];
417     xcb_dri2_authenticate_cookie_t xcb_ret;
418     xcb_dri2_authenticate_request_t xcb_out;
419 
420     xcb_out.window = window;
421     xcb_out.magic = magic;
422 
423     xcb_parts[2].iov_base = (char *) &xcb_out;
424     xcb_parts[2].iov_len = sizeof(xcb_out);
425     xcb_parts[3].iov_base = 0;
426     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
427     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
428     return xcb_ret;
429 }
430 
431 
432 /*****************************************************************************
433  **
434  ** xcb_dri2_authenticate_cookie_t xcb_dri2_authenticate_unchecked
435  **
436  ** @param xcb_connection_t *c
437  ** @param xcb_window_t      window
438  ** @param uint32_t          magic
439  ** @returns xcb_dri2_authenticate_cookie_t
440  **
441  *****************************************************************************/
442 
443 xcb_dri2_authenticate_cookie_t
444 xcb_dri2_authenticate_unchecked (xcb_connection_t *c  /**< */,
445                                  xcb_window_t      window  /**< */,
446                                  uint32_t          magic  /**< */)
447 {
448     static const xcb_protocol_request_t xcb_req = {
449         /* count */ 2,
450         /* ext */ &xcb_dri2_id,
451         /* opcode */ XCB_DRI2_AUTHENTICATE,
452         /* isvoid */ 0
453     };
454 
455     struct iovec xcb_parts[4];
456     xcb_dri2_authenticate_cookie_t xcb_ret;
457     xcb_dri2_authenticate_request_t xcb_out;
458 
459     xcb_out.window = window;
460     xcb_out.magic = magic;
461 
462     xcb_parts[2].iov_base = (char *) &xcb_out;
463     xcb_parts[2].iov_len = sizeof(xcb_out);
464     xcb_parts[3].iov_base = 0;
465     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
466     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
467     return xcb_ret;
468 }
469 
470 
471 /*****************************************************************************
472  **
473  ** xcb_dri2_authenticate_reply_t * xcb_dri2_authenticate_reply
474  **
475  ** @param xcb_connection_t                *c
476  ** @param xcb_dri2_authenticate_cookie_t   cookie
477  ** @param xcb_generic_error_t            **e
478  ** @returns xcb_dri2_authenticate_reply_t *
479  **
480  *****************************************************************************/
481 
482 xcb_dri2_authenticate_reply_t *
483 xcb_dri2_authenticate_reply (xcb_connection_t                *c  /**< */,
484                              xcb_dri2_authenticate_cookie_t   cookie  /**< */,
485                              xcb_generic_error_t            **e  /**< */)
486 {
487     return (xcb_dri2_authenticate_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
488 }
489 
490 
491 /*****************************************************************************
492  **
493  ** xcb_void_cookie_t xcb_dri2_create_drawable_checked
494  **
495  ** @param xcb_connection_t *c
496  ** @param xcb_drawable_t    drawable
497  ** @returns xcb_void_cookie_t
498  **
499  *****************************************************************************/
500 
501 xcb_void_cookie_t
502 xcb_dri2_create_drawable_checked (xcb_connection_t *c  /**< */,
503                                   xcb_drawable_t    drawable  /**< */)
504 {
505     static const xcb_protocol_request_t xcb_req = {
506         /* count */ 2,
507         /* ext */ &xcb_dri2_id,
508         /* opcode */ XCB_DRI2_CREATE_DRAWABLE,
509         /* isvoid */ 1
510     };
511 
512     struct iovec xcb_parts[4];
513     xcb_void_cookie_t xcb_ret;
514     xcb_dri2_create_drawable_request_t xcb_out;
515 
516     xcb_out.drawable = drawable;
517 
518     xcb_parts[2].iov_base = (char *) &xcb_out;
519     xcb_parts[2].iov_len = sizeof(xcb_out);
520     xcb_parts[3].iov_base = 0;
521     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
522     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
523     return xcb_ret;
524 }
525 
526 
527 /*****************************************************************************
528  **
529  ** xcb_void_cookie_t xcb_dri2_create_drawable
530  **
531  ** @param xcb_connection_t *c
532  ** @param xcb_drawable_t    drawable
533  ** @returns xcb_void_cookie_t
534  **
535  *****************************************************************************/
536 
537 xcb_void_cookie_t
538 xcb_dri2_create_drawable (xcb_connection_t *c  /**< */,
539                           xcb_drawable_t    drawable  /**< */)
540 {
541     static const xcb_protocol_request_t xcb_req = {
542         /* count */ 2,
543         /* ext */ &xcb_dri2_id,
544         /* opcode */ XCB_DRI2_CREATE_DRAWABLE,
545         /* isvoid */ 1
546     };
547 
548     struct iovec xcb_parts[4];
549     xcb_void_cookie_t xcb_ret;
550     xcb_dri2_create_drawable_request_t xcb_out;
551 
552     xcb_out.drawable = drawable;
553 
554     xcb_parts[2].iov_base = (char *) &xcb_out;
555     xcb_parts[2].iov_len = sizeof(xcb_out);
556     xcb_parts[3].iov_base = 0;
557     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
558     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
559     return xcb_ret;
560 }
561 
562 
563 /*****************************************************************************
564  **
565  ** xcb_void_cookie_t xcb_dri2_destroy_drawable_checked
566  **
567  ** @param xcb_connection_t *c
568  ** @param xcb_drawable_t    drawable
569  ** @returns xcb_void_cookie_t
570  **
571  *****************************************************************************/
572 
573 xcb_void_cookie_t
574 xcb_dri2_destroy_drawable_checked (xcb_connection_t *c  /**< */,
575                                    xcb_drawable_t    drawable  /**< */)
576 {
577     static const xcb_protocol_request_t xcb_req = {
578         /* count */ 2,
579         /* ext */ &xcb_dri2_id,
580         /* opcode */ XCB_DRI2_DESTROY_DRAWABLE,
581         /* isvoid */ 1
582     };
583 
584     struct iovec xcb_parts[4];
585     xcb_void_cookie_t xcb_ret;
586     xcb_dri2_destroy_drawable_request_t xcb_out;
587 
588     xcb_out.drawable = drawable;
589 
590     xcb_parts[2].iov_base = (char *) &xcb_out;
591     xcb_parts[2].iov_len = sizeof(xcb_out);
592     xcb_parts[3].iov_base = 0;
593     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
594     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
595     return xcb_ret;
596 }
597 
598 
599 /*****************************************************************************
600  **
601  ** xcb_void_cookie_t xcb_dri2_destroy_drawable
602  **
603  ** @param xcb_connection_t *c
604  ** @param xcb_drawable_t    drawable
605  ** @returns xcb_void_cookie_t
606  **
607  *****************************************************************************/
608 
609 xcb_void_cookie_t
610 xcb_dri2_destroy_drawable (xcb_connection_t *c  /**< */,
611                            xcb_drawable_t    drawable  /**< */)
612 {
613     static const xcb_protocol_request_t xcb_req = {
614         /* count */ 2,
615         /* ext */ &xcb_dri2_id,
616         /* opcode */ XCB_DRI2_DESTROY_DRAWABLE,
617         /* isvoid */ 1
618     };
619 
620     struct iovec xcb_parts[4];
621     xcb_void_cookie_t xcb_ret;
622     xcb_dri2_destroy_drawable_request_t xcb_out;
623 
624     xcb_out.drawable = drawable;
625 
626     xcb_parts[2].iov_base = (char *) &xcb_out;
627     xcb_parts[2].iov_len = sizeof(xcb_out);
628     xcb_parts[3].iov_base = 0;
629     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
630     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
631     return xcb_ret;
632 }
633 
634 
635 /*****************************************************************************
636  **
637  ** xcb_dri2_get_buffers_cookie_t xcb_dri2_get_buffers
638  **
639  ** @param xcb_connection_t *c
640  ** @param xcb_drawable_t    drawable
641  ** @param uint32_t          count
642  ** @param uint32_t          attachments_len
643  ** @param const uint32_t   *attachments
644  ** @returns xcb_dri2_get_buffers_cookie_t
645  **
646  *****************************************************************************/
647 
648 xcb_dri2_get_buffers_cookie_t
649 xcb_dri2_get_buffers (xcb_connection_t *c  /**< */,
650                       xcb_drawable_t    drawable  /**< */,
651                       uint32_t          count  /**< */,
652                       uint32_t          attachments_len  /**< */,
653                       const uint32_t   *attachments  /**< */)
654 {
655     static const xcb_protocol_request_t xcb_req = {
656         /* count */ 4,
657         /* ext */ &xcb_dri2_id,
658         /* opcode */ XCB_DRI2_GET_BUFFERS,
659         /* isvoid */ 0
660     };
661 
662     struct iovec xcb_parts[6];
663     xcb_dri2_get_buffers_cookie_t xcb_ret;
664     xcb_dri2_get_buffers_request_t xcb_out;
665 
666     xcb_out.drawable = drawable;
667     xcb_out.count = count;
668 
669     xcb_parts[2].iov_base = (char *) &xcb_out;
670     xcb_parts[2].iov_len = sizeof(xcb_out);
671     xcb_parts[3].iov_base = 0;
672     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
673     xcb_parts[4].iov_base = (char *) attachments;
674     xcb_parts[4].iov_len = attachments_len * sizeof(uint32_t);
675     xcb_parts[5].iov_base = 0;
676     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
677     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
678     return xcb_ret;
679 }
680 
681 
682 /*****************************************************************************
683  **
684  ** xcb_dri2_get_buffers_cookie_t xcb_dri2_get_buffers_unchecked
685  **
686  ** @param xcb_connection_t *c
687  ** @param xcb_drawable_t    drawable
688  ** @param uint32_t          count
689  ** @param uint32_t          attachments_len
690  ** @param const uint32_t   *attachments
691  ** @returns xcb_dri2_get_buffers_cookie_t
692  **
693  *****************************************************************************/
694 
695 xcb_dri2_get_buffers_cookie_t
696 xcb_dri2_get_buffers_unchecked (xcb_connection_t *c  /**< */,
697                                 xcb_drawable_t    drawable  /**< */,
698                                 uint32_t          count  /**< */,
699                                 uint32_t          attachments_len  /**< */,
700                                 const uint32_t   *attachments  /**< */)
701 {
702     static const xcb_protocol_request_t xcb_req = {
703         /* count */ 4,
704         /* ext */ &xcb_dri2_id,
705         /* opcode */ XCB_DRI2_GET_BUFFERS,
706         /* isvoid */ 0
707     };
708 
709     struct iovec xcb_parts[6];
710     xcb_dri2_get_buffers_cookie_t xcb_ret;
711     xcb_dri2_get_buffers_request_t xcb_out;
712 
713     xcb_out.drawable = drawable;
714     xcb_out.count = count;
715 
716     xcb_parts[2].iov_base = (char *) &xcb_out;
717     xcb_parts[2].iov_len = sizeof(xcb_out);
718     xcb_parts[3].iov_base = 0;
719     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
720     xcb_parts[4].iov_base = (char *) attachments;
721     xcb_parts[4].iov_len = attachments_len * sizeof(uint32_t);
722     xcb_parts[5].iov_base = 0;
723     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
724     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
725     return xcb_ret;
726 }
727 
728 
729 /*****************************************************************************
730  **
731  ** xcb_dri2_dri2_buffer_t * xcb_dri2_get_buffers_buffers
732  **
733  ** @param const xcb_dri2_get_buffers_reply_t *R
734  ** @returns xcb_dri2_dri2_buffer_t *
735  **
736  *****************************************************************************/
737 
738 xcb_dri2_dri2_buffer_t *
739 xcb_dri2_get_buffers_buffers (const xcb_dri2_get_buffers_reply_t *R  /**< */)
740 {
741     return (xcb_dri2_dri2_buffer_t *) (R + 1);
742 }
743 
744 
745 /*****************************************************************************
746  **
747  ** int xcb_dri2_get_buffers_buffers_length
748  **
749  ** @param const xcb_dri2_get_buffers_reply_t *R
750  ** @returns int
751  **
752  *****************************************************************************/
753 
754 int
755 xcb_dri2_get_buffers_buffers_length (const xcb_dri2_get_buffers_reply_t *R  /**< */)
756 {
757     return R->count;
758 }
759 
760 
761 /*****************************************************************************
762  **
763  ** xcb_dri2_dri2_buffer_iterator_t xcb_dri2_get_buffers_buffers_iterator
764  **
765  ** @param const xcb_dri2_get_buffers_reply_t *R
766  ** @returns xcb_dri2_dri2_buffer_iterator_t
767  **
768  *****************************************************************************/
769 
770 xcb_dri2_dri2_buffer_iterator_t
771 xcb_dri2_get_buffers_buffers_iterator (const xcb_dri2_get_buffers_reply_t *R  /**< */)
772 {
773     xcb_dri2_dri2_buffer_iterator_t i;
774     i.data = (xcb_dri2_dri2_buffer_t *) (R + 1);
775     i.rem = R->count;
776     i.index = (char *) i.data - (char *) R;
777     return i;
778 }
779 
780 
781 /*****************************************************************************
782  **
783  ** xcb_dri2_get_buffers_reply_t * xcb_dri2_get_buffers_reply
784  **
785  ** @param xcb_connection_t               *c
786  ** @param xcb_dri2_get_buffers_cookie_t   cookie
787  ** @param xcb_generic_error_t           **e
788  ** @returns xcb_dri2_get_buffers_reply_t *
789  **
790  *****************************************************************************/
791 
792 xcb_dri2_get_buffers_reply_t *
793 xcb_dri2_get_buffers_reply (xcb_connection_t               *c  /**< */,
794                             xcb_dri2_get_buffers_cookie_t   cookie  /**< */,
795                             xcb_generic_error_t           **e  /**< */)
796 {
797     return (xcb_dri2_get_buffers_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
798 }
799 
800 
801 /*****************************************************************************
802  **
803  ** xcb_dri2_copy_region_cookie_t xcb_dri2_copy_region
804  **
805  ** @param xcb_connection_t *c
806  ** @param xcb_drawable_t    drawable
807  ** @param uint32_t          region
808  ** @param uint32_t          dest
809  ** @param uint32_t          src
810  ** @returns xcb_dri2_copy_region_cookie_t
811  **
812  *****************************************************************************/
813 
814 xcb_dri2_copy_region_cookie_t
815 xcb_dri2_copy_region (xcb_connection_t *c  /**< */,
816                       xcb_drawable_t    drawable  /**< */,
817                       uint32_t          region  /**< */,
818                       uint32_t          dest  /**< */,
819                       uint32_t          src  /**< */)
820 {
821     static const xcb_protocol_request_t xcb_req = {
822         /* count */ 2,
823         /* ext */ &xcb_dri2_id,
824         /* opcode */ XCB_DRI2_COPY_REGION,
825         /* isvoid */ 0
826     };
827 
828     struct iovec xcb_parts[4];
829     xcb_dri2_copy_region_cookie_t xcb_ret;
830     xcb_dri2_copy_region_request_t xcb_out;
831 
832     xcb_out.drawable = drawable;
833     xcb_out.region = region;
834     xcb_out.dest = dest;
835     xcb_out.src = src;
836 
837     xcb_parts[2].iov_base = (char *) &xcb_out;
838     xcb_parts[2].iov_len = sizeof(xcb_out);
839     xcb_parts[3].iov_base = 0;
840     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
841     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
842     return xcb_ret;
843 }
844 
845 
846 /*****************************************************************************
847  **
848  ** xcb_dri2_copy_region_cookie_t xcb_dri2_copy_region_unchecked
849  **
850  ** @param xcb_connection_t *c
851  ** @param xcb_drawable_t    drawable
852  ** @param uint32_t          region
853  ** @param uint32_t          dest
854  ** @param uint32_t          src
855  ** @returns xcb_dri2_copy_region_cookie_t
856  **
857  *****************************************************************************/
858 
859 xcb_dri2_copy_region_cookie_t
860 xcb_dri2_copy_region_unchecked (xcb_connection_t *c  /**< */,
861                                 xcb_drawable_t    drawable  /**< */,
862                                 uint32_t          region  /**< */,
863                                 uint32_t          dest  /**< */,
864                                 uint32_t          src  /**< */)
865 {
866     static const xcb_protocol_request_t xcb_req = {
867         /* count */ 2,
868         /* ext */ &xcb_dri2_id,
869         /* opcode */ XCB_DRI2_COPY_REGION,
870         /* isvoid */ 0
871     };
872 
873     struct iovec xcb_parts[4];
874     xcb_dri2_copy_region_cookie_t xcb_ret;
875     xcb_dri2_copy_region_request_t xcb_out;
876 
877     xcb_out.drawable = drawable;
878     xcb_out.region = region;
879     xcb_out.dest = dest;
880     xcb_out.src = src;
881 
882     xcb_parts[2].iov_base = (char *) &xcb_out;
883     xcb_parts[2].iov_len = sizeof(xcb_out);
884     xcb_parts[3].iov_base = 0;
885     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
886     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
887     return xcb_ret;
888 }
889 
890 
891 /*****************************************************************************
892  **
893  ** xcb_dri2_copy_region_reply_t * xcb_dri2_copy_region_reply
894  **
895  ** @param xcb_connection_t               *c
896  ** @param xcb_dri2_copy_region_cookie_t   cookie
897  ** @param xcb_generic_error_t           **e
898  ** @returns xcb_dri2_copy_region_reply_t *
899  **
900  *****************************************************************************/
901 
902 xcb_dri2_copy_region_reply_t *
903 xcb_dri2_copy_region_reply (xcb_connection_t               *c  /**< */,
904                             xcb_dri2_copy_region_cookie_t   cookie  /**< */,
905                             xcb_generic_error_t           **e  /**< */)
906 {
907     return (xcb_dri2_copy_region_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
908 }
909 
910 
911 /*****************************************************************************
912  **
913  ** xcb_dri2_get_buffers_with_format_cookie_t xcb_dri2_get_buffers_with_format
914  **
915  ** @param xcb_connection_t               *c
916  ** @param xcb_drawable_t                  drawable
917  ** @param uint32_t                        count
918  ** @param uint32_t                        attachments_len
919  ** @param const xcb_dri2_attach_format_t *attachments
920  ** @returns xcb_dri2_get_buffers_with_format_cookie_t
921  **
922  *****************************************************************************/
923 
924 xcb_dri2_get_buffers_with_format_cookie_t
925 xcb_dri2_get_buffers_with_format (xcb_connection_t               *c  /**< */,
926                                   xcb_drawable_t                  drawable  /**< */,
927                                   uint32_t                        count  /**< */,
928                                   uint32_t                        attachments_len  /**< */,
929                                   const xcb_dri2_attach_format_t *attachments  /**< */)
930 {
931     static const xcb_protocol_request_t xcb_req = {
932         /* count */ 4,
933         /* ext */ &xcb_dri2_id,
934         /* opcode */ XCB_DRI2_GET_BUFFERS_WITH_FORMAT,
935         /* isvoid */ 0
936     };
937 
938     struct iovec xcb_parts[6];
939     xcb_dri2_get_buffers_with_format_cookie_t xcb_ret;
940     xcb_dri2_get_buffers_with_format_request_t xcb_out;
941 
942     xcb_out.drawable = drawable;
943     xcb_out.count = count;
944 
945     xcb_parts[2].iov_base = (char *) &xcb_out;
946     xcb_parts[2].iov_len = sizeof(xcb_out);
947     xcb_parts[3].iov_base = 0;
948     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
949     xcb_parts[4].iov_base = (char *) attachments;
950     xcb_parts[4].iov_len = attachments_len * sizeof(xcb_dri2_attach_format_t);
951     xcb_parts[5].iov_base = 0;
952     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
953     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
954     return xcb_ret;
955 }
956 
957 
958 /*****************************************************************************
959  **
960  ** xcb_dri2_get_buffers_with_format_cookie_t xcb_dri2_get_buffers_with_format_unchecked
961  **
962  ** @param xcb_connection_t               *c
963  ** @param xcb_drawable_t                  drawable
964  ** @param uint32_t                        count
965  ** @param uint32_t                        attachments_len
966  ** @param const xcb_dri2_attach_format_t *attachments
967  ** @returns xcb_dri2_get_buffers_with_format_cookie_t
968  **
969  *****************************************************************************/
970 
971 xcb_dri2_get_buffers_with_format_cookie_t
972 xcb_dri2_get_buffers_with_format_unchecked (xcb_connection_t               *c  /**< */,
973                                             xcb_drawable_t                  drawable  /**< */,
974                                             uint32_t                        count  /**< */,
975                                             uint32_t                        attachments_len  /**< */,
976                                             const xcb_dri2_attach_format_t *attachments  /**< */)
977 {
978     static const xcb_protocol_request_t xcb_req = {
979         /* count */ 4,
980         /* ext */ &xcb_dri2_id,
981         /* opcode */ XCB_DRI2_GET_BUFFERS_WITH_FORMAT,
982         /* isvoid */ 0
983     };
984 
985     struct iovec xcb_parts[6];
986     xcb_dri2_get_buffers_with_format_cookie_t xcb_ret;
987     xcb_dri2_get_buffers_with_format_request_t xcb_out;
988 
989     xcb_out.drawable = drawable;
990     xcb_out.count = count;
991 
992     xcb_parts[2].iov_base = (char *) &xcb_out;
993     xcb_parts[2].iov_len = sizeof(xcb_out);
994     xcb_parts[3].iov_base = 0;
995     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
996     xcb_parts[4].iov_base = (char *) attachments;
997     xcb_parts[4].iov_len = attachments_len * sizeof(xcb_dri2_attach_format_t);
998     xcb_parts[5].iov_base = 0;
999     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1000     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
1001     return xcb_ret;
1002 }
1003 
1004 
1005 /*****************************************************************************
1006  **
1007  ** xcb_dri2_dri2_buffer_t * xcb_dri2_get_buffers_with_format_buffers
1008  **
1009  ** @param const xcb_dri2_get_buffers_with_format_reply_t *R
1010  ** @returns xcb_dri2_dri2_buffer_t *
1011  **
1012  *****************************************************************************/
1013 
1014 xcb_dri2_dri2_buffer_t *
1015 xcb_dri2_get_buffers_with_format_buffers (const xcb_dri2_get_buffers_with_format_reply_t *R  /**< */)
1016 {
1017     return (xcb_dri2_dri2_buffer_t *) (R + 1);
1018 }
1019 
1020 
1021 /*****************************************************************************
1022  **
1023  ** int xcb_dri2_get_buffers_with_format_buffers_length
1024  **
1025  ** @param const xcb_dri2_get_buffers_with_format_reply_t *R
1026  ** @returns int
1027  **
1028  *****************************************************************************/
1029 
1030 int
1031 xcb_dri2_get_buffers_with_format_buffers_length (const xcb_dri2_get_buffers_with_format_reply_t *R  /**< */)
1032 {
1033     return R->count;
1034 }
1035 
1036 
1037 /*****************************************************************************
1038  **
1039  ** xcb_dri2_dri2_buffer_iterator_t xcb_dri2_get_buffers_with_format_buffers_iterator
1040  **
1041  ** @param const xcb_dri2_get_buffers_with_format_reply_t *R
1042  ** @returns xcb_dri2_dri2_buffer_iterator_t
1043  **
1044  *****************************************************************************/
1045 
1046 xcb_dri2_dri2_buffer_iterator_t
1047 xcb_dri2_get_buffers_with_format_buffers_iterator (const xcb_dri2_get_buffers_with_format_reply_t *R  /**< */)
1048 {
1049     xcb_dri2_dri2_buffer_iterator_t i;
1050     i.data = (xcb_dri2_dri2_buffer_t *) (R + 1);
1051     i.rem = R->count;
1052     i.index = (char *) i.data - (char *) R;
1053     return i;
1054 }
1055 
1056 
1057 /*****************************************************************************
1058  **
1059  ** xcb_dri2_get_buffers_with_format_reply_t * xcb_dri2_get_buffers_with_format_reply
1060  **
1061  ** @param xcb_connection_t                           *c
1062  ** @param xcb_dri2_get_buffers_with_format_cookie_t   cookie
1063  ** @param xcb_generic_error_t                       **e
1064  ** @returns xcb_dri2_get_buffers_with_format_reply_t *
1065  **
1066  *****************************************************************************/
1067 
1068 xcb_dri2_get_buffers_with_format_reply_t *
1069 xcb_dri2_get_buffers_with_format_reply (xcb_connection_t                           *c  /**< */,
1070                                         xcb_dri2_get_buffers_with_format_cookie_t   cookie  /**< */,
1071                                         xcb_generic_error_t                       **e  /**< */)
1072 {
1073     return (xcb_dri2_get_buffers_with_format_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1074 }
1075 
1076