diff options
Diffstat (limited to 'lib/libxcb/src/sync.c')
-rw-r--r-- | lib/libxcb/src/sync.c | 239 |
1 files changed, 237 insertions, 2 deletions
diff --git a/lib/libxcb/src/sync.c b/lib/libxcb/src/sync.c index 9e024d603..1f352756d 100644 --- a/lib/libxcb/src/sync.c +++ b/lib/libxcb/src/sync.c @@ -3,10 +3,17 @@ * Edit at your peril. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <stdlib.h> #include <string.h> #include <assert.h> +#include <stddef.h> /* for offsetof() */ #include "xcbext.h" #include "sync.h" + +#define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) #include "xproto.h" xcb_extension_t xcb_sync_id = { "SYNC", 0 }; @@ -163,6 +170,35 @@ xcb_sync_int64_end (xcb_sync_int64_iterator_t i /**< */) return ret; } +int +xcb_sync_systemcounter_sizeof (const void *_buffer /**< */) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_systemcounter_t *_aux = (xcb_sync_systemcounter_t *)_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_block_len = 0; + unsigned int xcb_pad = 0; + unsigned int xcb_align_to; + + + xcb_block_len += sizeof(xcb_sync_systemcounter_t); + xcb_tmp += xcb_block_len; + /* name */ + xcb_block_len += _aux->name_len * sizeof(char); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(char); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + + return xcb_buffer_len; +} + /***************************************************************************** ** @@ -229,10 +265,11 @@ void xcb_sync_systemcounter_next (xcb_sync_systemcounter_iterator_t *i /**< */) { xcb_sync_systemcounter_t *R = i->data; - xcb_generic_iterator_t child = xcb_sync_systemcounter_name_end(R); + xcb_generic_iterator_t child; + child.data = (xcb_sync_systemcounter_t *)(((char *)R) + xcb_sync_systemcounter_sizeof(R)); + i->index = (char *) child.data - (char *) i->data; --i->rem; i->data = (xcb_sync_systemcounter_t *) child.data; - i->index = child.index; } @@ -368,6 +405,7 @@ xcb_sync_initialize (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -407,6 +445,7 @@ xcb_sync_initialize_unchecked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -431,6 +470,40 @@ xcb_sync_initialize_reply (xcb_connection_t *c /**< */, return (xcb_sync_initialize_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); } +int +xcb_sync_list_system_counters_sizeof (const void *_buffer /**< */) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_list_system_counters_reply_t *_aux = (xcb_sync_list_system_counters_reply_t *)_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_block_len = 0; + unsigned int xcb_pad = 0; + unsigned int xcb_align_to; + + unsigned int i; + unsigned int xcb_tmp_len; + + xcb_block_len += sizeof(xcb_sync_list_system_counters_reply_t); + xcb_tmp += xcb_block_len; + /* counters */ + for(i=0; i<_aux->counters_len; i++) { + xcb_tmp_len = xcb_sync_systemcounter_sizeof(xcb_tmp); + xcb_block_len += xcb_tmp_len; + xcb_tmp += xcb_tmp_len; + } + xcb_align_to = ALIGNOF(xcb_sync_systemcounter_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + + return xcb_buffer_len; +} + /***************************************************************************** ** @@ -460,6 +533,7 @@ xcb_sync_list_system_counters (xcb_connection_t *c /**< */) xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -493,6 +567,7 @@ xcb_sync_list_system_counters_unchecked (xcb_connection_t *c /**< */) xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -588,6 +663,7 @@ xcb_sync_create_counter_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -627,6 +703,7 @@ xcb_sync_create_counter (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -663,6 +740,7 @@ xcb_sync_destroy_counter_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -699,6 +777,7 @@ xcb_sync_destroy_counter (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -735,6 +814,7 @@ xcb_sync_query_counter (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -771,6 +851,7 @@ xcb_sync_query_counter_unchecked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -795,6 +876,35 @@ xcb_sync_query_counter_reply (xcb_connection_t *c /**< */, return (xcb_sync_query_counter_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); } +int +xcb_sync_await_sizeof (const void *_buffer /**< */, + uint32_t wait_list_len /**< */) +{ + char *xcb_tmp = (char *)_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_block_len = 0; + unsigned int xcb_pad = 0; + unsigned int xcb_align_to; + + + xcb_block_len += sizeof(xcb_sync_await_request_t); + xcb_tmp += xcb_block_len; + /* wait_list */ + xcb_block_len += wait_list_len * sizeof(xcb_sync_waitcondition_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_sync_waitcondition_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + + return xcb_buffer_len; +} + /***************************************************************************** ** @@ -828,10 +938,12 @@ xcb_sync_await_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* xcb_sync_waitcondition_t wait_list */ xcb_parts[4].iov_base = (char *) wait_list; xcb_parts[4].iov_len = wait_list_len * sizeof(xcb_sync_waitcondition_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -869,10 +981,12 @@ xcb_sync_await (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* xcb_sync_waitcondition_t wait_list */ xcb_parts[4].iov_base = (char *) wait_list; xcb_parts[4].iov_len = wait_list_len * sizeof(xcb_sync_waitcondition_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -912,6 +1026,7 @@ xcb_sync_change_counter_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -951,6 +1066,7 @@ xcb_sync_change_counter (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -990,6 +1106,7 @@ xcb_sync_set_counter_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1029,10 +1146,40 @@ xcb_sync_set_counter (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } +int +xcb_sync_create_alarm_sizeof (const void *_buffer /**< */) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_create_alarm_request_t *_aux = (xcb_sync_create_alarm_request_t *)_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_block_len = 0; + unsigned int xcb_pad = 0; + unsigned int xcb_align_to; + + + xcb_block_len += sizeof(xcb_sync_create_alarm_request_t); + xcb_tmp += xcb_block_len; + /* value_list */ + xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + + return xcb_buffer_len; +} + /***************************************************************************** ** @@ -1070,10 +1217,12 @@ xcb_sync_create_alarm_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* uint32_t value_list */ xcb_parts[4].iov_base = (char *) value_list; xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1115,14 +1264,45 @@ xcb_sync_create_alarm (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* uint32_t value_list */ xcb_parts[4].iov_base = (char *) value_list; xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } +int +xcb_sync_change_alarm_sizeof (const void *_buffer /**< */) +{ + char *xcb_tmp = (char *)_buffer; + const xcb_sync_change_alarm_request_t *_aux = (xcb_sync_change_alarm_request_t *)_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_block_len = 0; + unsigned int xcb_pad = 0; + unsigned int xcb_align_to; + + + xcb_block_len += sizeof(xcb_sync_change_alarm_request_t); + xcb_tmp += xcb_block_len; + /* value_list */ + xcb_block_len += xcb_popcount(_aux->value_mask) * sizeof(uint32_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(uint32_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + + return xcb_buffer_len; +} + /***************************************************************************** ** @@ -1160,10 +1340,12 @@ xcb_sync_change_alarm_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* uint32_t value_list */ xcb_parts[4].iov_base = (char *) value_list; xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1205,10 +1387,12 @@ xcb_sync_change_alarm (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* uint32_t value_list */ xcb_parts[4].iov_base = (char *) value_list; xcb_parts[4].iov_len = xcb_popcount(value_mask) * sizeof(uint32_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1245,6 +1429,7 @@ xcb_sync_destroy_alarm_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1281,6 +1466,7 @@ xcb_sync_destroy_alarm (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1317,6 +1503,7 @@ xcb_sync_query_alarm (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1353,6 +1540,7 @@ xcb_sync_query_alarm_unchecked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1412,6 +1600,7 @@ xcb_sync_set_priority_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1451,6 +1640,7 @@ xcb_sync_set_priority (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1487,6 +1677,7 @@ xcb_sync_get_priority (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1523,6 +1714,7 @@ xcb_sync_get_priority_unchecked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1585,6 +1777,7 @@ xcb_sync_create_fence_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1627,6 +1820,7 @@ xcb_sync_create_fence (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1663,6 +1857,7 @@ xcb_sync_trigger_fence_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1699,6 +1894,7 @@ xcb_sync_trigger_fence (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1735,6 +1931,7 @@ xcb_sync_reset_fence_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1771,6 +1968,7 @@ xcb_sync_reset_fence (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1807,6 +2005,7 @@ xcb_sync_destroy_fence_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1843,6 +2042,7 @@ xcb_sync_destroy_fence (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1879,6 +2079,7 @@ xcb_sync_query_fence (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1915,6 +2116,7 @@ xcb_sync_query_fence_unchecked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -1939,6 +2141,35 @@ xcb_sync_query_fence_reply (xcb_connection_t *c /**< */, return (xcb_sync_query_fence_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); } +int +xcb_sync_await_fence_sizeof (const void *_buffer /**< */, + uint32_t fence_list_len /**< */) +{ + char *xcb_tmp = (char *)_buffer; + unsigned int xcb_buffer_len = 0; + unsigned int xcb_block_len = 0; + unsigned int xcb_pad = 0; + unsigned int xcb_align_to; + + + xcb_block_len += sizeof(xcb_sync_await_fence_request_t); + xcb_tmp += xcb_block_len; + /* fence_list */ + xcb_block_len += fence_list_len * sizeof(xcb_sync_fence_t); + xcb_tmp += xcb_block_len; + xcb_align_to = ALIGNOF(xcb_sync_fence_t); + /* insert padding */ + xcb_pad = -xcb_block_len & (xcb_align_to - 1); + xcb_buffer_len += xcb_block_len + xcb_pad; + if (0 != xcb_pad) { + xcb_tmp += xcb_pad; + xcb_pad = 0; + } + xcb_block_len = 0; + + return xcb_buffer_len; +} + /***************************************************************************** ** @@ -1972,10 +2203,12 @@ xcb_sync_await_fence_checked (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* xcb_sync_fence_t fence_list */ xcb_parts[4].iov_base = (char *) fence_list; xcb_parts[4].iov_len = fence_list_len * sizeof(xcb_sync_fence_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); return xcb_ret; } @@ -2013,10 +2246,12 @@ xcb_sync_await_fence (xcb_connection_t *c /**< */, xcb_parts[2].iov_len = sizeof(xcb_out); xcb_parts[3].iov_base = 0; xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; + /* xcb_sync_fence_t fence_list */ xcb_parts[4].iov_base = (char *) fence_list; xcb_parts[4].iov_len = fence_list_len * sizeof(xcb_sync_fence_t); xcb_parts[5].iov_base = 0; xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3; + xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); return xcb_ret; } |