xref: /netbsd-src/external/mit/xorg/lib/libxcb/files/present.c (revision fea83ee4938f6f630ec4626dba8d28098c73f0cc)
16f16f8b8Smrg /*
26f16f8b8Smrg  * This file generated automatically from present.xml by c_client.py.
36f16f8b8Smrg  * Edit at your peril.
46f16f8b8Smrg  */
56f16f8b8Smrg 
66f16f8b8Smrg #ifdef HAVE_CONFIG_H
76f16f8b8Smrg #include "config.h"
86f16f8b8Smrg #endif
96f16f8b8Smrg #include <stdlib.h>
106f16f8b8Smrg #include <string.h>
116f16f8b8Smrg #include <assert.h>
126f16f8b8Smrg #include <stddef.h>  /* for offsetof() */
136f16f8b8Smrg #include "xcbext.h"
146f16f8b8Smrg #include "present.h"
156f16f8b8Smrg 
166f16f8b8Smrg #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
176f16f8b8Smrg #include "xproto.h"
186f16f8b8Smrg #include "randr.h"
196f16f8b8Smrg #include "xfixes.h"
206f16f8b8Smrg #include "sync.h"
21*fea83ee4Smrg #include "dri3.h"
226f16f8b8Smrg 
236f16f8b8Smrg xcb_extension_t xcb_present_id = { "Present", 0 };
246f16f8b8Smrg 
256f16f8b8Smrg void
xcb_present_notify_next(xcb_present_notify_iterator_t * i)26ba6321feSmrg xcb_present_notify_next (xcb_present_notify_iterator_t *i)
276f16f8b8Smrg {
286f16f8b8Smrg     --i->rem;
296f16f8b8Smrg     ++i->data;
306f16f8b8Smrg     i->index += sizeof(xcb_present_notify_t);
316f16f8b8Smrg }
326f16f8b8Smrg 
336f16f8b8Smrg xcb_generic_iterator_t
xcb_present_notify_end(xcb_present_notify_iterator_t i)34ba6321feSmrg xcb_present_notify_end (xcb_present_notify_iterator_t i)
356f16f8b8Smrg {
366f16f8b8Smrg     xcb_generic_iterator_t ret;
376f16f8b8Smrg     ret.data = i.data + i.rem;
386f16f8b8Smrg     ret.index = i.index + ((char *) ret.data - (char *) i.data);
396f16f8b8Smrg     ret.rem = 0;
406f16f8b8Smrg     return ret;
416f16f8b8Smrg }
426f16f8b8Smrg 
436f16f8b8Smrg xcb_present_query_version_cookie_t
xcb_present_query_version(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)44ba6321feSmrg xcb_present_query_version (xcb_connection_t *c,
45ba6321feSmrg                            uint32_t          major_version,
46ba6321feSmrg                            uint32_t          minor_version)
476f16f8b8Smrg {
486f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
49ba6321feSmrg         .count = 2,
50ba6321feSmrg         .ext = &xcb_present_id,
51ba6321feSmrg         .opcode = XCB_PRESENT_QUERY_VERSION,
52ba6321feSmrg         .isvoid = 0
536f16f8b8Smrg     };
546f16f8b8Smrg 
556f16f8b8Smrg     struct iovec xcb_parts[4];
566f16f8b8Smrg     xcb_present_query_version_cookie_t xcb_ret;
576f16f8b8Smrg     xcb_present_query_version_request_t xcb_out;
586f16f8b8Smrg 
596f16f8b8Smrg     xcb_out.major_version = major_version;
606f16f8b8Smrg     xcb_out.minor_version = minor_version;
616f16f8b8Smrg 
626f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
636f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
646f16f8b8Smrg     xcb_parts[3].iov_base = 0;
656f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
666f16f8b8Smrg 
676f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
686f16f8b8Smrg     return xcb_ret;
696f16f8b8Smrg }
706f16f8b8Smrg 
716f16f8b8Smrg xcb_present_query_version_cookie_t
xcb_present_query_version_unchecked(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)72ba6321feSmrg xcb_present_query_version_unchecked (xcb_connection_t *c,
73ba6321feSmrg                                      uint32_t          major_version,
74ba6321feSmrg                                      uint32_t          minor_version)
756f16f8b8Smrg {
766f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
77ba6321feSmrg         .count = 2,
78ba6321feSmrg         .ext = &xcb_present_id,
79ba6321feSmrg         .opcode = XCB_PRESENT_QUERY_VERSION,
80ba6321feSmrg         .isvoid = 0
816f16f8b8Smrg     };
826f16f8b8Smrg 
836f16f8b8Smrg     struct iovec xcb_parts[4];
846f16f8b8Smrg     xcb_present_query_version_cookie_t xcb_ret;
856f16f8b8Smrg     xcb_present_query_version_request_t xcb_out;
866f16f8b8Smrg 
876f16f8b8Smrg     xcb_out.major_version = major_version;
886f16f8b8Smrg     xcb_out.minor_version = minor_version;
896f16f8b8Smrg 
906f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
916f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
926f16f8b8Smrg     xcb_parts[3].iov_base = 0;
936f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
946f16f8b8Smrg 
956f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
966f16f8b8Smrg     return xcb_ret;
976f16f8b8Smrg }
986f16f8b8Smrg 
996f16f8b8Smrg xcb_present_query_version_reply_t *
xcb_present_query_version_reply(xcb_connection_t * c,xcb_present_query_version_cookie_t cookie,xcb_generic_error_t ** e)100ba6321feSmrg xcb_present_query_version_reply (xcb_connection_t                    *c,
1016f16f8b8Smrg                                  xcb_present_query_version_cookie_t   cookie  /**< */,
102ba6321feSmrg                                  xcb_generic_error_t                **e)
1036f16f8b8Smrg {
1046f16f8b8Smrg     return (xcb_present_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
1056f16f8b8Smrg }
1066f16f8b8Smrg 
1076f16f8b8Smrg int
xcb_present_pixmap_sizeof(const void * _buffer,uint32_t notifies_len)108ba6321feSmrg xcb_present_pixmap_sizeof (const void  *_buffer,
109ba6321feSmrg                            uint32_t     notifies_len)
1106f16f8b8Smrg {
1116f16f8b8Smrg     char *xcb_tmp = (char *)_buffer;
1126f16f8b8Smrg     unsigned int xcb_buffer_len = 0;
1136f16f8b8Smrg     unsigned int xcb_block_len = 0;
1146f16f8b8Smrg     unsigned int xcb_pad = 0;
1156f16f8b8Smrg     unsigned int xcb_align_to = 0;
1166f16f8b8Smrg 
1176f16f8b8Smrg 
1186f16f8b8Smrg     xcb_block_len += sizeof(xcb_present_pixmap_request_t);
1196f16f8b8Smrg     xcb_tmp += xcb_block_len;
1206f16f8b8Smrg     xcb_buffer_len += xcb_block_len;
1216f16f8b8Smrg     xcb_block_len = 0;
1226f16f8b8Smrg     /* notifies */
1236f16f8b8Smrg     xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
1246f16f8b8Smrg     xcb_tmp += xcb_block_len;
1256f16f8b8Smrg     xcb_align_to = ALIGNOF(xcb_present_notify_t);
1266f16f8b8Smrg     /* insert padding */
1276f16f8b8Smrg     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
1286f16f8b8Smrg     xcb_buffer_len += xcb_block_len + xcb_pad;
1296f16f8b8Smrg     if (0 != xcb_pad) {
1306f16f8b8Smrg         xcb_tmp += xcb_pad;
1316f16f8b8Smrg         xcb_pad = 0;
1326f16f8b8Smrg     }
1336f16f8b8Smrg     xcb_block_len = 0;
1346f16f8b8Smrg 
1356f16f8b8Smrg     return xcb_buffer_len;
1366f16f8b8Smrg }
1376f16f8b8Smrg 
1386f16f8b8Smrg xcb_void_cookie_t
xcb_present_pixmap_checked(xcb_connection_t * c,xcb_window_t window,xcb_pixmap_t pixmap,uint32_t serial,xcb_xfixes_region_t valid,xcb_xfixes_region_t update,int16_t x_off,int16_t y_off,xcb_randr_crtc_t target_crtc,xcb_sync_fence_t wait_fence,xcb_sync_fence_t idle_fence,uint32_t options,uint64_t target_msc,uint64_t divisor,uint64_t remainder,uint32_t notifies_len,const xcb_present_notify_t * notifies)139ba6321feSmrg xcb_present_pixmap_checked (xcb_connection_t           *c,
140ba6321feSmrg                             xcb_window_t                window,
141ba6321feSmrg                             xcb_pixmap_t                pixmap,
142ba6321feSmrg                             uint32_t                    serial,
143ba6321feSmrg                             xcb_xfixes_region_t         valid,
144ba6321feSmrg                             xcb_xfixes_region_t         update,
145ba6321feSmrg                             int16_t                     x_off,
146ba6321feSmrg                             int16_t                     y_off,
147ba6321feSmrg                             xcb_randr_crtc_t            target_crtc,
148ba6321feSmrg                             xcb_sync_fence_t            wait_fence,
149ba6321feSmrg                             xcb_sync_fence_t            idle_fence,
150ba6321feSmrg                             uint32_t                    options,
151ba6321feSmrg                             uint64_t                    target_msc,
152ba6321feSmrg                             uint64_t                    divisor,
153ba6321feSmrg                             uint64_t                    remainder,
154ba6321feSmrg                             uint32_t                    notifies_len,
155ba6321feSmrg                             const xcb_present_notify_t *notifies)
1566f16f8b8Smrg {
1576f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
158ba6321feSmrg         .count = 4,
159ba6321feSmrg         .ext = &xcb_present_id,
160ba6321feSmrg         .opcode = XCB_PRESENT_PIXMAP,
161ba6321feSmrg         .isvoid = 1
1626f16f8b8Smrg     };
1636f16f8b8Smrg 
1646f16f8b8Smrg     struct iovec xcb_parts[6];
1656f16f8b8Smrg     xcb_void_cookie_t xcb_ret;
1666f16f8b8Smrg     xcb_present_pixmap_request_t xcb_out;
1676f16f8b8Smrg 
1686f16f8b8Smrg     xcb_out.window = window;
1696f16f8b8Smrg     xcb_out.pixmap = pixmap;
1706f16f8b8Smrg     xcb_out.serial = serial;
1716f16f8b8Smrg     xcb_out.valid = valid;
1726f16f8b8Smrg     xcb_out.update = update;
1736f16f8b8Smrg     xcb_out.x_off = x_off;
1746f16f8b8Smrg     xcb_out.y_off = y_off;
1756f16f8b8Smrg     xcb_out.target_crtc = target_crtc;
1766f16f8b8Smrg     xcb_out.wait_fence = wait_fence;
1776f16f8b8Smrg     xcb_out.idle_fence = idle_fence;
1786f16f8b8Smrg     xcb_out.options = options;
1796f16f8b8Smrg     memset(xcb_out.pad0, 0, 4);
1806f16f8b8Smrg     xcb_out.target_msc = target_msc;
1816f16f8b8Smrg     xcb_out.divisor = divisor;
1826f16f8b8Smrg     xcb_out.remainder = remainder;
1836f16f8b8Smrg 
1846f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
1856f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
1866f16f8b8Smrg     xcb_parts[3].iov_base = 0;
1876f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
1886f16f8b8Smrg     /* xcb_present_notify_t notifies */
1896f16f8b8Smrg     xcb_parts[4].iov_base = (char *) notifies;
1906f16f8b8Smrg     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
1916f16f8b8Smrg     xcb_parts[5].iov_base = 0;
1926f16f8b8Smrg     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
1936f16f8b8Smrg 
1946f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
1956f16f8b8Smrg     return xcb_ret;
1966f16f8b8Smrg }
1976f16f8b8Smrg 
1986f16f8b8Smrg xcb_void_cookie_t
xcb_present_pixmap(xcb_connection_t * c,xcb_window_t window,xcb_pixmap_t pixmap,uint32_t serial,xcb_xfixes_region_t valid,xcb_xfixes_region_t update,int16_t x_off,int16_t y_off,xcb_randr_crtc_t target_crtc,xcb_sync_fence_t wait_fence,xcb_sync_fence_t idle_fence,uint32_t options,uint64_t target_msc,uint64_t divisor,uint64_t remainder,uint32_t notifies_len,const xcb_present_notify_t * notifies)199ba6321feSmrg xcb_present_pixmap (xcb_connection_t           *c,
200ba6321feSmrg                     xcb_window_t                window,
201ba6321feSmrg                     xcb_pixmap_t                pixmap,
202ba6321feSmrg                     uint32_t                    serial,
203ba6321feSmrg                     xcb_xfixes_region_t         valid,
204ba6321feSmrg                     xcb_xfixes_region_t         update,
205ba6321feSmrg                     int16_t                     x_off,
206ba6321feSmrg                     int16_t                     y_off,
207ba6321feSmrg                     xcb_randr_crtc_t            target_crtc,
208ba6321feSmrg                     xcb_sync_fence_t            wait_fence,
209ba6321feSmrg                     xcb_sync_fence_t            idle_fence,
210ba6321feSmrg                     uint32_t                    options,
211ba6321feSmrg                     uint64_t                    target_msc,
212ba6321feSmrg                     uint64_t                    divisor,
213ba6321feSmrg                     uint64_t                    remainder,
214ba6321feSmrg                     uint32_t                    notifies_len,
215ba6321feSmrg                     const xcb_present_notify_t *notifies)
2166f16f8b8Smrg {
2176f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
218ba6321feSmrg         .count = 4,
219ba6321feSmrg         .ext = &xcb_present_id,
220ba6321feSmrg         .opcode = XCB_PRESENT_PIXMAP,
221ba6321feSmrg         .isvoid = 1
2226f16f8b8Smrg     };
2236f16f8b8Smrg 
2246f16f8b8Smrg     struct iovec xcb_parts[6];
2256f16f8b8Smrg     xcb_void_cookie_t xcb_ret;
2266f16f8b8Smrg     xcb_present_pixmap_request_t xcb_out;
2276f16f8b8Smrg 
2286f16f8b8Smrg     xcb_out.window = window;
2296f16f8b8Smrg     xcb_out.pixmap = pixmap;
2306f16f8b8Smrg     xcb_out.serial = serial;
2316f16f8b8Smrg     xcb_out.valid = valid;
2326f16f8b8Smrg     xcb_out.update = update;
2336f16f8b8Smrg     xcb_out.x_off = x_off;
2346f16f8b8Smrg     xcb_out.y_off = y_off;
2356f16f8b8Smrg     xcb_out.target_crtc = target_crtc;
2366f16f8b8Smrg     xcb_out.wait_fence = wait_fence;
2376f16f8b8Smrg     xcb_out.idle_fence = idle_fence;
2386f16f8b8Smrg     xcb_out.options = options;
2396f16f8b8Smrg     memset(xcb_out.pad0, 0, 4);
2406f16f8b8Smrg     xcb_out.target_msc = target_msc;
2416f16f8b8Smrg     xcb_out.divisor = divisor;
2426f16f8b8Smrg     xcb_out.remainder = remainder;
2436f16f8b8Smrg 
2446f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
2456f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
2466f16f8b8Smrg     xcb_parts[3].iov_base = 0;
2476f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
2486f16f8b8Smrg     /* xcb_present_notify_t notifies */
2496f16f8b8Smrg     xcb_parts[4].iov_base = (char *) notifies;
2506f16f8b8Smrg     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
2516f16f8b8Smrg     xcb_parts[5].iov_base = 0;
2526f16f8b8Smrg     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
2536f16f8b8Smrg 
2546f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
2556f16f8b8Smrg     return xcb_ret;
2566f16f8b8Smrg }
2576f16f8b8Smrg 
258ba6321feSmrg xcb_present_notify_t *
xcb_present_pixmap_notifies(const xcb_present_pixmap_request_t * R)259ba6321feSmrg xcb_present_pixmap_notifies (const xcb_present_pixmap_request_t *R)
260ba6321feSmrg {
261ba6321feSmrg     return (xcb_present_notify_t *) (R + 1);
262ba6321feSmrg }
263ba6321feSmrg 
264ba6321feSmrg int
xcb_present_pixmap_notifies_length(const xcb_present_pixmap_request_t * R)265ba6321feSmrg xcb_present_pixmap_notifies_length (const xcb_present_pixmap_request_t *R)
266ba6321feSmrg {
267ba6321feSmrg     return (((R->length * 4) - sizeof(xcb_present_pixmap_request_t))/sizeof(xcb_present_notify_t));
268ba6321feSmrg }
269ba6321feSmrg 
270ba6321feSmrg xcb_present_notify_iterator_t
xcb_present_pixmap_notifies_iterator(const xcb_present_pixmap_request_t * R)271ba6321feSmrg xcb_present_pixmap_notifies_iterator (const xcb_present_pixmap_request_t *R)
272ba6321feSmrg {
273ba6321feSmrg     xcb_present_notify_iterator_t i;
274ba6321feSmrg     i.data = (xcb_present_notify_t *) (R + 1);
275ba6321feSmrg     i.rem = (((R->length * 4) - sizeof(xcb_present_pixmap_request_t))/sizeof(xcb_present_notify_t));
276ba6321feSmrg     i.index = (char *) i.data - (char *) R;
277ba6321feSmrg     return i;
278ba6321feSmrg }
279ba6321feSmrg 
2806f16f8b8Smrg xcb_void_cookie_t
xcb_present_notify_msc_checked(xcb_connection_t * c,xcb_window_t window,uint32_t serial,uint64_t target_msc,uint64_t divisor,uint64_t remainder)281ba6321feSmrg xcb_present_notify_msc_checked (xcb_connection_t *c,
282ba6321feSmrg                                 xcb_window_t      window,
283ba6321feSmrg                                 uint32_t          serial,
284ba6321feSmrg                                 uint64_t          target_msc,
285ba6321feSmrg                                 uint64_t          divisor,
286ba6321feSmrg                                 uint64_t          remainder)
2876f16f8b8Smrg {
2886f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
289ba6321feSmrg         .count = 2,
290ba6321feSmrg         .ext = &xcb_present_id,
291ba6321feSmrg         .opcode = XCB_PRESENT_NOTIFY_MSC,
292ba6321feSmrg         .isvoid = 1
2936f16f8b8Smrg     };
2946f16f8b8Smrg 
2956f16f8b8Smrg     struct iovec xcb_parts[4];
2966f16f8b8Smrg     xcb_void_cookie_t xcb_ret;
2976f16f8b8Smrg     xcb_present_notify_msc_request_t xcb_out;
2986f16f8b8Smrg 
2996f16f8b8Smrg     xcb_out.window = window;
3006f16f8b8Smrg     xcb_out.serial = serial;
3016f16f8b8Smrg     memset(xcb_out.pad0, 0, 4);
3026f16f8b8Smrg     xcb_out.target_msc = target_msc;
3036f16f8b8Smrg     xcb_out.divisor = divisor;
3046f16f8b8Smrg     xcb_out.remainder = remainder;
3056f16f8b8Smrg 
3066f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
3076f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
3086f16f8b8Smrg     xcb_parts[3].iov_base = 0;
3096f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3106f16f8b8Smrg 
3116f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3126f16f8b8Smrg     return xcb_ret;
3136f16f8b8Smrg }
3146f16f8b8Smrg 
3156f16f8b8Smrg xcb_void_cookie_t
xcb_present_notify_msc(xcb_connection_t * c,xcb_window_t window,uint32_t serial,uint64_t target_msc,uint64_t divisor,uint64_t remainder)316ba6321feSmrg xcb_present_notify_msc (xcb_connection_t *c,
317ba6321feSmrg                         xcb_window_t      window,
318ba6321feSmrg                         uint32_t          serial,
319ba6321feSmrg                         uint64_t          target_msc,
320ba6321feSmrg                         uint64_t          divisor,
321ba6321feSmrg                         uint64_t          remainder)
3226f16f8b8Smrg {
3236f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
324ba6321feSmrg         .count = 2,
325ba6321feSmrg         .ext = &xcb_present_id,
326ba6321feSmrg         .opcode = XCB_PRESENT_NOTIFY_MSC,
327ba6321feSmrg         .isvoid = 1
3286f16f8b8Smrg     };
3296f16f8b8Smrg 
3306f16f8b8Smrg     struct iovec xcb_parts[4];
3316f16f8b8Smrg     xcb_void_cookie_t xcb_ret;
3326f16f8b8Smrg     xcb_present_notify_msc_request_t xcb_out;
3336f16f8b8Smrg 
3346f16f8b8Smrg     xcb_out.window = window;
3356f16f8b8Smrg     xcb_out.serial = serial;
3366f16f8b8Smrg     memset(xcb_out.pad0, 0, 4);
3376f16f8b8Smrg     xcb_out.target_msc = target_msc;
3386f16f8b8Smrg     xcb_out.divisor = divisor;
3396f16f8b8Smrg     xcb_out.remainder = remainder;
3406f16f8b8Smrg 
3416f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
3426f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
3436f16f8b8Smrg     xcb_parts[3].iov_base = 0;
3446f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3456f16f8b8Smrg 
3466f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
3476f16f8b8Smrg     return xcb_ret;
3486f16f8b8Smrg }
3496f16f8b8Smrg 
3506f16f8b8Smrg void
xcb_present_event_next(xcb_present_event_iterator_t * i)351ba6321feSmrg xcb_present_event_next (xcb_present_event_iterator_t *i)
3526f16f8b8Smrg {
3536f16f8b8Smrg     --i->rem;
3546f16f8b8Smrg     ++i->data;
3556f16f8b8Smrg     i->index += sizeof(xcb_present_event_t);
3566f16f8b8Smrg }
3576f16f8b8Smrg 
3586f16f8b8Smrg xcb_generic_iterator_t
xcb_present_event_end(xcb_present_event_iterator_t i)359ba6321feSmrg xcb_present_event_end (xcb_present_event_iterator_t i)
3606f16f8b8Smrg {
3616f16f8b8Smrg     xcb_generic_iterator_t ret;
3626f16f8b8Smrg     ret.data = i.data + i.rem;
3636f16f8b8Smrg     ret.index = i.index + ((char *) ret.data - (char *) i.data);
3646f16f8b8Smrg     ret.rem = 0;
3656f16f8b8Smrg     return ret;
3666f16f8b8Smrg }
3676f16f8b8Smrg 
3686f16f8b8Smrg xcb_void_cookie_t
xcb_present_select_input_checked(xcb_connection_t * c,xcb_present_event_t eid,xcb_window_t window,uint32_t event_mask)369ba6321feSmrg xcb_present_select_input_checked (xcb_connection_t    *c,
370ba6321feSmrg                                   xcb_present_event_t  eid,
371ba6321feSmrg                                   xcb_window_t         window,
372ba6321feSmrg                                   uint32_t             event_mask)
3736f16f8b8Smrg {
3746f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
375ba6321feSmrg         .count = 2,
376ba6321feSmrg         .ext = &xcb_present_id,
377ba6321feSmrg         .opcode = XCB_PRESENT_SELECT_INPUT,
378ba6321feSmrg         .isvoid = 1
3796f16f8b8Smrg     };
3806f16f8b8Smrg 
3816f16f8b8Smrg     struct iovec xcb_parts[4];
3826f16f8b8Smrg     xcb_void_cookie_t xcb_ret;
3836f16f8b8Smrg     xcb_present_select_input_request_t xcb_out;
3846f16f8b8Smrg 
3856f16f8b8Smrg     xcb_out.eid = eid;
3866f16f8b8Smrg     xcb_out.window = window;
3876f16f8b8Smrg     xcb_out.event_mask = event_mask;
3886f16f8b8Smrg 
3896f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
3906f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
3916f16f8b8Smrg     xcb_parts[3].iov_base = 0;
3926f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
3936f16f8b8Smrg 
3946f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
3956f16f8b8Smrg     return xcb_ret;
3966f16f8b8Smrg }
3976f16f8b8Smrg 
3986f16f8b8Smrg xcb_void_cookie_t
xcb_present_select_input(xcb_connection_t * c,xcb_present_event_t eid,xcb_window_t window,uint32_t event_mask)399ba6321feSmrg xcb_present_select_input (xcb_connection_t    *c,
400ba6321feSmrg                           xcb_present_event_t  eid,
401ba6321feSmrg                           xcb_window_t         window,
402ba6321feSmrg                           uint32_t             event_mask)
4036f16f8b8Smrg {
4046f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
405ba6321feSmrg         .count = 2,
406ba6321feSmrg         .ext = &xcb_present_id,
407ba6321feSmrg         .opcode = XCB_PRESENT_SELECT_INPUT,
408ba6321feSmrg         .isvoid = 1
4096f16f8b8Smrg     };
4106f16f8b8Smrg 
4116f16f8b8Smrg     struct iovec xcb_parts[4];
4126f16f8b8Smrg     xcb_void_cookie_t xcb_ret;
4136f16f8b8Smrg     xcb_present_select_input_request_t xcb_out;
4146f16f8b8Smrg 
4156f16f8b8Smrg     xcb_out.eid = eid;
4166f16f8b8Smrg     xcb_out.window = window;
4176f16f8b8Smrg     xcb_out.event_mask = event_mask;
4186f16f8b8Smrg 
4196f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
4206f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
4216f16f8b8Smrg     xcb_parts[3].iov_base = 0;
4226f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4236f16f8b8Smrg 
4246f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4256f16f8b8Smrg     return xcb_ret;
4266f16f8b8Smrg }
4276f16f8b8Smrg 
4286f16f8b8Smrg xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities(xcb_connection_t * c,uint32_t target)429ba6321feSmrg xcb_present_query_capabilities (xcb_connection_t *c,
430ba6321feSmrg                                 uint32_t          target)
4316f16f8b8Smrg {
4326f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
433ba6321feSmrg         .count = 2,
434ba6321feSmrg         .ext = &xcb_present_id,
435ba6321feSmrg         .opcode = XCB_PRESENT_QUERY_CAPABILITIES,
436ba6321feSmrg         .isvoid = 0
4376f16f8b8Smrg     };
4386f16f8b8Smrg 
4396f16f8b8Smrg     struct iovec xcb_parts[4];
4406f16f8b8Smrg     xcb_present_query_capabilities_cookie_t xcb_ret;
4416f16f8b8Smrg     xcb_present_query_capabilities_request_t xcb_out;
4426f16f8b8Smrg 
4436f16f8b8Smrg     xcb_out.target = target;
4446f16f8b8Smrg 
4456f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
4466f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
4476f16f8b8Smrg     xcb_parts[3].iov_base = 0;
4486f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4496f16f8b8Smrg 
4506f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
4516f16f8b8Smrg     return xcb_ret;
4526f16f8b8Smrg }
4536f16f8b8Smrg 
4546f16f8b8Smrg xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities_unchecked(xcb_connection_t * c,uint32_t target)455ba6321feSmrg xcb_present_query_capabilities_unchecked (xcb_connection_t *c,
456ba6321feSmrg                                           uint32_t          target)
4576f16f8b8Smrg {
4586f16f8b8Smrg     static const xcb_protocol_request_t xcb_req = {
459ba6321feSmrg         .count = 2,
460ba6321feSmrg         .ext = &xcb_present_id,
461ba6321feSmrg         .opcode = XCB_PRESENT_QUERY_CAPABILITIES,
462ba6321feSmrg         .isvoid = 0
4636f16f8b8Smrg     };
4646f16f8b8Smrg 
4656f16f8b8Smrg     struct iovec xcb_parts[4];
4666f16f8b8Smrg     xcb_present_query_capabilities_cookie_t xcb_ret;
4676f16f8b8Smrg     xcb_present_query_capabilities_request_t xcb_out;
4686f16f8b8Smrg 
4696f16f8b8Smrg     xcb_out.target = target;
4706f16f8b8Smrg 
4716f16f8b8Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
4726f16f8b8Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
4736f16f8b8Smrg     xcb_parts[3].iov_base = 0;
4746f16f8b8Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
4756f16f8b8Smrg 
4766f16f8b8Smrg     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
4776f16f8b8Smrg     return xcb_ret;
4786f16f8b8Smrg }
4796f16f8b8Smrg 
4806f16f8b8Smrg xcb_present_query_capabilities_reply_t *
xcb_present_query_capabilities_reply(xcb_connection_t * c,xcb_present_query_capabilities_cookie_t cookie,xcb_generic_error_t ** e)481ba6321feSmrg xcb_present_query_capabilities_reply (xcb_connection_t                         *c,
4826f16f8b8Smrg                                       xcb_present_query_capabilities_cookie_t   cookie  /**< */,
483ba6321feSmrg                                       xcb_generic_error_t                     **e)
4846f16f8b8Smrg {
4856f16f8b8Smrg     return (xcb_present_query_capabilities_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
4866f16f8b8Smrg }
4876f16f8b8Smrg 
4886f16f8b8Smrg int
xcb_present_pixmap_synced_sizeof(const void * _buffer,uint32_t notifies_len)489*fea83ee4Smrg xcb_present_pixmap_synced_sizeof (const void  *_buffer,
490*fea83ee4Smrg                                   uint32_t     notifies_len)
491*fea83ee4Smrg {
492*fea83ee4Smrg     char *xcb_tmp = (char *)_buffer;
493*fea83ee4Smrg     unsigned int xcb_buffer_len = 0;
494*fea83ee4Smrg     unsigned int xcb_block_len = 0;
495*fea83ee4Smrg     unsigned int xcb_pad = 0;
496*fea83ee4Smrg     unsigned int xcb_align_to = 0;
497*fea83ee4Smrg 
498*fea83ee4Smrg 
499*fea83ee4Smrg     xcb_block_len += sizeof(xcb_present_pixmap_synced_request_t);
500*fea83ee4Smrg     xcb_tmp += xcb_block_len;
501*fea83ee4Smrg     xcb_buffer_len += xcb_block_len;
502*fea83ee4Smrg     xcb_block_len = 0;
503*fea83ee4Smrg     /* notifies */
504*fea83ee4Smrg     xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
505*fea83ee4Smrg     xcb_tmp += xcb_block_len;
506*fea83ee4Smrg     xcb_align_to = ALIGNOF(xcb_present_notify_t);
507*fea83ee4Smrg     /* insert padding */
508*fea83ee4Smrg     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
509*fea83ee4Smrg     xcb_buffer_len += xcb_block_len + xcb_pad;
510*fea83ee4Smrg     if (0 != xcb_pad) {
511*fea83ee4Smrg         xcb_tmp += xcb_pad;
512*fea83ee4Smrg         xcb_pad = 0;
513*fea83ee4Smrg     }
514*fea83ee4Smrg     xcb_block_len = 0;
515*fea83ee4Smrg 
516*fea83ee4Smrg     return xcb_buffer_len;
517*fea83ee4Smrg }
518*fea83ee4Smrg 
519*fea83ee4Smrg xcb_void_cookie_t
xcb_present_pixmap_synced_checked(xcb_connection_t * c,xcb_window_t window,xcb_pixmap_t pixmap,uint32_t serial,xcb_xfixes_region_t valid,xcb_xfixes_region_t update,int16_t x_off,int16_t y_off,xcb_randr_crtc_t target_crtc,xcb_dri3_syncobj_t acquire_syncobj,xcb_dri3_syncobj_t release_syncobj,uint64_t acquire_point,uint64_t release_point,uint32_t options,uint64_t target_msc,uint64_t divisor,uint64_t remainder,uint32_t notifies_len,const xcb_present_notify_t * notifies)520*fea83ee4Smrg xcb_present_pixmap_synced_checked (xcb_connection_t           *c,
521*fea83ee4Smrg                                    xcb_window_t                window,
522*fea83ee4Smrg                                    xcb_pixmap_t                pixmap,
523*fea83ee4Smrg                                    uint32_t                    serial,
524*fea83ee4Smrg                                    xcb_xfixes_region_t         valid,
525*fea83ee4Smrg                                    xcb_xfixes_region_t         update,
526*fea83ee4Smrg                                    int16_t                     x_off,
527*fea83ee4Smrg                                    int16_t                     y_off,
528*fea83ee4Smrg                                    xcb_randr_crtc_t            target_crtc,
529*fea83ee4Smrg                                    xcb_dri3_syncobj_t          acquire_syncobj,
530*fea83ee4Smrg                                    xcb_dri3_syncobj_t          release_syncobj,
531*fea83ee4Smrg                                    uint64_t                    acquire_point,
532*fea83ee4Smrg                                    uint64_t                    release_point,
533*fea83ee4Smrg                                    uint32_t                    options,
534*fea83ee4Smrg                                    uint64_t                    target_msc,
535*fea83ee4Smrg                                    uint64_t                    divisor,
536*fea83ee4Smrg                                    uint64_t                    remainder,
537*fea83ee4Smrg                                    uint32_t                    notifies_len,
538*fea83ee4Smrg                                    const xcb_present_notify_t *notifies)
539*fea83ee4Smrg {
540*fea83ee4Smrg     static const xcb_protocol_request_t xcb_req = {
541*fea83ee4Smrg         .count = 4,
542*fea83ee4Smrg         .ext = &xcb_present_id,
543*fea83ee4Smrg         .opcode = XCB_PRESENT_PIXMAP_SYNCED,
544*fea83ee4Smrg         .isvoid = 1
545*fea83ee4Smrg     };
546*fea83ee4Smrg 
547*fea83ee4Smrg     struct iovec xcb_parts[6];
548*fea83ee4Smrg     xcb_void_cookie_t xcb_ret;
549*fea83ee4Smrg     xcb_present_pixmap_synced_request_t xcb_out;
550*fea83ee4Smrg 
551*fea83ee4Smrg     xcb_out.window = window;
552*fea83ee4Smrg     xcb_out.pixmap = pixmap;
553*fea83ee4Smrg     xcb_out.serial = serial;
554*fea83ee4Smrg     xcb_out.valid = valid;
555*fea83ee4Smrg     xcb_out.update = update;
556*fea83ee4Smrg     xcb_out.x_off = x_off;
557*fea83ee4Smrg     xcb_out.y_off = y_off;
558*fea83ee4Smrg     xcb_out.target_crtc = target_crtc;
559*fea83ee4Smrg     xcb_out.acquire_syncobj = acquire_syncobj;
560*fea83ee4Smrg     xcb_out.release_syncobj = release_syncobj;
561*fea83ee4Smrg     xcb_out.acquire_point = acquire_point;
562*fea83ee4Smrg     xcb_out.release_point = release_point;
563*fea83ee4Smrg     xcb_out.options = options;
564*fea83ee4Smrg     memset(xcb_out.pad0, 0, 4);
565*fea83ee4Smrg     xcb_out.target_msc = target_msc;
566*fea83ee4Smrg     xcb_out.divisor = divisor;
567*fea83ee4Smrg     xcb_out.remainder = remainder;
568*fea83ee4Smrg 
569*fea83ee4Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
570*fea83ee4Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
571*fea83ee4Smrg     xcb_parts[3].iov_base = 0;
572*fea83ee4Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
573*fea83ee4Smrg     /* xcb_present_notify_t notifies */
574*fea83ee4Smrg     xcb_parts[4].iov_base = (char *) notifies;
575*fea83ee4Smrg     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
576*fea83ee4Smrg     xcb_parts[5].iov_base = 0;
577*fea83ee4Smrg     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
578*fea83ee4Smrg 
579*fea83ee4Smrg     xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
580*fea83ee4Smrg     return xcb_ret;
581*fea83ee4Smrg }
582*fea83ee4Smrg 
583*fea83ee4Smrg xcb_void_cookie_t
xcb_present_pixmap_synced(xcb_connection_t * c,xcb_window_t window,xcb_pixmap_t pixmap,uint32_t serial,xcb_xfixes_region_t valid,xcb_xfixes_region_t update,int16_t x_off,int16_t y_off,xcb_randr_crtc_t target_crtc,xcb_dri3_syncobj_t acquire_syncobj,xcb_dri3_syncobj_t release_syncobj,uint64_t acquire_point,uint64_t release_point,uint32_t options,uint64_t target_msc,uint64_t divisor,uint64_t remainder,uint32_t notifies_len,const xcb_present_notify_t * notifies)584*fea83ee4Smrg xcb_present_pixmap_synced (xcb_connection_t           *c,
585*fea83ee4Smrg                            xcb_window_t                window,
586*fea83ee4Smrg                            xcb_pixmap_t                pixmap,
587*fea83ee4Smrg                            uint32_t                    serial,
588*fea83ee4Smrg                            xcb_xfixes_region_t         valid,
589*fea83ee4Smrg                            xcb_xfixes_region_t         update,
590*fea83ee4Smrg                            int16_t                     x_off,
591*fea83ee4Smrg                            int16_t                     y_off,
592*fea83ee4Smrg                            xcb_randr_crtc_t            target_crtc,
593*fea83ee4Smrg                            xcb_dri3_syncobj_t          acquire_syncobj,
594*fea83ee4Smrg                            xcb_dri3_syncobj_t          release_syncobj,
595*fea83ee4Smrg                            uint64_t                    acquire_point,
596*fea83ee4Smrg                            uint64_t                    release_point,
597*fea83ee4Smrg                            uint32_t                    options,
598*fea83ee4Smrg                            uint64_t                    target_msc,
599*fea83ee4Smrg                            uint64_t                    divisor,
600*fea83ee4Smrg                            uint64_t                    remainder,
601*fea83ee4Smrg                            uint32_t                    notifies_len,
602*fea83ee4Smrg                            const xcb_present_notify_t *notifies)
603*fea83ee4Smrg {
604*fea83ee4Smrg     static const xcb_protocol_request_t xcb_req = {
605*fea83ee4Smrg         .count = 4,
606*fea83ee4Smrg         .ext = &xcb_present_id,
607*fea83ee4Smrg         .opcode = XCB_PRESENT_PIXMAP_SYNCED,
608*fea83ee4Smrg         .isvoid = 1
609*fea83ee4Smrg     };
610*fea83ee4Smrg 
611*fea83ee4Smrg     struct iovec xcb_parts[6];
612*fea83ee4Smrg     xcb_void_cookie_t xcb_ret;
613*fea83ee4Smrg     xcb_present_pixmap_synced_request_t xcb_out;
614*fea83ee4Smrg 
615*fea83ee4Smrg     xcb_out.window = window;
616*fea83ee4Smrg     xcb_out.pixmap = pixmap;
617*fea83ee4Smrg     xcb_out.serial = serial;
618*fea83ee4Smrg     xcb_out.valid = valid;
619*fea83ee4Smrg     xcb_out.update = update;
620*fea83ee4Smrg     xcb_out.x_off = x_off;
621*fea83ee4Smrg     xcb_out.y_off = y_off;
622*fea83ee4Smrg     xcb_out.target_crtc = target_crtc;
623*fea83ee4Smrg     xcb_out.acquire_syncobj = acquire_syncobj;
624*fea83ee4Smrg     xcb_out.release_syncobj = release_syncobj;
625*fea83ee4Smrg     xcb_out.acquire_point = acquire_point;
626*fea83ee4Smrg     xcb_out.release_point = release_point;
627*fea83ee4Smrg     xcb_out.options = options;
628*fea83ee4Smrg     memset(xcb_out.pad0, 0, 4);
629*fea83ee4Smrg     xcb_out.target_msc = target_msc;
630*fea83ee4Smrg     xcb_out.divisor = divisor;
631*fea83ee4Smrg     xcb_out.remainder = remainder;
632*fea83ee4Smrg 
633*fea83ee4Smrg     xcb_parts[2].iov_base = (char *) &xcb_out;
634*fea83ee4Smrg     xcb_parts[2].iov_len = sizeof(xcb_out);
635*fea83ee4Smrg     xcb_parts[3].iov_base = 0;
636*fea83ee4Smrg     xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
637*fea83ee4Smrg     /* xcb_present_notify_t notifies */
638*fea83ee4Smrg     xcb_parts[4].iov_base = (char *) notifies;
639*fea83ee4Smrg     xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
640*fea83ee4Smrg     xcb_parts[5].iov_base = 0;
641*fea83ee4Smrg     xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
642*fea83ee4Smrg 
643*fea83ee4Smrg     xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
644*fea83ee4Smrg     return xcb_ret;
645*fea83ee4Smrg }
646*fea83ee4Smrg 
647*fea83ee4Smrg xcb_present_notify_t *
xcb_present_pixmap_synced_notifies(const xcb_present_pixmap_synced_request_t * R)648*fea83ee4Smrg xcb_present_pixmap_synced_notifies (const xcb_present_pixmap_synced_request_t *R)
649*fea83ee4Smrg {
650*fea83ee4Smrg     return (xcb_present_notify_t *) (R + 1);
651*fea83ee4Smrg }
652*fea83ee4Smrg 
653*fea83ee4Smrg int
xcb_present_pixmap_synced_notifies_length(const xcb_present_pixmap_synced_request_t * R)654*fea83ee4Smrg xcb_present_pixmap_synced_notifies_length (const xcb_present_pixmap_synced_request_t *R)
655*fea83ee4Smrg {
656*fea83ee4Smrg     return (((R->length * 4) - sizeof(xcb_present_pixmap_synced_request_t))/sizeof(xcb_present_notify_t));
657*fea83ee4Smrg }
658*fea83ee4Smrg 
659*fea83ee4Smrg xcb_present_notify_iterator_t
xcb_present_pixmap_synced_notifies_iterator(const xcb_present_pixmap_synced_request_t * R)660*fea83ee4Smrg xcb_present_pixmap_synced_notifies_iterator (const xcb_present_pixmap_synced_request_t *R)
661*fea83ee4Smrg {
662*fea83ee4Smrg     xcb_present_notify_iterator_t i;
663*fea83ee4Smrg     i.data = (xcb_present_notify_t *) (R + 1);
664*fea83ee4Smrg     i.rem = (((R->length * 4) - sizeof(xcb_present_pixmap_synced_request_t))/sizeof(xcb_present_notify_t));
665*fea83ee4Smrg     i.index = (char *) i.data - (char *) R;
666*fea83ee4Smrg     return i;
667*fea83ee4Smrg }
668*fea83ee4Smrg 
669*fea83ee4Smrg int
xcb_present_redirect_notify_sizeof(const void * _buffer,uint32_t notifies_len)670ba6321feSmrg xcb_present_redirect_notify_sizeof (const void  *_buffer,
671ba6321feSmrg                                     uint32_t     notifies_len)
6726f16f8b8Smrg {
6736f16f8b8Smrg     char *xcb_tmp = (char *)_buffer;
6746f16f8b8Smrg     unsigned int xcb_buffer_len = 0;
6756f16f8b8Smrg     unsigned int xcb_block_len = 0;
6766f16f8b8Smrg     unsigned int xcb_pad = 0;
6776f16f8b8Smrg     unsigned int xcb_align_to = 0;
6786f16f8b8Smrg 
6796f16f8b8Smrg 
6806f16f8b8Smrg     xcb_block_len += sizeof(xcb_present_redirect_notify_event_t);
6816f16f8b8Smrg     xcb_tmp += xcb_block_len;
6826f16f8b8Smrg     xcb_buffer_len += xcb_block_len;
6836f16f8b8Smrg     xcb_block_len = 0;
6846f16f8b8Smrg     /* notifies */
6856f16f8b8Smrg     xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
6866f16f8b8Smrg     xcb_tmp += xcb_block_len;
6876f16f8b8Smrg     xcb_align_to = ALIGNOF(xcb_present_notify_t);
6886f16f8b8Smrg     /* insert padding */
6896f16f8b8Smrg     xcb_pad = -xcb_block_len & (xcb_align_to - 1);
6906f16f8b8Smrg     xcb_buffer_len += xcb_block_len + xcb_pad;
6916f16f8b8Smrg     if (0 != xcb_pad) {
6926f16f8b8Smrg         xcb_tmp += xcb_pad;
6936f16f8b8Smrg         xcb_pad = 0;
6946f16f8b8Smrg     }
6956f16f8b8Smrg     xcb_block_len = 0;
6966f16f8b8Smrg 
6976f16f8b8Smrg     return xcb_buffer_len;
6986f16f8b8Smrg }
6996f16f8b8Smrg 
700ba6321feSmrg xcb_present_notify_t *
xcb_present_redirect_notify_notifies(const xcb_present_redirect_notify_event_t * R)701ba6321feSmrg xcb_present_redirect_notify_notifies (const xcb_present_redirect_notify_event_t *R)
702ba6321feSmrg {
703ba6321feSmrg     return (xcb_present_notify_t *) (R + 1);
704ba6321feSmrg }
705ba6321feSmrg 
706ba6321feSmrg int
xcb_present_redirect_notify_notifies_length(const xcb_present_redirect_notify_event_t * R)707ba6321feSmrg xcb_present_redirect_notify_notifies_length (const xcb_present_redirect_notify_event_t *R)
708ba6321feSmrg {
709ba6321feSmrg     return (((R->length * 4) - sizeof(xcb_present_redirect_notify_event_t))/sizeof(xcb_present_notify_t));
710ba6321feSmrg }
711ba6321feSmrg 
712ba6321feSmrg xcb_present_notify_iterator_t
xcb_present_redirect_notify_notifies_iterator(const xcb_present_redirect_notify_event_t * R)713ba6321feSmrg xcb_present_redirect_notify_notifies_iterator (const xcb_present_redirect_notify_event_t *R)
714ba6321feSmrg {
715ba6321feSmrg     xcb_present_notify_iterator_t i;
716ba6321feSmrg     i.data = (xcb_present_notify_t *) (R + 1);
717ba6321feSmrg     i.rem = (((R->length * 4) - sizeof(xcb_present_redirect_notify_event_t))/sizeof(xcb_present_notify_t));
718ba6321feSmrg     i.index = (char *) i.data - (char *) R;
719ba6321feSmrg     return i;
720ba6321feSmrg }
721ba6321feSmrg 
722