Home | History | Annotate | Line # | Download | only in files
      1 /*
      2  * This file generated automatically from xvmc.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 "xvmc.h"
     15 
     16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
     17 #include "xv.h"
     18 
     19 xcb_extension_t xcb_xvmc_id = { "XVideo-MotionCompensation", 0 };
     20 
     21 void
     22 xcb_xvmc_context_next (xcb_xvmc_context_iterator_t *i)
     23 {
     24     --i->rem;
     25     ++i->data;
     26     i->index += sizeof(xcb_xvmc_context_t);
     27 }
     28 
     29 xcb_generic_iterator_t
     30 xcb_xvmc_context_end (xcb_xvmc_context_iterator_t i)
     31 {
     32     xcb_generic_iterator_t ret;
     33     ret.data = i.data + i.rem;
     34     ret.index = i.index + ((char *) ret.data - (char *) i.data);
     35     ret.rem = 0;
     36     return ret;
     37 }
     38 
     39 void
     40 xcb_xvmc_surface_next (xcb_xvmc_surface_iterator_t *i)
     41 {
     42     --i->rem;
     43     ++i->data;
     44     i->index += sizeof(xcb_xvmc_surface_t);
     45 }
     46 
     47 xcb_generic_iterator_t
     48 xcb_xvmc_surface_end (xcb_xvmc_surface_iterator_t i)
     49 {
     50     xcb_generic_iterator_t ret;
     51     ret.data = i.data + i.rem;
     52     ret.index = i.index + ((char *) ret.data - (char *) i.data);
     53     ret.rem = 0;
     54     return ret;
     55 }
     56 
     57 void
     58 xcb_xvmc_subpicture_next (xcb_xvmc_subpicture_iterator_t *i)
     59 {
     60     --i->rem;
     61     ++i->data;
     62     i->index += sizeof(xcb_xvmc_subpicture_t);
     63 }
     64 
     65 xcb_generic_iterator_t
     66 xcb_xvmc_subpicture_end (xcb_xvmc_subpicture_iterator_t i)
     67 {
     68     xcb_generic_iterator_t ret;
     69     ret.data = i.data + i.rem;
     70     ret.index = i.index + ((char *) ret.data - (char *) i.data);
     71     ret.rem = 0;
     72     return ret;
     73 }
     74 
     75 void
     76 xcb_xvmc_surface_info_next (xcb_xvmc_surface_info_iterator_t *i)
     77 {
     78     --i->rem;
     79     ++i->data;
     80     i->index += sizeof(xcb_xvmc_surface_info_t);
     81 }
     82 
     83 xcb_generic_iterator_t
     84 xcb_xvmc_surface_info_end (xcb_xvmc_surface_info_iterator_t i)
     85 {
     86     xcb_generic_iterator_t ret;
     87     ret.data = i.data + i.rem;
     88     ret.index = i.index + ((char *) ret.data - (char *) i.data);
     89     ret.rem = 0;
     90     return ret;
     91 }
     92 
     93 xcb_xvmc_query_version_cookie_t
     94 xcb_xvmc_query_version (xcb_connection_t *c)
     95 {
     96     static const xcb_protocol_request_t xcb_req = {
     97         .count = 2,
     98         .ext = &xcb_xvmc_id,
     99         .opcode = XCB_XVMC_QUERY_VERSION,
    100         .isvoid = 0
    101     };
    102 
    103     struct iovec xcb_parts[4];
    104     xcb_xvmc_query_version_cookie_t xcb_ret;
    105     xcb_xvmc_query_version_request_t xcb_out;
    106 
    107 
    108     xcb_parts[2].iov_base = (char *) &xcb_out;
    109     xcb_parts[2].iov_len = sizeof(xcb_out);
    110     xcb_parts[3].iov_base = 0;
    111     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    112 
    113     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    114     return xcb_ret;
    115 }
    116 
    117 xcb_xvmc_query_version_cookie_t
    118 xcb_xvmc_query_version_unchecked (xcb_connection_t *c)
    119 {
    120     static const xcb_protocol_request_t xcb_req = {
    121         .count = 2,
    122         .ext = &xcb_xvmc_id,
    123         .opcode = XCB_XVMC_QUERY_VERSION,
    124         .isvoid = 0
    125     };
    126 
    127     struct iovec xcb_parts[4];
    128     xcb_xvmc_query_version_cookie_t xcb_ret;
    129     xcb_xvmc_query_version_request_t xcb_out;
    130 
    131 
    132     xcb_parts[2].iov_base = (char *) &xcb_out;
    133     xcb_parts[2].iov_len = sizeof(xcb_out);
    134     xcb_parts[3].iov_base = 0;
    135     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    136 
    137     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    138     return xcb_ret;
    139 }
    140 
    141 xcb_xvmc_query_version_reply_t *
    142 xcb_xvmc_query_version_reply (xcb_connection_t                 *c,
    143                               xcb_xvmc_query_version_cookie_t   cookie  /**< */,
    144                               xcb_generic_error_t             **e)
    145 {
    146     return (xcb_xvmc_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    147 }
    148 
    149 int
    150 xcb_xvmc_list_surface_types_sizeof (const void  *_buffer)
    151 {
    152     char *xcb_tmp = (char *)_buffer;
    153     const xcb_xvmc_list_surface_types_reply_t *_aux = (xcb_xvmc_list_surface_types_reply_t *)_buffer;
    154     unsigned int xcb_buffer_len = 0;
    155     unsigned int xcb_block_len = 0;
    156     unsigned int xcb_pad = 0;
    157     unsigned int xcb_align_to = 0;
    158 
    159 
    160     xcb_block_len += sizeof(xcb_xvmc_list_surface_types_reply_t);
    161     xcb_tmp += xcb_block_len;
    162     xcb_buffer_len += xcb_block_len;
    163     xcb_block_len = 0;
    164     /* surfaces */
    165     xcb_block_len += _aux->num * sizeof(xcb_xvmc_surface_info_t);
    166     xcb_tmp += xcb_block_len;
    167     xcb_align_to = ALIGNOF(xcb_xvmc_surface_info_t);
    168     /* insert padding */
    169     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    170     xcb_buffer_len += xcb_block_len + xcb_pad;
    171     if (0 != xcb_pad) {
    172         xcb_tmp += xcb_pad;
    173         xcb_pad = 0;
    174     }
    175     xcb_block_len = 0;
    176 
    177     return xcb_buffer_len;
    178 }
    179 
    180 xcb_xvmc_list_surface_types_cookie_t
    181 xcb_xvmc_list_surface_types (xcb_connection_t *c,
    182                              xcb_xv_port_t     port_id)
    183 {
    184     static const xcb_protocol_request_t xcb_req = {
    185         .count = 2,
    186         .ext = &xcb_xvmc_id,
    187         .opcode = XCB_XVMC_LIST_SURFACE_TYPES,
    188         .isvoid = 0
    189     };
    190 
    191     struct iovec xcb_parts[4];
    192     xcb_xvmc_list_surface_types_cookie_t xcb_ret;
    193     xcb_xvmc_list_surface_types_request_t xcb_out;
    194 
    195     xcb_out.port_id = port_id;
    196 
    197     xcb_parts[2].iov_base = (char *) &xcb_out;
    198     xcb_parts[2].iov_len = sizeof(xcb_out);
    199     xcb_parts[3].iov_base = 0;
    200     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    201 
    202     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    203     return xcb_ret;
    204 }
    205 
    206 xcb_xvmc_list_surface_types_cookie_t
    207 xcb_xvmc_list_surface_types_unchecked (xcb_connection_t *c,
    208                                        xcb_xv_port_t     port_id)
    209 {
    210     static const xcb_protocol_request_t xcb_req = {
    211         .count = 2,
    212         .ext = &xcb_xvmc_id,
    213         .opcode = XCB_XVMC_LIST_SURFACE_TYPES,
    214         .isvoid = 0
    215     };
    216 
    217     struct iovec xcb_parts[4];
    218     xcb_xvmc_list_surface_types_cookie_t xcb_ret;
    219     xcb_xvmc_list_surface_types_request_t xcb_out;
    220 
    221     xcb_out.port_id = port_id;
    222 
    223     xcb_parts[2].iov_base = (char *) &xcb_out;
    224     xcb_parts[2].iov_len = sizeof(xcb_out);
    225     xcb_parts[3].iov_base = 0;
    226     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    227 
    228     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    229     return xcb_ret;
    230 }
    231 
    232 xcb_xvmc_surface_info_t *
    233 xcb_xvmc_list_surface_types_surfaces (const xcb_xvmc_list_surface_types_reply_t *R)
    234 {
    235     return (xcb_xvmc_surface_info_t *) (R + 1);
    236 }
    237 
    238 int
    239 xcb_xvmc_list_surface_types_surfaces_length (const xcb_xvmc_list_surface_types_reply_t *R)
    240 {
    241     return R->num;
    242 }
    243 
    244 xcb_xvmc_surface_info_iterator_t
    245 xcb_xvmc_list_surface_types_surfaces_iterator (const xcb_xvmc_list_surface_types_reply_t *R)
    246 {
    247     xcb_xvmc_surface_info_iterator_t i;
    248     i.data = (xcb_xvmc_surface_info_t *) (R + 1);
    249     i.rem = R->num;
    250     i.index = (char *) i.data - (char *) R;
    251     return i;
    252 }
    253 
    254 xcb_xvmc_list_surface_types_reply_t *
    255 xcb_xvmc_list_surface_types_reply (xcb_connection_t                      *c,
    256                                    xcb_xvmc_list_surface_types_cookie_t   cookie  /**< */,
    257                                    xcb_generic_error_t                  **e)
    258 {
    259     return (xcb_xvmc_list_surface_types_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    260 }
    261 
    262 int
    263 xcb_xvmc_create_context_sizeof (const void  *_buffer)
    264 {
    265     char *xcb_tmp = (char *)_buffer;
    266     const xcb_xvmc_create_context_reply_t *_aux = (xcb_xvmc_create_context_reply_t *)_buffer;
    267     unsigned int xcb_buffer_len = 0;
    268     unsigned int xcb_block_len = 0;
    269     unsigned int xcb_pad = 0;
    270     unsigned int xcb_align_to = 0;
    271 
    272 
    273     xcb_block_len += sizeof(xcb_xvmc_create_context_reply_t);
    274     xcb_tmp += xcb_block_len;
    275     xcb_buffer_len += xcb_block_len;
    276     xcb_block_len = 0;
    277     /* priv_data */
    278     xcb_block_len += _aux->length * sizeof(uint32_t);
    279     xcb_tmp += xcb_block_len;
    280     xcb_align_to = ALIGNOF(uint32_t);
    281     /* insert padding */
    282     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    283     xcb_buffer_len += xcb_block_len + xcb_pad;
    284     if (0 != xcb_pad) {
    285         xcb_tmp += xcb_pad;
    286         xcb_pad = 0;
    287     }
    288     xcb_block_len = 0;
    289 
    290     return xcb_buffer_len;
    291 }
    292 
    293 xcb_xvmc_create_context_cookie_t
    294 xcb_xvmc_create_context (xcb_connection_t   *c,
    295                          xcb_xvmc_context_t  context_id,
    296                          xcb_xv_port_t       port_id,
    297                          xcb_xvmc_surface_t  surface_id,
    298                          uint16_t            width,
    299                          uint16_t            height,
    300                          uint32_t            flags)
    301 {
    302     static const xcb_protocol_request_t xcb_req = {
    303         .count = 2,
    304         .ext = &xcb_xvmc_id,
    305         .opcode = XCB_XVMC_CREATE_CONTEXT,
    306         .isvoid = 0
    307     };
    308 
    309     struct iovec xcb_parts[4];
    310     xcb_xvmc_create_context_cookie_t xcb_ret;
    311     xcb_xvmc_create_context_request_t xcb_out;
    312 
    313     xcb_out.context_id = context_id;
    314     xcb_out.port_id = port_id;
    315     xcb_out.surface_id = surface_id;
    316     xcb_out.width = width;
    317     xcb_out.height = height;
    318     xcb_out.flags = flags;
    319 
    320     xcb_parts[2].iov_base = (char *) &xcb_out;
    321     xcb_parts[2].iov_len = sizeof(xcb_out);
    322     xcb_parts[3].iov_base = 0;
    323     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    324 
    325     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    326     return xcb_ret;
    327 }
    328 
    329 xcb_xvmc_create_context_cookie_t
    330 xcb_xvmc_create_context_unchecked (xcb_connection_t   *c,
    331                                    xcb_xvmc_context_t  context_id,
    332                                    xcb_xv_port_t       port_id,
    333                                    xcb_xvmc_surface_t  surface_id,
    334                                    uint16_t            width,
    335                                    uint16_t            height,
    336                                    uint32_t            flags)
    337 {
    338     static const xcb_protocol_request_t xcb_req = {
    339         .count = 2,
    340         .ext = &xcb_xvmc_id,
    341         .opcode = XCB_XVMC_CREATE_CONTEXT,
    342         .isvoid = 0
    343     };
    344 
    345     struct iovec xcb_parts[4];
    346     xcb_xvmc_create_context_cookie_t xcb_ret;
    347     xcb_xvmc_create_context_request_t xcb_out;
    348 
    349     xcb_out.context_id = context_id;
    350     xcb_out.port_id = port_id;
    351     xcb_out.surface_id = surface_id;
    352     xcb_out.width = width;
    353     xcb_out.height = height;
    354     xcb_out.flags = flags;
    355 
    356     xcb_parts[2].iov_base = (char *) &xcb_out;
    357     xcb_parts[2].iov_len = sizeof(xcb_out);
    358     xcb_parts[3].iov_base = 0;
    359     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    360 
    361     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    362     return xcb_ret;
    363 }
    364 
    365 uint32_t *
    366 xcb_xvmc_create_context_priv_data (const xcb_xvmc_create_context_reply_t *R)
    367 {
    368     return (uint32_t *) (R + 1);
    369 }
    370 
    371 int
    372 xcb_xvmc_create_context_priv_data_length (const xcb_xvmc_create_context_reply_t *R)
    373 {
    374     return R->length;
    375 }
    376 
    377 xcb_generic_iterator_t
    378 xcb_xvmc_create_context_priv_data_end (const xcb_xvmc_create_context_reply_t *R)
    379 {
    380     xcb_generic_iterator_t i;
    381     i.data = ((uint32_t *) (R + 1)) + (R->length);
    382     i.rem = 0;
    383     i.index = (char *) i.data - (char *) R;
    384     return i;
    385 }
    386 
    387 xcb_xvmc_create_context_reply_t *
    388 xcb_xvmc_create_context_reply (xcb_connection_t                  *c,
    389                                xcb_xvmc_create_context_cookie_t   cookie  /**< */,
    390                                xcb_generic_error_t              **e)
    391 {
    392     return (xcb_xvmc_create_context_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    393 }
    394 
    395 xcb_void_cookie_t
    396 xcb_xvmc_destroy_context_checked (xcb_connection_t   *c,
    397                                   xcb_xvmc_context_t  context_id)
    398 {
    399     static const xcb_protocol_request_t xcb_req = {
    400         .count = 2,
    401         .ext = &xcb_xvmc_id,
    402         .opcode = XCB_XVMC_DESTROY_CONTEXT,
    403         .isvoid = 1
    404     };
    405 
    406     struct iovec xcb_parts[4];
    407     xcb_void_cookie_t xcb_ret;
    408     xcb_xvmc_destroy_context_request_t xcb_out;
    409 
    410     xcb_out.context_id = context_id;
    411 
    412     xcb_parts[2].iov_base = (char *) &xcb_out;
    413     xcb_parts[2].iov_len = sizeof(xcb_out);
    414     xcb_parts[3].iov_base = 0;
    415     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    416 
    417     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    418     return xcb_ret;
    419 }
    420 
    421 xcb_void_cookie_t
    422 xcb_xvmc_destroy_context (xcb_connection_t   *c,
    423                           xcb_xvmc_context_t  context_id)
    424 {
    425     static const xcb_protocol_request_t xcb_req = {
    426         .count = 2,
    427         .ext = &xcb_xvmc_id,
    428         .opcode = XCB_XVMC_DESTROY_CONTEXT,
    429         .isvoid = 1
    430     };
    431 
    432     struct iovec xcb_parts[4];
    433     xcb_void_cookie_t xcb_ret;
    434     xcb_xvmc_destroy_context_request_t xcb_out;
    435 
    436     xcb_out.context_id = context_id;
    437 
    438     xcb_parts[2].iov_base = (char *) &xcb_out;
    439     xcb_parts[2].iov_len = sizeof(xcb_out);
    440     xcb_parts[3].iov_base = 0;
    441     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    442 
    443     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    444     return xcb_ret;
    445 }
    446 
    447 int
    448 xcb_xvmc_create_surface_sizeof (const void  *_buffer)
    449 {
    450     char *xcb_tmp = (char *)_buffer;
    451     const xcb_xvmc_create_surface_reply_t *_aux = (xcb_xvmc_create_surface_reply_t *)_buffer;
    452     unsigned int xcb_buffer_len = 0;
    453     unsigned int xcb_block_len = 0;
    454     unsigned int xcb_pad = 0;
    455     unsigned int xcb_align_to = 0;
    456 
    457 
    458     xcb_block_len += sizeof(xcb_xvmc_create_surface_reply_t);
    459     xcb_tmp += xcb_block_len;
    460     xcb_buffer_len += xcb_block_len;
    461     xcb_block_len = 0;
    462     /* priv_data */
    463     xcb_block_len += _aux->length * sizeof(uint32_t);
    464     xcb_tmp += xcb_block_len;
    465     xcb_align_to = ALIGNOF(uint32_t);
    466     /* insert padding */
    467     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    468     xcb_buffer_len += xcb_block_len + xcb_pad;
    469     if (0 != xcb_pad) {
    470         xcb_tmp += xcb_pad;
    471         xcb_pad = 0;
    472     }
    473     xcb_block_len = 0;
    474 
    475     return xcb_buffer_len;
    476 }
    477 
    478 xcb_xvmc_create_surface_cookie_t
    479 xcb_xvmc_create_surface (xcb_connection_t   *c,
    480                          xcb_xvmc_surface_t  surface_id,
    481                          xcb_xvmc_context_t  context_id)
    482 {
    483     static const xcb_protocol_request_t xcb_req = {
    484         .count = 2,
    485         .ext = &xcb_xvmc_id,
    486         .opcode = XCB_XVMC_CREATE_SURFACE,
    487         .isvoid = 0
    488     };
    489 
    490     struct iovec xcb_parts[4];
    491     xcb_xvmc_create_surface_cookie_t xcb_ret;
    492     xcb_xvmc_create_surface_request_t xcb_out;
    493 
    494     xcb_out.surface_id = surface_id;
    495     xcb_out.context_id = context_id;
    496 
    497     xcb_parts[2].iov_base = (char *) &xcb_out;
    498     xcb_parts[2].iov_len = sizeof(xcb_out);
    499     xcb_parts[3].iov_base = 0;
    500     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    501 
    502     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    503     return xcb_ret;
    504 }
    505 
    506 xcb_xvmc_create_surface_cookie_t
    507 xcb_xvmc_create_surface_unchecked (xcb_connection_t   *c,
    508                                    xcb_xvmc_surface_t  surface_id,
    509                                    xcb_xvmc_context_t  context_id)
    510 {
    511     static const xcb_protocol_request_t xcb_req = {
    512         .count = 2,
    513         .ext = &xcb_xvmc_id,
    514         .opcode = XCB_XVMC_CREATE_SURFACE,
    515         .isvoid = 0
    516     };
    517 
    518     struct iovec xcb_parts[4];
    519     xcb_xvmc_create_surface_cookie_t xcb_ret;
    520     xcb_xvmc_create_surface_request_t xcb_out;
    521 
    522     xcb_out.surface_id = surface_id;
    523     xcb_out.context_id = context_id;
    524 
    525     xcb_parts[2].iov_base = (char *) &xcb_out;
    526     xcb_parts[2].iov_len = sizeof(xcb_out);
    527     xcb_parts[3].iov_base = 0;
    528     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    529 
    530     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    531     return xcb_ret;
    532 }
    533 
    534 uint32_t *
    535 xcb_xvmc_create_surface_priv_data (const xcb_xvmc_create_surface_reply_t *R)
    536 {
    537     return (uint32_t *) (R + 1);
    538 }
    539 
    540 int
    541 xcb_xvmc_create_surface_priv_data_length (const xcb_xvmc_create_surface_reply_t *R)
    542 {
    543     return R->length;
    544 }
    545 
    546 xcb_generic_iterator_t
    547 xcb_xvmc_create_surface_priv_data_end (const xcb_xvmc_create_surface_reply_t *R)
    548 {
    549     xcb_generic_iterator_t i;
    550     i.data = ((uint32_t *) (R + 1)) + (R->length);
    551     i.rem = 0;
    552     i.index = (char *) i.data - (char *) R;
    553     return i;
    554 }
    555 
    556 xcb_xvmc_create_surface_reply_t *
    557 xcb_xvmc_create_surface_reply (xcb_connection_t                  *c,
    558                                xcb_xvmc_create_surface_cookie_t   cookie  /**< */,
    559                                xcb_generic_error_t              **e)
    560 {
    561     return (xcb_xvmc_create_surface_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    562 }
    563 
    564 xcb_void_cookie_t
    565 xcb_xvmc_destroy_surface_checked (xcb_connection_t   *c,
    566                                   xcb_xvmc_surface_t  surface_id)
    567 {
    568     static const xcb_protocol_request_t xcb_req = {
    569         .count = 2,
    570         .ext = &xcb_xvmc_id,
    571         .opcode = XCB_XVMC_DESTROY_SURFACE,
    572         .isvoid = 1
    573     };
    574 
    575     struct iovec xcb_parts[4];
    576     xcb_void_cookie_t xcb_ret;
    577     xcb_xvmc_destroy_surface_request_t xcb_out;
    578 
    579     xcb_out.surface_id = surface_id;
    580 
    581     xcb_parts[2].iov_base = (char *) &xcb_out;
    582     xcb_parts[2].iov_len = sizeof(xcb_out);
    583     xcb_parts[3].iov_base = 0;
    584     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    585 
    586     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    587     return xcb_ret;
    588 }
    589 
    590 xcb_void_cookie_t
    591 xcb_xvmc_destroy_surface (xcb_connection_t   *c,
    592                           xcb_xvmc_surface_t  surface_id)
    593 {
    594     static const xcb_protocol_request_t xcb_req = {
    595         .count = 2,
    596         .ext = &xcb_xvmc_id,
    597         .opcode = XCB_XVMC_DESTROY_SURFACE,
    598         .isvoid = 1
    599     };
    600 
    601     struct iovec xcb_parts[4];
    602     xcb_void_cookie_t xcb_ret;
    603     xcb_xvmc_destroy_surface_request_t xcb_out;
    604 
    605     xcb_out.surface_id = surface_id;
    606 
    607     xcb_parts[2].iov_base = (char *) &xcb_out;
    608     xcb_parts[2].iov_len = sizeof(xcb_out);
    609     xcb_parts[3].iov_base = 0;
    610     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    611 
    612     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    613     return xcb_ret;
    614 }
    615 
    616 int
    617 xcb_xvmc_create_subpicture_sizeof (const void  *_buffer)
    618 {
    619     char *xcb_tmp = (char *)_buffer;
    620     const xcb_xvmc_create_subpicture_reply_t *_aux = (xcb_xvmc_create_subpicture_reply_t *)_buffer;
    621     unsigned int xcb_buffer_len = 0;
    622     unsigned int xcb_block_len = 0;
    623     unsigned int xcb_pad = 0;
    624     unsigned int xcb_align_to = 0;
    625 
    626 
    627     xcb_block_len += sizeof(xcb_xvmc_create_subpicture_reply_t);
    628     xcb_tmp += xcb_block_len;
    629     xcb_buffer_len += xcb_block_len;
    630     xcb_block_len = 0;
    631     /* priv_data */
    632     xcb_block_len += _aux->length * sizeof(uint32_t);
    633     xcb_tmp += xcb_block_len;
    634     xcb_align_to = ALIGNOF(uint32_t);
    635     /* insert padding */
    636     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    637     xcb_buffer_len += xcb_block_len + xcb_pad;
    638     if (0 != xcb_pad) {
    639         xcb_tmp += xcb_pad;
    640         xcb_pad = 0;
    641     }
    642     xcb_block_len = 0;
    643 
    644     return xcb_buffer_len;
    645 }
    646 
    647 xcb_xvmc_create_subpicture_cookie_t
    648 xcb_xvmc_create_subpicture (xcb_connection_t      *c,
    649                             xcb_xvmc_subpicture_t  subpicture_id,
    650                             xcb_xvmc_context_t     context,
    651                             uint32_t               xvimage_id,
    652                             uint16_t               width,
    653                             uint16_t               height)
    654 {
    655     static const xcb_protocol_request_t xcb_req = {
    656         .count = 2,
    657         .ext = &xcb_xvmc_id,
    658         .opcode = XCB_XVMC_CREATE_SUBPICTURE,
    659         .isvoid = 0
    660     };
    661 
    662     struct iovec xcb_parts[4];
    663     xcb_xvmc_create_subpicture_cookie_t xcb_ret;
    664     xcb_xvmc_create_subpicture_request_t xcb_out;
    665 
    666     xcb_out.subpicture_id = subpicture_id;
    667     xcb_out.context = context;
    668     xcb_out.xvimage_id = xvimage_id;
    669     xcb_out.width = width;
    670     xcb_out.height = height;
    671 
    672     xcb_parts[2].iov_base = (char *) &xcb_out;
    673     xcb_parts[2].iov_len = sizeof(xcb_out);
    674     xcb_parts[3].iov_base = 0;
    675     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    676 
    677     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    678     return xcb_ret;
    679 }
    680 
    681 xcb_xvmc_create_subpicture_cookie_t
    682 xcb_xvmc_create_subpicture_unchecked (xcb_connection_t      *c,
    683                                       xcb_xvmc_subpicture_t  subpicture_id,
    684                                       xcb_xvmc_context_t     context,
    685                                       uint32_t               xvimage_id,
    686                                       uint16_t               width,
    687                                       uint16_t               height)
    688 {
    689     static const xcb_protocol_request_t xcb_req = {
    690         .count = 2,
    691         .ext = &xcb_xvmc_id,
    692         .opcode = XCB_XVMC_CREATE_SUBPICTURE,
    693         .isvoid = 0
    694     };
    695 
    696     struct iovec xcb_parts[4];
    697     xcb_xvmc_create_subpicture_cookie_t xcb_ret;
    698     xcb_xvmc_create_subpicture_request_t xcb_out;
    699 
    700     xcb_out.subpicture_id = subpicture_id;
    701     xcb_out.context = context;
    702     xcb_out.xvimage_id = xvimage_id;
    703     xcb_out.width = width;
    704     xcb_out.height = height;
    705 
    706     xcb_parts[2].iov_base = (char *) &xcb_out;
    707     xcb_parts[2].iov_len = sizeof(xcb_out);
    708     xcb_parts[3].iov_base = 0;
    709     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    710 
    711     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    712     return xcb_ret;
    713 }
    714 
    715 uint32_t *
    716 xcb_xvmc_create_subpicture_priv_data (const xcb_xvmc_create_subpicture_reply_t *R)
    717 {
    718     return (uint32_t *) (R + 1);
    719 }
    720 
    721 int
    722 xcb_xvmc_create_subpicture_priv_data_length (const xcb_xvmc_create_subpicture_reply_t *R)
    723 {
    724     return R->length;
    725 }
    726 
    727 xcb_generic_iterator_t
    728 xcb_xvmc_create_subpicture_priv_data_end (const xcb_xvmc_create_subpicture_reply_t *R)
    729 {
    730     xcb_generic_iterator_t i;
    731     i.data = ((uint32_t *) (R + 1)) + (R->length);
    732     i.rem = 0;
    733     i.index = (char *) i.data - (char *) R;
    734     return i;
    735 }
    736 
    737 xcb_xvmc_create_subpicture_reply_t *
    738 xcb_xvmc_create_subpicture_reply (xcb_connection_t                     *c,
    739                                   xcb_xvmc_create_subpicture_cookie_t   cookie  /**< */,
    740                                   xcb_generic_error_t                 **e)
    741 {
    742     return (xcb_xvmc_create_subpicture_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    743 }
    744 
    745 xcb_void_cookie_t
    746 xcb_xvmc_destroy_subpicture_checked (xcb_connection_t      *c,
    747                                      xcb_xvmc_subpicture_t  subpicture_id)
    748 {
    749     static const xcb_protocol_request_t xcb_req = {
    750         .count = 2,
    751         .ext = &xcb_xvmc_id,
    752         .opcode = XCB_XVMC_DESTROY_SUBPICTURE,
    753         .isvoid = 1
    754     };
    755 
    756     struct iovec xcb_parts[4];
    757     xcb_void_cookie_t xcb_ret;
    758     xcb_xvmc_destroy_subpicture_request_t xcb_out;
    759 
    760     xcb_out.subpicture_id = subpicture_id;
    761 
    762     xcb_parts[2].iov_base = (char *) &xcb_out;
    763     xcb_parts[2].iov_len = sizeof(xcb_out);
    764     xcb_parts[3].iov_base = 0;
    765     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    766 
    767     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    768     return xcb_ret;
    769 }
    770 
    771 xcb_void_cookie_t
    772 xcb_xvmc_destroy_subpicture (xcb_connection_t      *c,
    773                              xcb_xvmc_subpicture_t  subpicture_id)
    774 {
    775     static const xcb_protocol_request_t xcb_req = {
    776         .count = 2,
    777         .ext = &xcb_xvmc_id,
    778         .opcode = XCB_XVMC_DESTROY_SUBPICTURE,
    779         .isvoid = 1
    780     };
    781 
    782     struct iovec xcb_parts[4];
    783     xcb_void_cookie_t xcb_ret;
    784     xcb_xvmc_destroy_subpicture_request_t xcb_out;
    785 
    786     xcb_out.subpicture_id = subpicture_id;
    787 
    788     xcb_parts[2].iov_base = (char *) &xcb_out;
    789     xcb_parts[2].iov_len = sizeof(xcb_out);
    790     xcb_parts[3].iov_base = 0;
    791     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    792 
    793     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    794     return xcb_ret;
    795 }
    796 
    797 int
    798 xcb_xvmc_list_subpicture_types_sizeof (const void  *_buffer)
    799 {
    800     char *xcb_tmp = (char *)_buffer;
    801     const xcb_xvmc_list_subpicture_types_reply_t *_aux = (xcb_xvmc_list_subpicture_types_reply_t *)_buffer;
    802     unsigned int xcb_buffer_len = 0;
    803     unsigned int xcb_block_len = 0;
    804     unsigned int xcb_pad = 0;
    805     unsigned int xcb_align_to = 0;
    806 
    807 
    808     xcb_block_len += sizeof(xcb_xvmc_list_subpicture_types_reply_t);
    809     xcb_tmp += xcb_block_len;
    810     xcb_buffer_len += xcb_block_len;
    811     xcb_block_len = 0;
    812     /* types */
    813     xcb_block_len += _aux->num * sizeof(xcb_xv_image_format_info_t);
    814     xcb_tmp += xcb_block_len;
    815     xcb_align_to = ALIGNOF(xcb_xv_image_format_info_t);
    816     /* insert padding */
    817     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
    818     xcb_buffer_len += xcb_block_len + xcb_pad;
    819     if (0 != xcb_pad) {
    820         xcb_tmp += xcb_pad;
    821         xcb_pad = 0;
    822     }
    823     xcb_block_len = 0;
    824 
    825     return xcb_buffer_len;
    826 }
    827 
    828 xcb_xvmc_list_subpicture_types_cookie_t
    829 xcb_xvmc_list_subpicture_types (xcb_connection_t   *c,
    830                                 xcb_xv_port_t       port_id,
    831                                 xcb_xvmc_surface_t  surface_id)
    832 {
    833     static const xcb_protocol_request_t xcb_req = {
    834         .count = 2,
    835         .ext = &xcb_xvmc_id,
    836         .opcode = XCB_XVMC_LIST_SUBPICTURE_TYPES,
    837         .isvoid = 0
    838     };
    839 
    840     struct iovec xcb_parts[4];
    841     xcb_xvmc_list_subpicture_types_cookie_t xcb_ret;
    842     xcb_xvmc_list_subpicture_types_request_t xcb_out;
    843 
    844     xcb_out.port_id = port_id;
    845     xcb_out.surface_id = surface_id;
    846 
    847     xcb_parts[2].iov_base = (char *) &xcb_out;
    848     xcb_parts[2].iov_len = sizeof(xcb_out);
    849     xcb_parts[3].iov_base = 0;
    850     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    851 
    852     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
    853     return xcb_ret;
    854 }
    855 
    856 xcb_xvmc_list_subpicture_types_cookie_t
    857 xcb_xvmc_list_subpicture_types_unchecked (xcb_connection_t   *c,
    858                                           xcb_xv_port_t       port_id,
    859                                           xcb_xvmc_surface_t  surface_id)
    860 {
    861     static const xcb_protocol_request_t xcb_req = {
    862         .count = 2,
    863         .ext = &xcb_xvmc_id,
    864         .opcode = XCB_XVMC_LIST_SUBPICTURE_TYPES,
    865         .isvoid = 0
    866     };
    867 
    868     struct iovec xcb_parts[4];
    869     xcb_xvmc_list_subpicture_types_cookie_t xcb_ret;
    870     xcb_xvmc_list_subpicture_types_request_t xcb_out;
    871 
    872     xcb_out.port_id = port_id;
    873     xcb_out.surface_id = surface_id;
    874 
    875     xcb_parts[2].iov_base = (char *) &xcb_out;
    876     xcb_parts[2].iov_len = sizeof(xcb_out);
    877     xcb_parts[3].iov_base = 0;
    878     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
    879 
    880     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
    881     return xcb_ret;
    882 }
    883 
    884 xcb_xv_image_format_info_t *
    885 xcb_xvmc_list_subpicture_types_types (const xcb_xvmc_list_subpicture_types_reply_t *R)
    886 {
    887     return (xcb_xv_image_format_info_t *) (R + 1);
    888 }
    889 
    890 int
    891 xcb_xvmc_list_subpicture_types_types_length (const xcb_xvmc_list_subpicture_types_reply_t *R)
    892 {
    893     return R->num;
    894 }
    895 
    896 xcb_xv_image_format_info_iterator_t
    897 xcb_xvmc_list_subpicture_types_types_iterator (const xcb_xvmc_list_subpicture_types_reply_t *R)
    898 {
    899     xcb_xv_image_format_info_iterator_t i;
    900     i.data = (xcb_xv_image_format_info_t *) (R + 1);
    901     i.rem = R->num;
    902     i.index = (char *) i.data - (char *) R;
    903     return i;
    904 }
    905 
    906 xcb_xvmc_list_subpicture_types_reply_t *
    907 xcb_xvmc_list_subpicture_types_reply (xcb_connection_t                         *c,
    908                                       xcb_xvmc_list_subpicture_types_cookie_t   cookie  /**< */,
    909                                       xcb_generic_error_t                     **e)
    910 {
    911     return (xcb_xvmc_list_subpicture_types_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
    912 }
    913 
    914