1 /*
2 * This file generated automatically from present.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 "present.h"
15
16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member)
17 #include "xproto.h"
18 #include "randr.h"
19 #include "xfixes.h"
20 #include "sync.h"
21 #include "dri3.h"
22
23 xcb_extension_t xcb_present_id = { "Present", 0 };
24
25 void
xcb_present_notify_next(xcb_present_notify_iterator_t * i)26 xcb_present_notify_next (xcb_present_notify_iterator_t *i)
27 {
28 --i->rem;
29 ++i->data;
30 i->index += sizeof(xcb_present_notify_t);
31 }
32
33 xcb_generic_iterator_t
xcb_present_notify_end(xcb_present_notify_iterator_t i)34 xcb_present_notify_end (xcb_present_notify_iterator_t i)
35 {
36 xcb_generic_iterator_t ret;
37 ret.data = i.data + i.rem;
38 ret.index = i.index + ((char *) ret.data - (char *) i.data);
39 ret.rem = 0;
40 return ret;
41 }
42
43 xcb_present_query_version_cookie_t
xcb_present_query_version(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)44 xcb_present_query_version (xcb_connection_t *c,
45 uint32_t major_version,
46 uint32_t minor_version)
47 {
48 static const xcb_protocol_request_t xcb_req = {
49 .count = 2,
50 .ext = &xcb_present_id,
51 .opcode = XCB_PRESENT_QUERY_VERSION,
52 .isvoid = 0
53 };
54
55 struct iovec xcb_parts[4];
56 xcb_present_query_version_cookie_t xcb_ret;
57 xcb_present_query_version_request_t xcb_out;
58
59 xcb_out.major_version = major_version;
60 xcb_out.minor_version = minor_version;
61
62 xcb_parts[2].iov_base = (char *) &xcb_out;
63 xcb_parts[2].iov_len = sizeof(xcb_out);
64 xcb_parts[3].iov_base = 0;
65 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
66
67 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
68 return xcb_ret;
69 }
70
71 xcb_present_query_version_cookie_t
xcb_present_query_version_unchecked(xcb_connection_t * c,uint32_t major_version,uint32_t minor_version)72 xcb_present_query_version_unchecked (xcb_connection_t *c,
73 uint32_t major_version,
74 uint32_t minor_version)
75 {
76 static const xcb_protocol_request_t xcb_req = {
77 .count = 2,
78 .ext = &xcb_present_id,
79 .opcode = XCB_PRESENT_QUERY_VERSION,
80 .isvoid = 0
81 };
82
83 struct iovec xcb_parts[4];
84 xcb_present_query_version_cookie_t xcb_ret;
85 xcb_present_query_version_request_t xcb_out;
86
87 xcb_out.major_version = major_version;
88 xcb_out.minor_version = minor_version;
89
90 xcb_parts[2].iov_base = (char *) &xcb_out;
91 xcb_parts[2].iov_len = sizeof(xcb_out);
92 xcb_parts[3].iov_base = 0;
93 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
94
95 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
96 return xcb_ret;
97 }
98
99 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)100 xcb_present_query_version_reply (xcb_connection_t *c,
101 xcb_present_query_version_cookie_t cookie /**< */,
102 xcb_generic_error_t **e)
103 {
104 return (xcb_present_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
105 }
106
107 int
xcb_present_pixmap_sizeof(const void * _buffer,uint32_t notifies_len)108 xcb_present_pixmap_sizeof (const void *_buffer,
109 uint32_t notifies_len)
110 {
111 char *xcb_tmp = (char *)_buffer;
112 unsigned int xcb_buffer_len = 0;
113 unsigned int xcb_block_len = 0;
114 unsigned int xcb_pad = 0;
115 unsigned int xcb_align_to = 0;
116
117
118 xcb_block_len += sizeof(xcb_present_pixmap_request_t);
119 xcb_tmp += xcb_block_len;
120 xcb_buffer_len += xcb_block_len;
121 xcb_block_len = 0;
122 /* notifies */
123 xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
124 xcb_tmp += xcb_block_len;
125 xcb_align_to = ALIGNOF(xcb_present_notify_t);
126 /* insert padding */
127 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
128 xcb_buffer_len += xcb_block_len + xcb_pad;
129 if (0 != xcb_pad) {
130 xcb_tmp += xcb_pad;
131 xcb_pad = 0;
132 }
133 xcb_block_len = 0;
134
135 return xcb_buffer_len;
136 }
137
138 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)139 xcb_present_pixmap_checked (xcb_connection_t *c,
140 xcb_window_t window,
141 xcb_pixmap_t pixmap,
142 uint32_t serial,
143 xcb_xfixes_region_t valid,
144 xcb_xfixes_region_t update,
145 int16_t x_off,
146 int16_t y_off,
147 xcb_randr_crtc_t target_crtc,
148 xcb_sync_fence_t wait_fence,
149 xcb_sync_fence_t idle_fence,
150 uint32_t options,
151 uint64_t target_msc,
152 uint64_t divisor,
153 uint64_t remainder,
154 uint32_t notifies_len,
155 const xcb_present_notify_t *notifies)
156 {
157 static const xcb_protocol_request_t xcb_req = {
158 .count = 4,
159 .ext = &xcb_present_id,
160 .opcode = XCB_PRESENT_PIXMAP,
161 .isvoid = 1
162 };
163
164 struct iovec xcb_parts[6];
165 xcb_void_cookie_t xcb_ret;
166 xcb_present_pixmap_request_t xcb_out;
167
168 xcb_out.window = window;
169 xcb_out.pixmap = pixmap;
170 xcb_out.serial = serial;
171 xcb_out.valid = valid;
172 xcb_out.update = update;
173 xcb_out.x_off = x_off;
174 xcb_out.y_off = y_off;
175 xcb_out.target_crtc = target_crtc;
176 xcb_out.wait_fence = wait_fence;
177 xcb_out.idle_fence = idle_fence;
178 xcb_out.options = options;
179 memset(xcb_out.pad0, 0, 4);
180 xcb_out.target_msc = target_msc;
181 xcb_out.divisor = divisor;
182 xcb_out.remainder = remainder;
183
184 xcb_parts[2].iov_base = (char *) &xcb_out;
185 xcb_parts[2].iov_len = sizeof(xcb_out);
186 xcb_parts[3].iov_base = 0;
187 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
188 /* xcb_present_notify_t notifies */
189 xcb_parts[4].iov_base = (char *) notifies;
190 xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
191 xcb_parts[5].iov_base = 0;
192 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
193
194 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
195 return xcb_ret;
196 }
197
198 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)199 xcb_present_pixmap (xcb_connection_t *c,
200 xcb_window_t window,
201 xcb_pixmap_t pixmap,
202 uint32_t serial,
203 xcb_xfixes_region_t valid,
204 xcb_xfixes_region_t update,
205 int16_t x_off,
206 int16_t y_off,
207 xcb_randr_crtc_t target_crtc,
208 xcb_sync_fence_t wait_fence,
209 xcb_sync_fence_t idle_fence,
210 uint32_t options,
211 uint64_t target_msc,
212 uint64_t divisor,
213 uint64_t remainder,
214 uint32_t notifies_len,
215 const xcb_present_notify_t *notifies)
216 {
217 static const xcb_protocol_request_t xcb_req = {
218 .count = 4,
219 .ext = &xcb_present_id,
220 .opcode = XCB_PRESENT_PIXMAP,
221 .isvoid = 1
222 };
223
224 struct iovec xcb_parts[6];
225 xcb_void_cookie_t xcb_ret;
226 xcb_present_pixmap_request_t xcb_out;
227
228 xcb_out.window = window;
229 xcb_out.pixmap = pixmap;
230 xcb_out.serial = serial;
231 xcb_out.valid = valid;
232 xcb_out.update = update;
233 xcb_out.x_off = x_off;
234 xcb_out.y_off = y_off;
235 xcb_out.target_crtc = target_crtc;
236 xcb_out.wait_fence = wait_fence;
237 xcb_out.idle_fence = idle_fence;
238 xcb_out.options = options;
239 memset(xcb_out.pad0, 0, 4);
240 xcb_out.target_msc = target_msc;
241 xcb_out.divisor = divisor;
242 xcb_out.remainder = remainder;
243
244 xcb_parts[2].iov_base = (char *) &xcb_out;
245 xcb_parts[2].iov_len = sizeof(xcb_out);
246 xcb_parts[3].iov_base = 0;
247 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
248 /* xcb_present_notify_t notifies */
249 xcb_parts[4].iov_base = (char *) notifies;
250 xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
251 xcb_parts[5].iov_base = 0;
252 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
253
254 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
255 return xcb_ret;
256 }
257
258 xcb_present_notify_t *
xcb_present_pixmap_notifies(const xcb_present_pixmap_request_t * R)259 xcb_present_pixmap_notifies (const xcb_present_pixmap_request_t *R)
260 {
261 return (xcb_present_notify_t *) (R + 1);
262 }
263
264 int
xcb_present_pixmap_notifies_length(const xcb_present_pixmap_request_t * R)265 xcb_present_pixmap_notifies_length (const xcb_present_pixmap_request_t *R)
266 {
267 return (((R->length * 4) - sizeof(xcb_present_pixmap_request_t))/sizeof(xcb_present_notify_t));
268 }
269
270 xcb_present_notify_iterator_t
xcb_present_pixmap_notifies_iterator(const xcb_present_pixmap_request_t * R)271 xcb_present_pixmap_notifies_iterator (const xcb_present_pixmap_request_t *R)
272 {
273 xcb_present_notify_iterator_t i;
274 i.data = (xcb_present_notify_t *) (R + 1);
275 i.rem = (((R->length * 4) - sizeof(xcb_present_pixmap_request_t))/sizeof(xcb_present_notify_t));
276 i.index = (char *) i.data - (char *) R;
277 return i;
278 }
279
280 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)281 xcb_present_notify_msc_checked (xcb_connection_t *c,
282 xcb_window_t window,
283 uint32_t serial,
284 uint64_t target_msc,
285 uint64_t divisor,
286 uint64_t remainder)
287 {
288 static const xcb_protocol_request_t xcb_req = {
289 .count = 2,
290 .ext = &xcb_present_id,
291 .opcode = XCB_PRESENT_NOTIFY_MSC,
292 .isvoid = 1
293 };
294
295 struct iovec xcb_parts[4];
296 xcb_void_cookie_t xcb_ret;
297 xcb_present_notify_msc_request_t xcb_out;
298
299 xcb_out.window = window;
300 xcb_out.serial = serial;
301 memset(xcb_out.pad0, 0, 4);
302 xcb_out.target_msc = target_msc;
303 xcb_out.divisor = divisor;
304 xcb_out.remainder = remainder;
305
306 xcb_parts[2].iov_base = (char *) &xcb_out;
307 xcb_parts[2].iov_len = sizeof(xcb_out);
308 xcb_parts[3].iov_base = 0;
309 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
310
311 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
312 return xcb_ret;
313 }
314
315 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)316 xcb_present_notify_msc (xcb_connection_t *c,
317 xcb_window_t window,
318 uint32_t serial,
319 uint64_t target_msc,
320 uint64_t divisor,
321 uint64_t remainder)
322 {
323 static const xcb_protocol_request_t xcb_req = {
324 .count = 2,
325 .ext = &xcb_present_id,
326 .opcode = XCB_PRESENT_NOTIFY_MSC,
327 .isvoid = 1
328 };
329
330 struct iovec xcb_parts[4];
331 xcb_void_cookie_t xcb_ret;
332 xcb_present_notify_msc_request_t xcb_out;
333
334 xcb_out.window = window;
335 xcb_out.serial = serial;
336 memset(xcb_out.pad0, 0, 4);
337 xcb_out.target_msc = target_msc;
338 xcb_out.divisor = divisor;
339 xcb_out.remainder = remainder;
340
341 xcb_parts[2].iov_base = (char *) &xcb_out;
342 xcb_parts[2].iov_len = sizeof(xcb_out);
343 xcb_parts[3].iov_base = 0;
344 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
345
346 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
347 return xcb_ret;
348 }
349
350 void
xcb_present_event_next(xcb_present_event_iterator_t * i)351 xcb_present_event_next (xcb_present_event_iterator_t *i)
352 {
353 --i->rem;
354 ++i->data;
355 i->index += sizeof(xcb_present_event_t);
356 }
357
358 xcb_generic_iterator_t
xcb_present_event_end(xcb_present_event_iterator_t i)359 xcb_present_event_end (xcb_present_event_iterator_t i)
360 {
361 xcb_generic_iterator_t ret;
362 ret.data = i.data + i.rem;
363 ret.index = i.index + ((char *) ret.data - (char *) i.data);
364 ret.rem = 0;
365 return ret;
366 }
367
368 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)369 xcb_present_select_input_checked (xcb_connection_t *c,
370 xcb_present_event_t eid,
371 xcb_window_t window,
372 uint32_t event_mask)
373 {
374 static const xcb_protocol_request_t xcb_req = {
375 .count = 2,
376 .ext = &xcb_present_id,
377 .opcode = XCB_PRESENT_SELECT_INPUT,
378 .isvoid = 1
379 };
380
381 struct iovec xcb_parts[4];
382 xcb_void_cookie_t xcb_ret;
383 xcb_present_select_input_request_t xcb_out;
384
385 xcb_out.eid = eid;
386 xcb_out.window = window;
387 xcb_out.event_mask = event_mask;
388
389 xcb_parts[2].iov_base = (char *) &xcb_out;
390 xcb_parts[2].iov_len = sizeof(xcb_out);
391 xcb_parts[3].iov_base = 0;
392 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
393
394 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
395 return xcb_ret;
396 }
397
398 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)399 xcb_present_select_input (xcb_connection_t *c,
400 xcb_present_event_t eid,
401 xcb_window_t window,
402 uint32_t event_mask)
403 {
404 static const xcb_protocol_request_t xcb_req = {
405 .count = 2,
406 .ext = &xcb_present_id,
407 .opcode = XCB_PRESENT_SELECT_INPUT,
408 .isvoid = 1
409 };
410
411 struct iovec xcb_parts[4];
412 xcb_void_cookie_t xcb_ret;
413 xcb_present_select_input_request_t xcb_out;
414
415 xcb_out.eid = eid;
416 xcb_out.window = window;
417 xcb_out.event_mask = event_mask;
418
419 xcb_parts[2].iov_base = (char *) &xcb_out;
420 xcb_parts[2].iov_len = sizeof(xcb_out);
421 xcb_parts[3].iov_base = 0;
422 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
423
424 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
425 return xcb_ret;
426 }
427
428 xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities(xcb_connection_t * c,uint32_t target)429 xcb_present_query_capabilities (xcb_connection_t *c,
430 uint32_t target)
431 {
432 static const xcb_protocol_request_t xcb_req = {
433 .count = 2,
434 .ext = &xcb_present_id,
435 .opcode = XCB_PRESENT_QUERY_CAPABILITIES,
436 .isvoid = 0
437 };
438
439 struct iovec xcb_parts[4];
440 xcb_present_query_capabilities_cookie_t xcb_ret;
441 xcb_present_query_capabilities_request_t xcb_out;
442
443 xcb_out.target = target;
444
445 xcb_parts[2].iov_base = (char *) &xcb_out;
446 xcb_parts[2].iov_len = sizeof(xcb_out);
447 xcb_parts[3].iov_base = 0;
448 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
449
450 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
451 return xcb_ret;
452 }
453
454 xcb_present_query_capabilities_cookie_t
xcb_present_query_capabilities_unchecked(xcb_connection_t * c,uint32_t target)455 xcb_present_query_capabilities_unchecked (xcb_connection_t *c,
456 uint32_t target)
457 {
458 static const xcb_protocol_request_t xcb_req = {
459 .count = 2,
460 .ext = &xcb_present_id,
461 .opcode = XCB_PRESENT_QUERY_CAPABILITIES,
462 .isvoid = 0
463 };
464
465 struct iovec xcb_parts[4];
466 xcb_present_query_capabilities_cookie_t xcb_ret;
467 xcb_present_query_capabilities_request_t xcb_out;
468
469 xcb_out.target = target;
470
471 xcb_parts[2].iov_base = (char *) &xcb_out;
472 xcb_parts[2].iov_len = sizeof(xcb_out);
473 xcb_parts[3].iov_base = 0;
474 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
475
476 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
477 return xcb_ret;
478 }
479
480 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)481 xcb_present_query_capabilities_reply (xcb_connection_t *c,
482 xcb_present_query_capabilities_cookie_t cookie /**< */,
483 xcb_generic_error_t **e)
484 {
485 return (xcb_present_query_capabilities_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e);
486 }
487
488 int
xcb_present_pixmap_synced_sizeof(const void * _buffer,uint32_t notifies_len)489 xcb_present_pixmap_synced_sizeof (const void *_buffer,
490 uint32_t notifies_len)
491 {
492 char *xcb_tmp = (char *)_buffer;
493 unsigned int xcb_buffer_len = 0;
494 unsigned int xcb_block_len = 0;
495 unsigned int xcb_pad = 0;
496 unsigned int xcb_align_to = 0;
497
498
499 xcb_block_len += sizeof(xcb_present_pixmap_synced_request_t);
500 xcb_tmp += xcb_block_len;
501 xcb_buffer_len += xcb_block_len;
502 xcb_block_len = 0;
503 /* notifies */
504 xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
505 xcb_tmp += xcb_block_len;
506 xcb_align_to = ALIGNOF(xcb_present_notify_t);
507 /* insert padding */
508 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
509 xcb_buffer_len += xcb_block_len + xcb_pad;
510 if (0 != xcb_pad) {
511 xcb_tmp += xcb_pad;
512 xcb_pad = 0;
513 }
514 xcb_block_len = 0;
515
516 return xcb_buffer_len;
517 }
518
519 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 xcb_present_pixmap_synced_checked (xcb_connection_t *c,
521 xcb_window_t window,
522 xcb_pixmap_t pixmap,
523 uint32_t serial,
524 xcb_xfixes_region_t valid,
525 xcb_xfixes_region_t update,
526 int16_t x_off,
527 int16_t y_off,
528 xcb_randr_crtc_t target_crtc,
529 xcb_dri3_syncobj_t acquire_syncobj,
530 xcb_dri3_syncobj_t release_syncobj,
531 uint64_t acquire_point,
532 uint64_t release_point,
533 uint32_t options,
534 uint64_t target_msc,
535 uint64_t divisor,
536 uint64_t remainder,
537 uint32_t notifies_len,
538 const xcb_present_notify_t *notifies)
539 {
540 static const xcb_protocol_request_t xcb_req = {
541 .count = 4,
542 .ext = &xcb_present_id,
543 .opcode = XCB_PRESENT_PIXMAP_SYNCED,
544 .isvoid = 1
545 };
546
547 struct iovec xcb_parts[6];
548 xcb_void_cookie_t xcb_ret;
549 xcb_present_pixmap_synced_request_t xcb_out;
550
551 xcb_out.window = window;
552 xcb_out.pixmap = pixmap;
553 xcb_out.serial = serial;
554 xcb_out.valid = valid;
555 xcb_out.update = update;
556 xcb_out.x_off = x_off;
557 xcb_out.y_off = y_off;
558 xcb_out.target_crtc = target_crtc;
559 xcb_out.acquire_syncobj = acquire_syncobj;
560 xcb_out.release_syncobj = release_syncobj;
561 xcb_out.acquire_point = acquire_point;
562 xcb_out.release_point = release_point;
563 xcb_out.options = options;
564 memset(xcb_out.pad0, 0, 4);
565 xcb_out.target_msc = target_msc;
566 xcb_out.divisor = divisor;
567 xcb_out.remainder = remainder;
568
569 xcb_parts[2].iov_base = (char *) &xcb_out;
570 xcb_parts[2].iov_len = sizeof(xcb_out);
571 xcb_parts[3].iov_base = 0;
572 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
573 /* xcb_present_notify_t notifies */
574 xcb_parts[4].iov_base = (char *) notifies;
575 xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
576 xcb_parts[5].iov_base = 0;
577 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
578
579 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req);
580 return xcb_ret;
581 }
582
583 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 xcb_present_pixmap_synced (xcb_connection_t *c,
585 xcb_window_t window,
586 xcb_pixmap_t pixmap,
587 uint32_t serial,
588 xcb_xfixes_region_t valid,
589 xcb_xfixes_region_t update,
590 int16_t x_off,
591 int16_t y_off,
592 xcb_randr_crtc_t target_crtc,
593 xcb_dri3_syncobj_t acquire_syncobj,
594 xcb_dri3_syncobj_t release_syncobj,
595 uint64_t acquire_point,
596 uint64_t release_point,
597 uint32_t options,
598 uint64_t target_msc,
599 uint64_t divisor,
600 uint64_t remainder,
601 uint32_t notifies_len,
602 const xcb_present_notify_t *notifies)
603 {
604 static const xcb_protocol_request_t xcb_req = {
605 .count = 4,
606 .ext = &xcb_present_id,
607 .opcode = XCB_PRESENT_PIXMAP_SYNCED,
608 .isvoid = 1
609 };
610
611 struct iovec xcb_parts[6];
612 xcb_void_cookie_t xcb_ret;
613 xcb_present_pixmap_synced_request_t xcb_out;
614
615 xcb_out.window = window;
616 xcb_out.pixmap = pixmap;
617 xcb_out.serial = serial;
618 xcb_out.valid = valid;
619 xcb_out.update = update;
620 xcb_out.x_off = x_off;
621 xcb_out.y_off = y_off;
622 xcb_out.target_crtc = target_crtc;
623 xcb_out.acquire_syncobj = acquire_syncobj;
624 xcb_out.release_syncobj = release_syncobj;
625 xcb_out.acquire_point = acquire_point;
626 xcb_out.release_point = release_point;
627 xcb_out.options = options;
628 memset(xcb_out.pad0, 0, 4);
629 xcb_out.target_msc = target_msc;
630 xcb_out.divisor = divisor;
631 xcb_out.remainder = remainder;
632
633 xcb_parts[2].iov_base = (char *) &xcb_out;
634 xcb_parts[2].iov_len = sizeof(xcb_out);
635 xcb_parts[3].iov_base = 0;
636 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3;
637 /* xcb_present_notify_t notifies */
638 xcb_parts[4].iov_base = (char *) notifies;
639 xcb_parts[4].iov_len = notifies_len * sizeof(xcb_present_notify_t);
640 xcb_parts[5].iov_base = 0;
641 xcb_parts[5].iov_len = -xcb_parts[4].iov_len & 3;
642
643 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req);
644 return xcb_ret;
645 }
646
647 xcb_present_notify_t *
xcb_present_pixmap_synced_notifies(const xcb_present_pixmap_synced_request_t * R)648 xcb_present_pixmap_synced_notifies (const xcb_present_pixmap_synced_request_t *R)
649 {
650 return (xcb_present_notify_t *) (R + 1);
651 }
652
653 int
xcb_present_pixmap_synced_notifies_length(const xcb_present_pixmap_synced_request_t * R)654 xcb_present_pixmap_synced_notifies_length (const xcb_present_pixmap_synced_request_t *R)
655 {
656 return (((R->length * 4) - sizeof(xcb_present_pixmap_synced_request_t))/sizeof(xcb_present_notify_t));
657 }
658
659 xcb_present_notify_iterator_t
xcb_present_pixmap_synced_notifies_iterator(const xcb_present_pixmap_synced_request_t * R)660 xcb_present_pixmap_synced_notifies_iterator (const xcb_present_pixmap_synced_request_t *R)
661 {
662 xcb_present_notify_iterator_t i;
663 i.data = (xcb_present_notify_t *) (R + 1);
664 i.rem = (((R->length * 4) - sizeof(xcb_present_pixmap_synced_request_t))/sizeof(xcb_present_notify_t));
665 i.index = (char *) i.data - (char *) R;
666 return i;
667 }
668
669 int
xcb_present_redirect_notify_sizeof(const void * _buffer,uint32_t notifies_len)670 xcb_present_redirect_notify_sizeof (const void *_buffer,
671 uint32_t notifies_len)
672 {
673 char *xcb_tmp = (char *)_buffer;
674 unsigned int xcb_buffer_len = 0;
675 unsigned int xcb_block_len = 0;
676 unsigned int xcb_pad = 0;
677 unsigned int xcb_align_to = 0;
678
679
680 xcb_block_len += sizeof(xcb_present_redirect_notify_event_t);
681 xcb_tmp += xcb_block_len;
682 xcb_buffer_len += xcb_block_len;
683 xcb_block_len = 0;
684 /* notifies */
685 xcb_block_len += notifies_len * sizeof(xcb_present_notify_t);
686 xcb_tmp += xcb_block_len;
687 xcb_align_to = ALIGNOF(xcb_present_notify_t);
688 /* insert padding */
689 xcb_pad = -xcb_block_len & (xcb_align_to - 1);
690 xcb_buffer_len += xcb_block_len + xcb_pad;
691 if (0 != xcb_pad) {
692 xcb_tmp += xcb_pad;
693 xcb_pad = 0;
694 }
695 xcb_block_len = 0;
696
697 return xcb_buffer_len;
698 }
699
700 xcb_present_notify_t *
xcb_present_redirect_notify_notifies(const xcb_present_redirect_notify_event_t * R)701 xcb_present_redirect_notify_notifies (const xcb_present_redirect_notify_event_t *R)
702 {
703 return (xcb_present_notify_t *) (R + 1);
704 }
705
706 int
xcb_present_redirect_notify_notifies_length(const xcb_present_redirect_notify_event_t * R)707 xcb_present_redirect_notify_notifies_length (const xcb_present_redirect_notify_event_t *R)
708 {
709 return (((R->length * 4) - sizeof(xcb_present_redirect_notify_event_t))/sizeof(xcb_present_notify_t));
710 }
711
712 xcb_present_notify_iterator_t
xcb_present_redirect_notify_notifies_iterator(const xcb_present_redirect_notify_event_t * R)713 xcb_present_redirect_notify_notifies_iterator (const xcb_present_redirect_notify_event_t *R)
714 {
715 xcb_present_notify_iterator_t i;
716 i.data = (xcb_present_notify_t *) (R + 1);
717 i.rem = (((R->length * 4) - sizeof(xcb_present_redirect_notify_event_t))/sizeof(xcb_present_notify_t));
718 i.index = (char *) i.data - (char *) R;
719 return i;
720 }
721
722