Home | History | Annotate | Line # | Download | only in files
      1 /*
      2  * This file generated automatically from xf86dri.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 "xf86dri.h"
     15 
     16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
     17 
     18 xcb_extension_t xcb_xf86dri_id = { "XFree86-DRI", 0 };
     19 
     20 void
     21 xcb_xf86dri_drm_clip_rect_next (xcb_xf86dri_drm_clip_rect_iterator_t *i)
     22 {
     23     --i->rem;
     24     ++i->data;
     25     i->index += sizeof(xcb_xf86dri_drm_clip_rect_t);
     26 }
     27 
     28 xcb_generic_iterator_t
     29 xcb_xf86dri_drm_clip_rect_end (xcb_xf86dri_drm_clip_rect_iterator_t i)
     30 {
     31     xcb_generic_iterator_t ret;
     32     ret.data = i.data + i.rem;
     33     ret.index = i.index + ((char *) ret.data - (char *) i.data);
     34     ret.rem = 0;
     35     return ret;
     36 }
     37 
     38 xcb_xf86dri_query_version_cookie_t
     39 xcb_xf86dri_query_version (xcb_connection_t *c)
     40 {
     41     static const xcb_protocol_request_t xcb_req = {
     42         .count = 2,
     43         .ext = &xcb_xf86dri_id,
     44         .opcode = XCB_XF86DRI_QUERY_VERSION,
     45         .isvoid = 0
     46     };
     47 
     48     struct iovec xcb_parts[4];
     49     xcb_xf86dri_query_version_cookie_t xcb_ret;
     50     xcb_xf86dri_query_version_request_t xcb_out;
     51 
     52 
     53     xcb_parts[2].iov_base = (char *) &xcb_out;
     54     xcb_parts[2].iov_len = sizeof(xcb_out);
     55     xcb_parts[3].iov_base = 0;
     56     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
     57 
     58     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
     59     return xcb_ret;
     60 }
     61 
     62 xcb_xf86dri_query_version_cookie_t
     63 xcb_xf86dri_query_version_unchecked (xcb_connection_t *c)
     64 {
     65     static const xcb_protocol_request_t xcb_req = {
     66         .count = 2,
     67         .ext = &xcb_xf86dri_id,
     68         .opcode = XCB_XF86DRI_QUERY_VERSION,
     69         .isvoid = 0
     70     };
     71 
     72     struct iovec xcb_parts[4];
     73     xcb_xf86dri_query_version_cookie_t xcb_ret;
     74     xcb_xf86dri_query_version_request_t xcb_out;
     75 
     76 
     77     xcb_parts[2].iov_base = (char *) &xcb_out;
     78     xcb_parts[2].iov_len = sizeof(xcb_out);
     79     xcb_parts[3].iov_base = 0;
     80     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
     81 
     82     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
     83     return xcb_ret;
     84 }
     85 
     86 xcb_xf86dri_query_version_reply_t *
     87 xcb_xf86dri_query_version_reply (xcb_connection_t                    *c,
     88                                  xcb_xf86dri_query_version_cookie_t   cookie  /**< */,
     89                                  xcb_generic_error_t                **e)
     90 {
     91     return (xcb_xf86dri_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
     92 }
     93 
     94 xcb_xf86dri_query_direct_rendering_capable_cookie_t
     95 xcb_xf86dri_query_direct_rendering_capable (xcb_connection_t *c,
     96                                             uint32_t          screen)
     97 {
     98     static const xcb_protocol_request_t xcb_req = {
     99         .count = 2,
    100         .ext = &xcb_xf86dri_id,
    101         .opcode = XCB_XF86DRI_QUERY_DIRECT_RENDERING_CAPABLE,
    102         .isvoid = 0
    103     };
    104 
    105     struct iovec xcb_parts[4];
    106     xcb_xf86dri_query_direct_rendering_capable_cookie_t xcb_ret;
    107     xcb_xf86dri_query_direct_rendering_capable_request_t xcb_out;
    108 
    109     xcb_out.screen = screen;
    110 
    111     xcb_parts[2].iov_base = (char *) &xcb_out;
    112     xcb_parts[2].iov_len = sizeof(xcb_out);
    113     xcb_parts[3].iov_base = 0;
    114     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    115 
    116     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    117     return xcb_ret;
    118 }
    119 
    120 xcb_xf86dri_query_direct_rendering_capable_cookie_t
    121 xcb_xf86dri_query_direct_rendering_capable_unchecked (xcb_connection_t *c,
    122                                                       uint32_t          screen)
    123 {
    124     static const xcb_protocol_request_t xcb_req = {
    125         .count = 2,
    126         .ext = &xcb_xf86dri_id,
    127         .opcode = XCB_XF86DRI_QUERY_DIRECT_RENDERING_CAPABLE,
    128         .isvoid = 0
    129     };
    130 
    131     struct iovec xcb_parts[4];
    132     xcb_xf86dri_query_direct_rendering_capable_cookie_t xcb_ret;
    133     xcb_xf86dri_query_direct_rendering_capable_request_t xcb_out;
    134 
    135     xcb_out.screen = screen;
    136 
    137     xcb_parts[2].iov_base = (char *) &xcb_out;
    138     xcb_parts[2].iov_len = sizeof(xcb_out);
    139     xcb_parts[3].iov_base = 0;
    140     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    141 
    142     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    143     return xcb_ret;
    144 }
    145 
    146 xcb_xf86dri_query_direct_rendering_capable_reply_t *
    147 xcb_xf86dri_query_direct_rendering_capable_reply (xcb_connection_t                                     *c,
    148                                                   xcb_xf86dri_query_direct_rendering_capable_cookie_t   cookie  /**< */,
    149                                                   xcb_generic_error_t                                 **e)
    150 {
    151     return (xcb_xf86dri_query_direct_rendering_capable_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    152 }
    153 
    154 int
    155 xcb_xf86dri_open_connection_sizeof (const void  *_buffer)
    156 {
    157     char *xcb_tmp = (char *)_buffer;
    158     const xcb_xf86dri_open_connection_reply_t *_aux = (xcb_xf86dri_open_connection_reply_t *)_buffer;
    159     unsigned int xcb_buffer_len = 0;
    160     unsigned int xcb_block_len = 0;
    161     unsigned int xcb_pad = 0;
    162     unsigned int xcb_align_to = 0;
    163 
    164 
    165     xcb_block_len += sizeof(xcb_xf86dri_open_connection_reply_t);
    166     xcb_tmp += xcb_block_len;
    167     xcb_buffer_len += xcb_block_len;
    168     xcb_block_len = 0;
    169     /* bus_id */
    170     xcb_block_len += _aux->bus_id_len * sizeof(char);
    171     xcb_tmp += xcb_block_len;
    172     xcb_align_to = ALIGNOF(char);
    173     /* insert padding */
    174     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    175     xcb_buffer_len += xcb_block_len + xcb_pad;
    176     if (0 != xcb_pad) {
    177         xcb_tmp += xcb_pad;
    178         xcb_pad = 0;
    179     }
    180     xcb_block_len = 0;
    181 
    182     return xcb_buffer_len;
    183 }
    184 
    185 xcb_xf86dri_open_connection_cookie_t
    186 xcb_xf86dri_open_connection (xcb_connection_t *c,
    187                              uint32_t          screen)
    188 {
    189     static const xcb_protocol_request_t xcb_req = {
    190         .count = 2,
    191         .ext = &xcb_xf86dri_id,
    192         .opcode = XCB_XF86DRI_OPEN_CONNECTION,
    193         .isvoid = 0
    194     };
    195 
    196     struct iovec xcb_parts[4];
    197     xcb_xf86dri_open_connection_cookie_t xcb_ret;
    198     xcb_xf86dri_open_connection_request_t xcb_out;
    199 
    200     xcb_out.screen = screen;
    201 
    202     xcb_parts[2].iov_base = (char *) &xcb_out;
    203     xcb_parts[2].iov_len = sizeof(xcb_out);
    204     xcb_parts[3].iov_base = 0;
    205     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    206 
    207     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    208     return xcb_ret;
    209 }
    210 
    211 xcb_xf86dri_open_connection_cookie_t
    212 xcb_xf86dri_open_connection_unchecked (xcb_connection_t *c,
    213                                        uint32_t          screen)
    214 {
    215     static const xcb_protocol_request_t xcb_req = {
    216         .count = 2,
    217         .ext = &xcb_xf86dri_id,
    218         .opcode = XCB_XF86DRI_OPEN_CONNECTION,
    219         .isvoid = 0
    220     };
    221 
    222     struct iovec xcb_parts[4];
    223     xcb_xf86dri_open_connection_cookie_t xcb_ret;
    224     xcb_xf86dri_open_connection_request_t xcb_out;
    225 
    226     xcb_out.screen = screen;
    227 
    228     xcb_parts[2].iov_base = (char *) &xcb_out;
    229     xcb_parts[2].iov_len = sizeof(xcb_out);
    230     xcb_parts[3].iov_base = 0;
    231     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    232 
    233     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    234     return xcb_ret;
    235 }
    236 
    237 char *
    238 xcb_xf86dri_open_connection_bus_id (const xcb_xf86dri_open_connection_reply_t *R)
    239 {
    240     return (char *) (R + 1);
    241 }
    242 
    243 int
    244 xcb_xf86dri_open_connection_bus_id_length (const xcb_xf86dri_open_connection_reply_t *R)
    245 {
    246     return R->bus_id_len;
    247 }
    248 
    249 xcb_generic_iterator_t
    250 xcb_xf86dri_open_connection_bus_id_end (const xcb_xf86dri_open_connection_reply_t *R)
    251 {
    252     xcb_generic_iterator_t i;
    253     i.data = ((char *) (R + 1)) + (R->bus_id_len);
    254     i.rem = 0;
    255     i.index = (char *) i.data - (char *) R;
    256     return i;
    257 }
    258 
    259 xcb_xf86dri_open_connection_reply_t *
    260 xcb_xf86dri_open_connection_reply (xcb_connection_t                      *c,
    261                                    xcb_xf86dri_open_connection_cookie_t   cookie  /**< */,
    262                                    xcb_generic_error_t                  **e)
    263 {
    264     return (xcb_xf86dri_open_connection_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    265 }
    266 
    267 xcb_void_cookie_t
    268 xcb_xf86dri_close_connection_checked (xcb_connection_t *c,
    269                                       uint32_t          screen)
    270 {
    271     static const xcb_protocol_request_t xcb_req = {
    272         .count = 2,
    273         .ext = &xcb_xf86dri_id,
    274         .opcode = XCB_XF86DRI_CLOSE_CONNECTION,
    275         .isvoid = 1
    276     };
    277 
    278     struct iovec xcb_parts[4];
    279     xcb_void_cookie_t xcb_ret;
    280     xcb_xf86dri_close_connection_request_t xcb_out;
    281 
    282     xcb_out.screen = screen;
    283 
    284     xcb_parts[2].iov_base = (char *) &xcb_out;
    285     xcb_parts[2].iov_len = sizeof(xcb_out);
    286     xcb_parts[3].iov_base = 0;
    287     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    288 
    289     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    290     return xcb_ret;
    291 }
    292 
    293 xcb_void_cookie_t
    294 xcb_xf86dri_close_connection (xcb_connection_t *c,
    295                               uint32_t          screen)
    296 {
    297     static const xcb_protocol_request_t xcb_req = {
    298         .count = 2,
    299         .ext = &xcb_xf86dri_id,
    300         .opcode = XCB_XF86DRI_CLOSE_CONNECTION,
    301         .isvoid = 1
    302     };
    303 
    304     struct iovec xcb_parts[4];
    305     xcb_void_cookie_t xcb_ret;
    306     xcb_xf86dri_close_connection_request_t xcb_out;
    307 
    308     xcb_out.screen = screen;
    309 
    310     xcb_parts[2].iov_base = (char *) &xcb_out;
    311     xcb_parts[2].iov_len = sizeof(xcb_out);
    312     xcb_parts[3].iov_base = 0;
    313     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    314 
    315     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    316     return xcb_ret;
    317 }
    318 
    319 int
    320 xcb_xf86dri_get_client_driver_name_sizeof (const void  *_buffer)
    321 {
    322     char *xcb_tmp = (char *)_buffer;
    323     const xcb_xf86dri_get_client_driver_name_reply_t *_aux = (xcb_xf86dri_get_client_driver_name_reply_t *)_buffer;
    324     unsigned int xcb_buffer_len = 0;
    325     unsigned int xcb_block_len = 0;
    326     unsigned int xcb_pad = 0;
    327     unsigned int xcb_align_to = 0;
    328 
    329 
    330     xcb_block_len += sizeof(xcb_xf86dri_get_client_driver_name_reply_t);
    331     xcb_tmp += xcb_block_len;
    332     xcb_buffer_len += xcb_block_len;
    333     xcb_block_len = 0;
    334     /* client_driver_name */
    335     xcb_block_len += _aux->client_driver_name_len * sizeof(char);
    336     xcb_tmp += xcb_block_len;
    337     xcb_align_to = ALIGNOF(char);
    338     /* insert padding */
    339     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    340     xcb_buffer_len += xcb_block_len + xcb_pad;
    341     if (0 != xcb_pad) {
    342         xcb_tmp += xcb_pad;
    343         xcb_pad = 0;
    344     }
    345     xcb_block_len = 0;
    346 
    347     return xcb_buffer_len;
    348 }
    349 
    350 xcb_xf86dri_get_client_driver_name_cookie_t
    351 xcb_xf86dri_get_client_driver_name (xcb_connection_t *c,
    352                                     uint32_t          screen)
    353 {
    354     static const xcb_protocol_request_t xcb_req = {
    355         .count = 2,
    356         .ext = &xcb_xf86dri_id,
    357         .opcode = XCB_XF86DRI_GET_CLIENT_DRIVER_NAME,
    358         .isvoid = 0
    359     };
    360 
    361     struct iovec xcb_parts[4];
    362     xcb_xf86dri_get_client_driver_name_cookie_t xcb_ret;
    363     xcb_xf86dri_get_client_driver_name_request_t xcb_out;
    364 
    365     xcb_out.screen = screen;
    366 
    367     xcb_parts[2].iov_base = (char *) &xcb_out;
    368     xcb_parts[2].iov_len = sizeof(xcb_out);
    369     xcb_parts[3].iov_base = 0;
    370     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    371 
    372     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    373     return xcb_ret;
    374 }
    375 
    376 xcb_xf86dri_get_client_driver_name_cookie_t
    377 xcb_xf86dri_get_client_driver_name_unchecked (xcb_connection_t *c,
    378                                               uint32_t          screen)
    379 {
    380     static const xcb_protocol_request_t xcb_req = {
    381         .count = 2,
    382         .ext = &xcb_xf86dri_id,
    383         .opcode = XCB_XF86DRI_GET_CLIENT_DRIVER_NAME,
    384         .isvoid = 0
    385     };
    386 
    387     struct iovec xcb_parts[4];
    388     xcb_xf86dri_get_client_driver_name_cookie_t xcb_ret;
    389     xcb_xf86dri_get_client_driver_name_request_t xcb_out;
    390 
    391     xcb_out.screen = screen;
    392 
    393     xcb_parts[2].iov_base = (char *) &xcb_out;
    394     xcb_parts[2].iov_len = sizeof(xcb_out);
    395     xcb_parts[3].iov_base = 0;
    396     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    397 
    398     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    399     return xcb_ret;
    400 }
    401 
    402 char *
    403 xcb_xf86dri_get_client_driver_name_client_driver_name (const xcb_xf86dri_get_client_driver_name_reply_t *R)
    404 {
    405     return (char *) (R + 1);
    406 }
    407 
    408 int
    409 xcb_xf86dri_get_client_driver_name_client_driver_name_length (const xcb_xf86dri_get_client_driver_name_reply_t *R)
    410 {
    411     return R->client_driver_name_len;
    412 }
    413 
    414 xcb_generic_iterator_t
    415 xcb_xf86dri_get_client_driver_name_client_driver_name_end (const xcb_xf86dri_get_client_driver_name_reply_t *R)
    416 {
    417     xcb_generic_iterator_t i;
    418     i.data = ((char *) (R + 1)) + (R->client_driver_name_len);
    419     i.rem = 0;
    420     i.index = (char *) i.data - (char *) R;
    421     return i;
    422 }
    423 
    424 xcb_xf86dri_get_client_driver_name_reply_t *
    425 xcb_xf86dri_get_client_driver_name_reply (xcb_connection_t                             *c,
    426                                           xcb_xf86dri_get_client_driver_name_cookie_t   cookie  /**< */,
    427                                           xcb_generic_error_t                         **e)
    428 {
    429     return (xcb_xf86dri_get_client_driver_name_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    430 }
    431 
    432 xcb_xf86dri_create_context_cookie_t
    433 xcb_xf86dri_create_context (xcb_connection_t *c,
    434                             uint32_t          screen,
    435                             uint32_t          visual,
    436                             uint32_t          context)
    437 {
    438     static const xcb_protocol_request_t xcb_req = {
    439         .count = 2,
    440         .ext = &xcb_xf86dri_id,
    441         .opcode = XCB_XF86DRI_CREATE_CONTEXT,
    442         .isvoid = 0
    443     };
    444 
    445     struct iovec xcb_parts[4];
    446     xcb_xf86dri_create_context_cookie_t xcb_ret;
    447     xcb_xf86dri_create_context_request_t xcb_out;
    448 
    449     xcb_out.screen = screen;
    450     xcb_out.visual = visual;
    451     xcb_out.context = context;
    452 
    453     xcb_parts[2].iov_base = (char *) &xcb_out;
    454     xcb_parts[2].iov_len = sizeof(xcb_out);
    455     xcb_parts[3].iov_base = 0;
    456     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    457 
    458     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    459     return xcb_ret;
    460 }
    461 
    462 xcb_xf86dri_create_context_cookie_t
    463 xcb_xf86dri_create_context_unchecked (xcb_connection_t *c,
    464                                       uint32_t          screen,
    465                                       uint32_t          visual,
    466                                       uint32_t          context)
    467 {
    468     static const xcb_protocol_request_t xcb_req = {
    469         .count = 2,
    470         .ext = &xcb_xf86dri_id,
    471         .opcode = XCB_XF86DRI_CREATE_CONTEXT,
    472         .isvoid = 0
    473     };
    474 
    475     struct iovec xcb_parts[4];
    476     xcb_xf86dri_create_context_cookie_t xcb_ret;
    477     xcb_xf86dri_create_context_request_t xcb_out;
    478 
    479     xcb_out.screen = screen;
    480     xcb_out.visual = visual;
    481     xcb_out.context = context;
    482 
    483     xcb_parts[2].iov_base = (char *) &xcb_out;
    484     xcb_parts[2].iov_len = sizeof(xcb_out);
    485     xcb_parts[3].iov_base = 0;
    486     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    487 
    488     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    489     return xcb_ret;
    490 }
    491 
    492 xcb_xf86dri_create_context_reply_t *
    493 xcb_xf86dri_create_context_reply (xcb_connection_t                     *c,
    494                                   xcb_xf86dri_create_context_cookie_t   cookie  /**< */,
    495                                   xcb_generic_error_t                 **e)
    496 {
    497     return (xcb_xf86dri_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    498 }
    499 
    500 xcb_void_cookie_t
    501 xcb_xf86dri_destroy_context_checked (xcb_connection_t *c,
    502                                      uint32_t          screen,
    503                                      uint32_t          context)
    504 {
    505     static const xcb_protocol_request_t xcb_req = {
    506         .count = 2,
    507         .ext = &xcb_xf86dri_id,
    508         .opcode = XCB_XF86DRI_DESTROY_CONTEXT,
    509         .isvoid = 1
    510     };
    511 
    512     struct iovec xcb_parts[4];
    513     xcb_void_cookie_t xcb_ret;
    514     xcb_xf86dri_destroy_context_request_t xcb_out;
    515 
    516     xcb_out.screen = screen;
    517     xcb_out.context = context;
    518 
    519     xcb_parts[2].iov_base = (char *) &xcb_out;
    520     xcb_parts[2].iov_len = sizeof(xcb_out);
    521     xcb_parts[3].iov_base = 0;
    522     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    523 
    524     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    525     return xcb_ret;
    526 }
    527 
    528 xcb_void_cookie_t
    529 xcb_xf86dri_destroy_context (xcb_connection_t *c,
    530                              uint32_t          screen,
    531                              uint32_t          context)
    532 {
    533     static const xcb_protocol_request_t xcb_req = {
    534         .count = 2,
    535         .ext = &xcb_xf86dri_id,
    536         .opcode = XCB_XF86DRI_DESTROY_CONTEXT,
    537         .isvoid = 1
    538     };
    539 
    540     struct iovec xcb_parts[4];
    541     xcb_void_cookie_t xcb_ret;
    542     xcb_xf86dri_destroy_context_request_t xcb_out;
    543 
    544     xcb_out.screen = screen;
    545     xcb_out.context = context;
    546 
    547     xcb_parts[2].iov_base = (char *) &xcb_out;
    548     xcb_parts[2].iov_len = sizeof(xcb_out);
    549     xcb_parts[3].iov_base = 0;
    550     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    551 
    552     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    553     return xcb_ret;
    554 }
    555 
    556 xcb_xf86dri_create_drawable_cookie_t
    557 xcb_xf86dri_create_drawable (xcb_connection_t *c,
    558                              uint32_t          screen,
    559                              uint32_t          drawable)
    560 {
    561     static const xcb_protocol_request_t xcb_req = {
    562         .count = 2,
    563         .ext = &xcb_xf86dri_id,
    564         .opcode = XCB_XF86DRI_CREATE_DRAWABLE,
    565         .isvoid = 0
    566     };
    567 
    568     struct iovec xcb_parts[4];
    569     xcb_xf86dri_create_drawable_cookie_t xcb_ret;
    570     xcb_xf86dri_create_drawable_request_t xcb_out;
    571 
    572     xcb_out.screen = screen;
    573     xcb_out.drawable = drawable;
    574 
    575     xcb_parts[2].iov_base = (char *) &xcb_out;
    576     xcb_parts[2].iov_len = sizeof(xcb_out);
    577     xcb_parts[3].iov_base = 0;
    578     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    579 
    580     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    581     return xcb_ret;
    582 }
    583 
    584 xcb_xf86dri_create_drawable_cookie_t
    585 xcb_xf86dri_create_drawable_unchecked (xcb_connection_t *c,
    586                                        uint32_t          screen,
    587                                        uint32_t          drawable)
    588 {
    589     static const xcb_protocol_request_t xcb_req = {
    590         .count = 2,
    591         .ext = &xcb_xf86dri_id,
    592         .opcode = XCB_XF86DRI_CREATE_DRAWABLE,
    593         .isvoid = 0
    594     };
    595 
    596     struct iovec xcb_parts[4];
    597     xcb_xf86dri_create_drawable_cookie_t xcb_ret;
    598     xcb_xf86dri_create_drawable_request_t xcb_out;
    599 
    600     xcb_out.screen = screen;
    601     xcb_out.drawable = drawable;
    602 
    603     xcb_parts[2].iov_base = (char *) &xcb_out;
    604     xcb_parts[2].iov_len = sizeof(xcb_out);
    605     xcb_parts[3].iov_base = 0;
    606     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    607 
    608     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    609     return xcb_ret;
    610 }
    611 
    612 xcb_xf86dri_create_drawable_reply_t *
    613 xcb_xf86dri_create_drawable_reply (xcb_connection_t                      *c,
    614                                    xcb_xf86dri_create_drawable_cookie_t   cookie  /**< */,
    615                                    xcb_generic_error_t                  **e)
    616 {
    617     return (xcb_xf86dri_create_drawable_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    618 }
    619 
    620 xcb_void_cookie_t
    621 xcb_xf86dri_destroy_drawable_checked (xcb_connection_t *c,
    622                                       uint32_t          screen,
    623                                       uint32_t          drawable)
    624 {
    625     static const xcb_protocol_request_t xcb_req = {
    626         .count = 2,
    627         .ext = &xcb_xf86dri_id,
    628         .opcode = XCB_XF86DRI_DESTROY_DRAWABLE,
    629         .isvoid = 1
    630     };
    631 
    632     struct iovec xcb_parts[4];
    633     xcb_void_cookie_t xcb_ret;
    634     xcb_xf86dri_destroy_drawable_request_t xcb_out;
    635 
    636     xcb_out.screen = screen;
    637     xcb_out.drawable = drawable;
    638 
    639     xcb_parts[2].iov_base = (char *) &xcb_out;
    640     xcb_parts[2].iov_len = sizeof(xcb_out);
    641     xcb_parts[3].iov_base = 0;
    642     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    643 
    644     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    645     return xcb_ret;
    646 }
    647 
    648 xcb_void_cookie_t
    649 xcb_xf86dri_destroy_drawable (xcb_connection_t *c,
    650                               uint32_t          screen,
    651                               uint32_t          drawable)
    652 {
    653     static const xcb_protocol_request_t xcb_req = {
    654         .count = 2,
    655         .ext = &xcb_xf86dri_id,
    656         .opcode = XCB_XF86DRI_DESTROY_DRAWABLE,
    657         .isvoid = 1
    658     };
    659 
    660     struct iovec xcb_parts[4];
    661     xcb_void_cookie_t xcb_ret;
    662     xcb_xf86dri_destroy_drawable_request_t xcb_out;
    663 
    664     xcb_out.screen = screen;
    665     xcb_out.drawable = drawable;
    666 
    667     xcb_parts[2].iov_base = (char *) &xcb_out;
    668     xcb_parts[2].iov_len = sizeof(xcb_out);
    669     xcb_parts[3].iov_base = 0;
    670     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    671 
    672     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    673     return xcb_ret;
    674 }
    675 
    676 int
    677 xcb_xf86dri_get_drawable_info_sizeof (const void  *_buffer)
    678 {
    679     char *xcb_tmp = (char *)_buffer;
    680     const xcb_xf86dri_get_drawable_info_reply_t *_aux = (xcb_xf86dri_get_drawable_info_reply_t *)_buffer;
    681     unsigned int xcb_buffer_len = 0;
    682     unsigned int xcb_block_len = 0;
    683     unsigned int xcb_pad = 0;
    684     unsigned int xcb_align_to = 0;
    685 
    686 
    687     xcb_block_len += sizeof(xcb_xf86dri_get_drawable_info_reply_t);
    688     xcb_tmp += xcb_block_len;
    689     xcb_buffer_len += xcb_block_len;
    690     xcb_block_len = 0;
    691     /* clip_rects */
    692     xcb_block_len += _aux->num_clip_rects * sizeof(xcb_xf86dri_drm_clip_rect_t);
    693     xcb_tmp += xcb_block_len;
    694     xcb_align_to = ALIGNOF(xcb_xf86dri_drm_clip_rect_t);
    695     /* insert padding */
    696     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    697     xcb_buffer_len += xcb_block_len + xcb_pad;
    698     if (0 != xcb_pad) {
    699         xcb_tmp += xcb_pad;
    700         xcb_pad = 0;
    701     }
    702     xcb_block_len = 0;
    703     /* back_clip_rects */
    704     xcb_block_len += _aux->num_back_clip_rects * sizeof(xcb_xf86dri_drm_clip_rect_t);
    705     xcb_tmp += xcb_block_len;
    706     xcb_align_to = ALIGNOF(xcb_xf86dri_drm_clip_rect_t);
    707     /* insert padding */
    708     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    709     xcb_buffer_len += xcb_block_len + xcb_pad;
    710     if (0 != xcb_pad) {
    711         xcb_tmp += xcb_pad;
    712         xcb_pad = 0;
    713     }
    714     xcb_block_len = 0;
    715 
    716     return xcb_buffer_len;
    717 }
    718 
    719 xcb_xf86dri_get_drawable_info_cookie_t
    720 xcb_xf86dri_get_drawable_info (xcb_connection_t *c,
    721                                uint32_t          screen,
    722                                uint32_t          drawable)
    723 {
    724     static const xcb_protocol_request_t xcb_req = {
    725         .count = 2,
    726         .ext = &xcb_xf86dri_id,
    727         .opcode = XCB_XF86DRI_GET_DRAWABLE_INFO,
    728         .isvoid = 0
    729     };
    730 
    731     struct iovec xcb_parts[4];
    732     xcb_xf86dri_get_drawable_info_cookie_t xcb_ret;
    733     xcb_xf86dri_get_drawable_info_request_t xcb_out;
    734 
    735     xcb_out.screen = screen;
    736     xcb_out.drawable = drawable;
    737 
    738     xcb_parts[2].iov_base = (char *) &xcb_out;
    739     xcb_parts[2].iov_len = sizeof(xcb_out);
    740     xcb_parts[3].iov_base = 0;
    741     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    742 
    743     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    744     return xcb_ret;
    745 }
    746 
    747 xcb_xf86dri_get_drawable_info_cookie_t
    748 xcb_xf86dri_get_drawable_info_unchecked (xcb_connection_t *c,
    749                                          uint32_t          screen,
    750                                          uint32_t          drawable)
    751 {
    752     static const xcb_protocol_request_t xcb_req = {
    753         .count = 2,
    754         .ext = &xcb_xf86dri_id,
    755         .opcode = XCB_XF86DRI_GET_DRAWABLE_INFO,
    756         .isvoid = 0
    757     };
    758 
    759     struct iovec xcb_parts[4];
    760     xcb_xf86dri_get_drawable_info_cookie_t xcb_ret;
    761     xcb_xf86dri_get_drawable_info_request_t xcb_out;
    762 
    763     xcb_out.screen = screen;
    764     xcb_out.drawable = drawable;
    765 
    766     xcb_parts[2].iov_base = (char *) &xcb_out;
    767     xcb_parts[2].iov_len = sizeof(xcb_out);
    768     xcb_parts[3].iov_base = 0;
    769     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    770 
    771     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    772     return xcb_ret;
    773 }
    774 
    775 xcb_xf86dri_drm_clip_rect_t *
    776 xcb_xf86dri_get_drawable_info_clip_rects (const xcb_xf86dri_get_drawable_info_reply_t *R)
    777 {
    778     return (xcb_xf86dri_drm_clip_rect_t *) (R + 1);
    779 }
    780 
    781 int
    782 xcb_xf86dri_get_drawable_info_clip_rects_length (const xcb_xf86dri_get_drawable_info_reply_t *R)
    783 {
    784     return R->num_clip_rects;
    785 }
    786 
    787 xcb_xf86dri_drm_clip_rect_iterator_t
    788 xcb_xf86dri_get_drawable_info_clip_rects_iterator (const xcb_xf86dri_get_drawable_info_reply_t *R)
    789 {
    790     xcb_xf86dri_drm_clip_rect_iterator_t i;
    791     i.data = (xcb_xf86dri_drm_clip_rect_t *) (R + 1);
    792     i.rem = R->num_clip_rects;
    793     i.index = (char *) i.data - (char *) R;
    794     return i;
    795 }
    796 
    797 xcb_xf86dri_drm_clip_rect_t *
    798 xcb_xf86dri_get_drawable_info_back_clip_rects (const xcb_xf86dri_get_drawable_info_reply_t *R)
    799 {
    800     xcb_generic_iterator_t prev = xcb_xf86dri_drm_clip_rect_end(xcb_xf86dri_get_drawable_info_clip_rects_iterator(R));
    801     return (xcb_xf86dri_drm_clip_rect_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xf86dri_drm_clip_rect_t, prev.index) + 0);
    802 }
    803 
    804 int
    805 xcb_xf86dri_get_drawable_info_back_clip_rects_length (const xcb_xf86dri_get_drawable_info_reply_t *R)
    806 {
    807     return R->num_back_clip_rects;
    808 }
    809 
    810 xcb_xf86dri_drm_clip_rect_iterator_t
    811 xcb_xf86dri_get_drawable_info_back_clip_rects_iterator (const xcb_xf86dri_get_drawable_info_reply_t *R)
    812 {
    813     xcb_xf86dri_drm_clip_rect_iterator_t i;
    814     xcb_generic_iterator_t prev = xcb_xf86dri_drm_clip_rect_end(xcb_xf86dri_get_drawable_info_clip_rects_iterator(R));
    815     i.data = (xcb_xf86dri_drm_clip_rect_t *) ((char *) prev.data + XCB_TYPE_PAD(xcb_xf86dri_drm_clip_rect_t, prev.index));
    816     i.rem = R->num_back_clip_rects;
    817     i.index = (char *) i.data - (char *) R;
    818     return i;
    819 }
    820 
    821 xcb_xf86dri_get_drawable_info_reply_t *
    822 xcb_xf86dri_get_drawable_info_reply (xcb_connection_t                        *c,
    823                                      xcb_xf86dri_get_drawable_info_cookie_t   cookie  /**< */,
    824                                      xcb_generic_error_t                    **e)
    825 {
    826     return (xcb_xf86dri_get_drawable_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    827 }
    828 
    829 int
    830 xcb_xf86dri_get_device_info_sizeof (const void  *_buffer)
    831 {
    832     char *xcb_tmp = (char *)_buffer;
    833     const xcb_xf86dri_get_device_info_reply_t *_aux = (xcb_xf86dri_get_device_info_reply_t *)_buffer;
    834     unsigned int xcb_buffer_len = 0;
    835     unsigned int xcb_block_len = 0;
    836     unsigned int xcb_pad = 0;
    837     unsigned int xcb_align_to = 0;
    838 
    839 
    840     xcb_block_len += sizeof(xcb_xf86dri_get_device_info_reply_t);
    841     xcb_tmp += xcb_block_len;
    842     xcb_buffer_len += xcb_block_len;
    843     xcb_block_len = 0;
    844     /* device_private */
    845     xcb_block_len += _aux->device_private_size * sizeof(uint32_t);
    846     xcb_tmp += xcb_block_len;
    847     xcb_align_to = ALIGNOF(uint32_t);
    848     /* insert padding */
    849     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    850     xcb_buffer_len += xcb_block_len + xcb_pad;
    851     if (0 != xcb_pad) {
    852         xcb_tmp += xcb_pad;
    853         xcb_pad = 0;
    854     }
    855     xcb_block_len = 0;
    856 
    857     return xcb_buffer_len;
    858 }
    859 
    860 xcb_xf86dri_get_device_info_cookie_t
    861 xcb_xf86dri_get_device_info (xcb_connection_t *c,
    862                              uint32_t          screen)
    863 {
    864     static const xcb_protocol_request_t xcb_req = {
    865         .count = 2,
    866         .ext = &xcb_xf86dri_id,
    867         .opcode = XCB_XF86DRI_GET_DEVICE_INFO,
    868         .isvoid = 0
    869     };
    870 
    871     struct iovec xcb_parts[4];
    872     xcb_xf86dri_get_device_info_cookie_t xcb_ret;
    873     xcb_xf86dri_get_device_info_request_t xcb_out;
    874 
    875     xcb_out.screen = screen;
    876 
    877     xcb_parts[2].iov_base = (char *) &xcb_out;
    878     xcb_parts[2].iov_len = sizeof(xcb_out);
    879     xcb_parts[3].iov_base = 0;
    880     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    881 
    882     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    883     return xcb_ret;
    884 }
    885 
    886 xcb_xf86dri_get_device_info_cookie_t
    887 xcb_xf86dri_get_device_info_unchecked (xcb_connection_t *c,
    888                                        uint32_t          screen)
    889 {
    890     static const xcb_protocol_request_t xcb_req = {
    891         .count = 2,
    892         .ext = &xcb_xf86dri_id,
    893         .opcode = XCB_XF86DRI_GET_DEVICE_INFO,
    894         .isvoid = 0
    895     };
    896 
    897     struct iovec xcb_parts[4];
    898     xcb_xf86dri_get_device_info_cookie_t xcb_ret;
    899     xcb_xf86dri_get_device_info_request_t xcb_out;
    900 
    901     xcb_out.screen = screen;
    902 
    903     xcb_parts[2].iov_base = (char *) &xcb_out;
    904     xcb_parts[2].iov_len = sizeof(xcb_out);
    905     xcb_parts[3].iov_base = 0;
    906     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    907 
    908     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    909     return xcb_ret;
    910 }
    911 
    912 uint32_t *
    913 xcb_xf86dri_get_device_info_device_private (const xcb_xf86dri_get_device_info_reply_t *R)
    914 {
    915     return (uint32_t *) (R + 1);
    916 }
    917 
    918 int
    919 xcb_xf86dri_get_device_info_device_private_length (const xcb_xf86dri_get_device_info_reply_t *R)
    920 {
    921     return R->device_private_size;
    922 }
    923 
    924 xcb_generic_iterator_t
    925 xcb_xf86dri_get_device_info_device_private_end (const xcb_xf86dri_get_device_info_reply_t *R)
    926 {
    927     xcb_generic_iterator_t i;
    928     i.data = ((uint32_t *) (R + 1)) + (R->device_private_size);
    929     i.rem = 0;
    930     i.index = (char *) i.data - (char *) R;
    931     return i;
    932 }
    933 
    934 xcb_xf86dri_get_device_info_reply_t *
    935 xcb_xf86dri_get_device_info_reply (xcb_connection_t                      *c,
    936                                    xcb_xf86dri_get_device_info_cookie_t   cookie  /**< */,
    937                                    xcb_generic_error_t                  **e)
    938 {
    939     return (xcb_xf86dri_get_device_info_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    940 }
    941 
    942 xcb_xf86dri_auth_connection_cookie_t
    943 xcb_xf86dri_auth_connection (xcb_connection_t *c,
    944                              uint32_t          screen,
    945                              uint32_t          magic)
    946 {
    947     static const xcb_protocol_request_t xcb_req = {
    948         .count = 2,
    949         .ext = &xcb_xf86dri_id,
    950         .opcode = XCB_XF86DRI_AUTH_CONNECTION,
    951         .isvoid = 0
    952     };
    953 
    954     struct iovec xcb_parts[4];
    955     xcb_xf86dri_auth_connection_cookie_t xcb_ret;
    956     xcb_xf86dri_auth_connection_request_t xcb_out;
    957 
    958     xcb_out.screen = screen;
    959     xcb_out.magic = magic;
    960 
    961     xcb_parts[2].iov_base = (char *) &xcb_out;
    962     xcb_parts[2].iov_len = sizeof(xcb_out);
    963     xcb_parts[3].iov_base = 0;
    964     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    965 
    966     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    967     return xcb_ret;
    968 }
    969 
    970 xcb_xf86dri_auth_connection_cookie_t
    971 xcb_xf86dri_auth_connection_unchecked (xcb_connection_t *c,
    972                                        uint32_t          screen,
    973                                        uint32_t          magic)
    974 {
    975     static const xcb_protocol_request_t xcb_req = {
    976         .count = 2,
    977         .ext = &xcb_xf86dri_id,
    978         .opcode = XCB_XF86DRI_AUTH_CONNECTION,
    979         .isvoid = 0
    980     };
    981 
    982     struct iovec xcb_parts[4];
    983     xcb_xf86dri_auth_connection_cookie_t xcb_ret;
    984     xcb_xf86dri_auth_connection_request_t xcb_out;
    985 
    986     xcb_out.screen = screen;
    987     xcb_out.magic = magic;
    988 
    989     xcb_parts[2].iov_base = (char *) &xcb_out;
    990     xcb_parts[2].iov_len = sizeof(xcb_out);
    991     xcb_parts[3].iov_base = 0;
    992     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    993 
    994     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    995     return xcb_ret;
    996 }
    997 
    998 xcb_xf86dri_auth_connection_reply_t *
    999 xcb_xf86dri_auth_connection_reply (xcb_connection_t                      *c,
   1000                                    xcb_xf86dri_auth_connection_cookie_t   cookie  /**< */,
   1001                                    xcb_generic_error_t                  **e)
   1002 {
   1003     return (xcb_xf86dri_auth_connection_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
   1004 }
   1005 
   1006