1 /* 2 * This file generated automatically from dri3.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 "dri3.h" 15 16 #define ALIGNOF(type) offsetof(struct { char dummy; type member; }, member) 17 #include "xproto.h" 18 19 xcb_extension_t xcb_dri3_id = { "DRI3", 0 }; 20 21 void 22 xcb_dri3_syncobj_next (xcb_dri3_syncobj_iterator_t *i) 23 { 24 --i->rem; 25 ++i->data; 26 i->index += sizeof(xcb_dri3_syncobj_t); 27 } 28 29 xcb_generic_iterator_t 30 xcb_dri3_syncobj_end (xcb_dri3_syncobj_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 xcb_dri3_query_version_cookie_t 40 xcb_dri3_query_version (xcb_connection_t *c, 41 uint32_t major_version, 42 uint32_t minor_version) 43 { 44 static const xcb_protocol_request_t xcb_req = { 45 .count = 2, 46 .ext = &xcb_dri3_id, 47 .opcode = XCB_DRI3_QUERY_VERSION, 48 .isvoid = 0 49 }; 50 51 struct iovec xcb_parts[4]; 52 xcb_dri3_query_version_cookie_t xcb_ret; 53 xcb_dri3_query_version_request_t xcb_out; 54 55 xcb_out.major_version = major_version; 56 xcb_out.minor_version = minor_version; 57 58 xcb_parts[2].iov_base = (char *) &xcb_out; 59 xcb_parts[2].iov_len = sizeof(xcb_out); 60 xcb_parts[3].iov_base = 0; 61 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 62 63 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 64 return xcb_ret; 65 } 66 67 xcb_dri3_query_version_cookie_t 68 xcb_dri3_query_version_unchecked (xcb_connection_t *c, 69 uint32_t major_version, 70 uint32_t minor_version) 71 { 72 static const xcb_protocol_request_t xcb_req = { 73 .count = 2, 74 .ext = &xcb_dri3_id, 75 .opcode = XCB_DRI3_QUERY_VERSION, 76 .isvoid = 0 77 }; 78 79 struct iovec xcb_parts[4]; 80 xcb_dri3_query_version_cookie_t xcb_ret; 81 xcb_dri3_query_version_request_t xcb_out; 82 83 xcb_out.major_version = major_version; 84 xcb_out.minor_version = minor_version; 85 86 xcb_parts[2].iov_base = (char *) &xcb_out; 87 xcb_parts[2].iov_len = sizeof(xcb_out); 88 xcb_parts[3].iov_base = 0; 89 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 90 91 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 92 return xcb_ret; 93 } 94 95 xcb_dri3_query_version_reply_t * 96 xcb_dri3_query_version_reply (xcb_connection_t *c, 97 xcb_dri3_query_version_cookie_t cookie /**< */, 98 xcb_generic_error_t **e) 99 { 100 return (xcb_dri3_query_version_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 101 } 102 103 xcb_dri3_open_cookie_t 104 xcb_dri3_open (xcb_connection_t *c, 105 xcb_drawable_t drawable, 106 uint32_t provider) 107 { 108 static const xcb_protocol_request_t xcb_req = { 109 .count = 2, 110 .ext = &xcb_dri3_id, 111 .opcode = XCB_DRI3_OPEN, 112 .isvoid = 0 113 }; 114 115 struct iovec xcb_parts[4]; 116 xcb_dri3_open_cookie_t xcb_ret; 117 xcb_dri3_open_request_t xcb_out; 118 119 xcb_out.drawable = drawable; 120 xcb_out.provider = provider; 121 122 xcb_parts[2].iov_base = (char *) &xcb_out; 123 xcb_parts[2].iov_len = sizeof(xcb_out); 124 xcb_parts[3].iov_base = 0; 125 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 126 127 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 128 return xcb_ret; 129 } 130 131 xcb_dri3_open_cookie_t 132 xcb_dri3_open_unchecked (xcb_connection_t *c, 133 xcb_drawable_t drawable, 134 uint32_t provider) 135 { 136 static const xcb_protocol_request_t xcb_req = { 137 .count = 2, 138 .ext = &xcb_dri3_id, 139 .opcode = XCB_DRI3_OPEN, 140 .isvoid = 0 141 }; 142 143 struct iovec xcb_parts[4]; 144 xcb_dri3_open_cookie_t xcb_ret; 145 xcb_dri3_open_request_t xcb_out; 146 147 xcb_out.drawable = drawable; 148 xcb_out.provider = provider; 149 150 xcb_parts[2].iov_base = (char *) &xcb_out; 151 xcb_parts[2].iov_len = sizeof(xcb_out); 152 xcb_parts[3].iov_base = 0; 153 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 154 155 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 156 return xcb_ret; 157 } 158 159 xcb_dri3_open_reply_t * 160 xcb_dri3_open_reply (xcb_connection_t *c, 161 xcb_dri3_open_cookie_t cookie /**< */, 162 xcb_generic_error_t **e) 163 { 164 return (xcb_dri3_open_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 165 } 166 167 int * 168 xcb_dri3_open_reply_fds (xcb_connection_t *c /**< */, 169 xcb_dri3_open_reply_t *reply) 170 { 171 return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_open_reply_t) + 4 * reply->length); 172 } 173 174 xcb_void_cookie_t 175 xcb_dri3_pixmap_from_buffer_checked (xcb_connection_t *c, 176 xcb_pixmap_t pixmap, 177 xcb_drawable_t drawable, 178 uint32_t size, 179 uint16_t width, 180 uint16_t height, 181 uint16_t stride, 182 uint8_t depth, 183 uint8_t bpp, 184 int32_t pixmap_fd) 185 { 186 static const xcb_protocol_request_t xcb_req = { 187 .count = 2, 188 .ext = &xcb_dri3_id, 189 .opcode = XCB_DRI3_PIXMAP_FROM_BUFFER, 190 .isvoid = 1 191 }; 192 193 struct iovec xcb_parts[4]; 194 xcb_void_cookie_t xcb_ret; 195 xcb_dri3_pixmap_from_buffer_request_t xcb_out; 196 int fds[1]; 197 int fd_index = 0; 198 199 xcb_out.pixmap = pixmap; 200 xcb_out.drawable = drawable; 201 xcb_out.size = size; 202 xcb_out.width = width; 203 xcb_out.height = height; 204 xcb_out.stride = stride; 205 xcb_out.depth = depth; 206 xcb_out.bpp = bpp; 207 208 xcb_parts[2].iov_base = (char *) &xcb_out; 209 xcb_parts[2].iov_len = sizeof(xcb_out); 210 xcb_parts[3].iov_base = 0; 211 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 212 213 fds[fd_index++] = pixmap_fd; 214 xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, 1, fds); 215 return xcb_ret; 216 } 217 218 xcb_void_cookie_t 219 xcb_dri3_pixmap_from_buffer (xcb_connection_t *c, 220 xcb_pixmap_t pixmap, 221 xcb_drawable_t drawable, 222 uint32_t size, 223 uint16_t width, 224 uint16_t height, 225 uint16_t stride, 226 uint8_t depth, 227 uint8_t bpp, 228 int32_t pixmap_fd) 229 { 230 static const xcb_protocol_request_t xcb_req = { 231 .count = 2, 232 .ext = &xcb_dri3_id, 233 .opcode = XCB_DRI3_PIXMAP_FROM_BUFFER, 234 .isvoid = 1 235 }; 236 237 struct iovec xcb_parts[4]; 238 xcb_void_cookie_t xcb_ret; 239 xcb_dri3_pixmap_from_buffer_request_t xcb_out; 240 int fds[1]; 241 int fd_index = 0; 242 243 xcb_out.pixmap = pixmap; 244 xcb_out.drawable = drawable; 245 xcb_out.size = size; 246 xcb_out.width = width; 247 xcb_out.height = height; 248 xcb_out.stride = stride; 249 xcb_out.depth = depth; 250 xcb_out.bpp = bpp; 251 252 xcb_parts[2].iov_base = (char *) &xcb_out; 253 xcb_parts[2].iov_len = sizeof(xcb_out); 254 xcb_parts[3].iov_base = 0; 255 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 256 257 fds[fd_index++] = pixmap_fd; 258 xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, 1, fds); 259 return xcb_ret; 260 } 261 262 xcb_dri3_buffer_from_pixmap_cookie_t 263 xcb_dri3_buffer_from_pixmap (xcb_connection_t *c, 264 xcb_pixmap_t pixmap) 265 { 266 static const xcb_protocol_request_t xcb_req = { 267 .count = 2, 268 .ext = &xcb_dri3_id, 269 .opcode = XCB_DRI3_BUFFER_FROM_PIXMAP, 270 .isvoid = 0 271 }; 272 273 struct iovec xcb_parts[4]; 274 xcb_dri3_buffer_from_pixmap_cookie_t xcb_ret; 275 xcb_dri3_buffer_from_pixmap_request_t xcb_out; 276 277 xcb_out.pixmap = pixmap; 278 279 xcb_parts[2].iov_base = (char *) &xcb_out; 280 xcb_parts[2].iov_len = sizeof(xcb_out); 281 xcb_parts[3].iov_base = 0; 282 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 283 284 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 285 return xcb_ret; 286 } 287 288 xcb_dri3_buffer_from_pixmap_cookie_t 289 xcb_dri3_buffer_from_pixmap_unchecked (xcb_connection_t *c, 290 xcb_pixmap_t pixmap) 291 { 292 static const xcb_protocol_request_t xcb_req = { 293 .count = 2, 294 .ext = &xcb_dri3_id, 295 .opcode = XCB_DRI3_BUFFER_FROM_PIXMAP, 296 .isvoid = 0 297 }; 298 299 struct iovec xcb_parts[4]; 300 xcb_dri3_buffer_from_pixmap_cookie_t xcb_ret; 301 xcb_dri3_buffer_from_pixmap_request_t xcb_out; 302 303 xcb_out.pixmap = pixmap; 304 305 xcb_parts[2].iov_base = (char *) &xcb_out; 306 xcb_parts[2].iov_len = sizeof(xcb_out); 307 xcb_parts[3].iov_base = 0; 308 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 309 310 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 311 return xcb_ret; 312 } 313 314 xcb_dri3_buffer_from_pixmap_reply_t * 315 xcb_dri3_buffer_from_pixmap_reply (xcb_connection_t *c, 316 xcb_dri3_buffer_from_pixmap_cookie_t cookie /**< */, 317 xcb_generic_error_t **e) 318 { 319 return (xcb_dri3_buffer_from_pixmap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 320 } 321 322 int * 323 xcb_dri3_buffer_from_pixmap_reply_fds (xcb_connection_t *c /**< */, 324 xcb_dri3_buffer_from_pixmap_reply_t *reply) 325 { 326 return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_buffer_from_pixmap_reply_t) + 4 * reply->length); 327 } 328 329 xcb_void_cookie_t 330 xcb_dri3_fence_from_fd_checked (xcb_connection_t *c, 331 xcb_drawable_t drawable, 332 uint32_t fence, 333 uint8_t initially_triggered, 334 int32_t fence_fd) 335 { 336 static const xcb_protocol_request_t xcb_req = { 337 .count = 2, 338 .ext = &xcb_dri3_id, 339 .opcode = XCB_DRI3_FENCE_FROM_FD, 340 .isvoid = 1 341 }; 342 343 struct iovec xcb_parts[4]; 344 xcb_void_cookie_t xcb_ret; 345 xcb_dri3_fence_from_fd_request_t xcb_out; 346 int fds[1]; 347 int fd_index = 0; 348 349 xcb_out.drawable = drawable; 350 xcb_out.fence = fence; 351 xcb_out.initially_triggered = initially_triggered; 352 memset(xcb_out.pad0, 0, 3); 353 354 xcb_parts[2].iov_base = (char *) &xcb_out; 355 xcb_parts[2].iov_len = sizeof(xcb_out); 356 xcb_parts[3].iov_base = 0; 357 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 358 359 fds[fd_index++] = fence_fd; 360 xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, 1, fds); 361 return xcb_ret; 362 } 363 364 xcb_void_cookie_t 365 xcb_dri3_fence_from_fd (xcb_connection_t *c, 366 xcb_drawable_t drawable, 367 uint32_t fence, 368 uint8_t initially_triggered, 369 int32_t fence_fd) 370 { 371 static const xcb_protocol_request_t xcb_req = { 372 .count = 2, 373 .ext = &xcb_dri3_id, 374 .opcode = XCB_DRI3_FENCE_FROM_FD, 375 .isvoid = 1 376 }; 377 378 struct iovec xcb_parts[4]; 379 xcb_void_cookie_t xcb_ret; 380 xcb_dri3_fence_from_fd_request_t xcb_out; 381 int fds[1]; 382 int fd_index = 0; 383 384 xcb_out.drawable = drawable; 385 xcb_out.fence = fence; 386 xcb_out.initially_triggered = initially_triggered; 387 memset(xcb_out.pad0, 0, 3); 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 fds[fd_index++] = fence_fd; 395 xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, 1, fds); 396 return xcb_ret; 397 } 398 399 xcb_dri3_fd_from_fence_cookie_t 400 xcb_dri3_fd_from_fence (xcb_connection_t *c, 401 xcb_drawable_t drawable, 402 uint32_t fence) 403 { 404 static const xcb_protocol_request_t xcb_req = { 405 .count = 2, 406 .ext = &xcb_dri3_id, 407 .opcode = XCB_DRI3_FD_FROM_FENCE, 408 .isvoid = 0 409 }; 410 411 struct iovec xcb_parts[4]; 412 xcb_dri3_fd_from_fence_cookie_t xcb_ret; 413 xcb_dri3_fd_from_fence_request_t xcb_out; 414 415 xcb_out.drawable = drawable; 416 xcb_out.fence = fence; 417 418 xcb_parts[2].iov_base = (char *) &xcb_out; 419 xcb_parts[2].iov_len = sizeof(xcb_out); 420 xcb_parts[3].iov_base = 0; 421 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 422 423 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 424 return xcb_ret; 425 } 426 427 xcb_dri3_fd_from_fence_cookie_t 428 xcb_dri3_fd_from_fence_unchecked (xcb_connection_t *c, 429 xcb_drawable_t drawable, 430 uint32_t fence) 431 { 432 static const xcb_protocol_request_t xcb_req = { 433 .count = 2, 434 .ext = &xcb_dri3_id, 435 .opcode = XCB_DRI3_FD_FROM_FENCE, 436 .isvoid = 0 437 }; 438 439 struct iovec xcb_parts[4]; 440 xcb_dri3_fd_from_fence_cookie_t xcb_ret; 441 xcb_dri3_fd_from_fence_request_t xcb_out; 442 443 xcb_out.drawable = drawable; 444 xcb_out.fence = fence; 445 446 xcb_parts[2].iov_base = (char *) &xcb_out; 447 xcb_parts[2].iov_len = sizeof(xcb_out); 448 xcb_parts[3].iov_base = 0; 449 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 450 451 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 452 return xcb_ret; 453 } 454 455 xcb_dri3_fd_from_fence_reply_t * 456 xcb_dri3_fd_from_fence_reply (xcb_connection_t *c, 457 xcb_dri3_fd_from_fence_cookie_t cookie /**< */, 458 xcb_generic_error_t **e) 459 { 460 return (xcb_dri3_fd_from_fence_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 461 } 462 463 int * 464 xcb_dri3_fd_from_fence_reply_fds (xcb_connection_t *c /**< */, 465 xcb_dri3_fd_from_fence_reply_t *reply) 466 { 467 return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_fd_from_fence_reply_t) + 4 * reply->length); 468 } 469 470 int 471 xcb_dri3_get_supported_modifiers_sizeof (const void *_buffer) 472 { 473 char *xcb_tmp = (char *)_buffer; 474 const xcb_dri3_get_supported_modifiers_reply_t *_aux = (xcb_dri3_get_supported_modifiers_reply_t *)_buffer; 475 unsigned int xcb_buffer_len = 0; 476 unsigned int xcb_block_len = 0; 477 unsigned int xcb_pad = 0; 478 unsigned int xcb_align_to = 0; 479 480 481 xcb_block_len += sizeof(xcb_dri3_get_supported_modifiers_reply_t); 482 xcb_tmp += xcb_block_len; 483 xcb_buffer_len += xcb_block_len; 484 xcb_block_len = 0; 485 /* window_modifiers */ 486 xcb_block_len += _aux->num_window_modifiers * sizeof(uint64_t); 487 xcb_tmp += xcb_block_len; 488 xcb_align_to = ALIGNOF(uint64_t); 489 /* insert padding */ 490 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 491 xcb_buffer_len += xcb_block_len + xcb_pad; 492 if (0 != xcb_pad) { 493 xcb_tmp += xcb_pad; 494 xcb_pad = 0; 495 } 496 xcb_block_len = 0; 497 /* screen_modifiers */ 498 xcb_block_len += _aux->num_screen_modifiers * sizeof(uint64_t); 499 xcb_tmp += xcb_block_len; 500 xcb_align_to = ALIGNOF(uint64_t); 501 /* insert padding */ 502 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 503 xcb_buffer_len += xcb_block_len + xcb_pad; 504 if (0 != xcb_pad) { 505 xcb_tmp += xcb_pad; 506 xcb_pad = 0; 507 } 508 xcb_block_len = 0; 509 510 return xcb_buffer_len; 511 } 512 513 xcb_dri3_get_supported_modifiers_cookie_t 514 xcb_dri3_get_supported_modifiers (xcb_connection_t *c, 515 uint32_t window, 516 uint8_t depth, 517 uint8_t bpp) 518 { 519 static const xcb_protocol_request_t xcb_req = { 520 .count = 2, 521 .ext = &xcb_dri3_id, 522 .opcode = XCB_DRI3_GET_SUPPORTED_MODIFIERS, 523 .isvoid = 0 524 }; 525 526 struct iovec xcb_parts[4]; 527 xcb_dri3_get_supported_modifiers_cookie_t xcb_ret; 528 xcb_dri3_get_supported_modifiers_request_t xcb_out; 529 530 xcb_out.window = window; 531 xcb_out.depth = depth; 532 xcb_out.bpp = bpp; 533 memset(xcb_out.pad0, 0, 2); 534 535 xcb_parts[2].iov_base = (char *) &xcb_out; 536 xcb_parts[2].iov_len = sizeof(xcb_out); 537 xcb_parts[3].iov_base = 0; 538 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 539 540 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 541 return xcb_ret; 542 } 543 544 xcb_dri3_get_supported_modifiers_cookie_t 545 xcb_dri3_get_supported_modifiers_unchecked (xcb_connection_t *c, 546 uint32_t window, 547 uint8_t depth, 548 uint8_t bpp) 549 { 550 static const xcb_protocol_request_t xcb_req = { 551 .count = 2, 552 .ext = &xcb_dri3_id, 553 .opcode = XCB_DRI3_GET_SUPPORTED_MODIFIERS, 554 .isvoid = 0 555 }; 556 557 struct iovec xcb_parts[4]; 558 xcb_dri3_get_supported_modifiers_cookie_t xcb_ret; 559 xcb_dri3_get_supported_modifiers_request_t xcb_out; 560 561 xcb_out.window = window; 562 xcb_out.depth = depth; 563 xcb_out.bpp = bpp; 564 memset(xcb_out.pad0, 0, 2); 565 566 xcb_parts[2].iov_base = (char *) &xcb_out; 567 xcb_parts[2].iov_len = sizeof(xcb_out); 568 xcb_parts[3].iov_base = 0; 569 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 570 571 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 572 return xcb_ret; 573 } 574 575 uint64_t * 576 xcb_dri3_get_supported_modifiers_window_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R) 577 { 578 return (uint64_t *) (R + 1); 579 } 580 581 int 582 xcb_dri3_get_supported_modifiers_window_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R) 583 { 584 return R->num_window_modifiers; 585 } 586 587 xcb_generic_iterator_t 588 xcb_dri3_get_supported_modifiers_window_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R) 589 { 590 xcb_generic_iterator_t i; 591 i.data = ((uint64_t *) (R + 1)) + (R->num_window_modifiers); 592 i.rem = 0; 593 i.index = (char *) i.data - (char *) R; 594 return i; 595 } 596 597 uint64_t * 598 xcb_dri3_get_supported_modifiers_screen_modifiers (const xcb_dri3_get_supported_modifiers_reply_t *R) 599 { 600 xcb_generic_iterator_t prev = xcb_dri3_get_supported_modifiers_window_modifiers_end(R); 601 return (uint64_t *) ((char *) prev.data + XCB_TYPE_PAD(uint64_t, prev.index) + 0); 602 } 603 604 int 605 xcb_dri3_get_supported_modifiers_screen_modifiers_length (const xcb_dri3_get_supported_modifiers_reply_t *R) 606 { 607 return R->num_screen_modifiers; 608 } 609 610 xcb_generic_iterator_t 611 xcb_dri3_get_supported_modifiers_screen_modifiers_end (const xcb_dri3_get_supported_modifiers_reply_t *R) 612 { 613 xcb_generic_iterator_t i; 614 xcb_generic_iterator_t prev = xcb_dri3_get_supported_modifiers_window_modifiers_end(R); 615 i.data = ((uint64_t *) ((char*) prev.data + XCB_TYPE_PAD(uint64_t, prev.index))) + (R->num_screen_modifiers); 616 i.rem = 0; 617 i.index = (char *) i.data - (char *) R; 618 return i; 619 } 620 621 xcb_dri3_get_supported_modifiers_reply_t * 622 xcb_dri3_get_supported_modifiers_reply (xcb_connection_t *c, 623 xcb_dri3_get_supported_modifiers_cookie_t cookie /**< */, 624 xcb_generic_error_t **e) 625 { 626 return (xcb_dri3_get_supported_modifiers_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 627 } 628 629 xcb_void_cookie_t 630 xcb_dri3_pixmap_from_buffers_checked (xcb_connection_t *c, 631 xcb_pixmap_t pixmap, 632 xcb_window_t window, 633 uint8_t num_buffers, 634 uint16_t width, 635 uint16_t height, 636 uint32_t stride0, 637 uint32_t offset0, 638 uint32_t stride1, 639 uint32_t offset1, 640 uint32_t stride2, 641 uint32_t offset2, 642 uint32_t stride3, 643 uint32_t offset3, 644 uint8_t depth, 645 uint8_t bpp, 646 uint64_t modifier, 647 const int32_t *buffers) 648 { 649 static const xcb_protocol_request_t xcb_req = { 650 .count = 2, 651 .ext = &xcb_dri3_id, 652 .opcode = XCB_DRI3_PIXMAP_FROM_BUFFERS, 653 .isvoid = 1 654 }; 655 656 struct iovec xcb_parts[4]; 657 xcb_void_cookie_t xcb_ret; 658 xcb_dri3_pixmap_from_buffers_request_t xcb_out; 659 unsigned int i; 660 int fds[num_buffers]; 661 int fd_index = 0; 662 663 xcb_out.pixmap = pixmap; 664 xcb_out.window = window; 665 xcb_out.num_buffers = num_buffers; 666 memset(xcb_out.pad0, 0, 3); 667 xcb_out.width = width; 668 xcb_out.height = height; 669 xcb_out.stride0 = stride0; 670 xcb_out.offset0 = offset0; 671 xcb_out.stride1 = stride1; 672 xcb_out.offset1 = offset1; 673 xcb_out.stride2 = stride2; 674 xcb_out.offset2 = offset2; 675 xcb_out.stride3 = stride3; 676 xcb_out.offset3 = offset3; 677 xcb_out.depth = depth; 678 xcb_out.bpp = bpp; 679 memset(xcb_out.pad1, 0, 2); 680 xcb_out.modifier = modifier; 681 682 xcb_parts[2].iov_base = (char *) &xcb_out; 683 xcb_parts[2].iov_len = sizeof(xcb_out); 684 xcb_parts[3].iov_base = 0; 685 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 686 687 for (i = 0; i < num_buffers; i++) 688 fds[fd_index++] = buffers[i]; 689 xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, num_buffers, fds); 690 return xcb_ret; 691 } 692 693 xcb_void_cookie_t 694 xcb_dri3_pixmap_from_buffers (xcb_connection_t *c, 695 xcb_pixmap_t pixmap, 696 xcb_window_t window, 697 uint8_t num_buffers, 698 uint16_t width, 699 uint16_t height, 700 uint32_t stride0, 701 uint32_t offset0, 702 uint32_t stride1, 703 uint32_t offset1, 704 uint32_t stride2, 705 uint32_t offset2, 706 uint32_t stride3, 707 uint32_t offset3, 708 uint8_t depth, 709 uint8_t bpp, 710 uint64_t modifier, 711 const int32_t *buffers) 712 { 713 static const xcb_protocol_request_t xcb_req = { 714 .count = 2, 715 .ext = &xcb_dri3_id, 716 .opcode = XCB_DRI3_PIXMAP_FROM_BUFFERS, 717 .isvoid = 1 718 }; 719 720 struct iovec xcb_parts[4]; 721 xcb_void_cookie_t xcb_ret; 722 xcb_dri3_pixmap_from_buffers_request_t xcb_out; 723 unsigned int i; 724 int fds[num_buffers]; 725 int fd_index = 0; 726 727 xcb_out.pixmap = pixmap; 728 xcb_out.window = window; 729 xcb_out.num_buffers = num_buffers; 730 memset(xcb_out.pad0, 0, 3); 731 xcb_out.width = width; 732 xcb_out.height = height; 733 xcb_out.stride0 = stride0; 734 xcb_out.offset0 = offset0; 735 xcb_out.stride1 = stride1; 736 xcb_out.offset1 = offset1; 737 xcb_out.stride2 = stride2; 738 xcb_out.offset2 = offset2; 739 xcb_out.stride3 = stride3; 740 xcb_out.offset3 = offset3; 741 xcb_out.depth = depth; 742 xcb_out.bpp = bpp; 743 memset(xcb_out.pad1, 0, 2); 744 xcb_out.modifier = modifier; 745 746 xcb_parts[2].iov_base = (char *) &xcb_out; 747 xcb_parts[2].iov_len = sizeof(xcb_out); 748 xcb_parts[3].iov_base = 0; 749 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 750 751 for (i = 0; i < num_buffers; i++) 752 fds[fd_index++] = buffers[i]; 753 xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, num_buffers, fds); 754 return xcb_ret; 755 } 756 757 int 758 xcb_dri3_buffers_from_pixmap_sizeof (const void *_buffer, 759 int32_t buffers) 760 { 761 char *xcb_tmp = (char *)_buffer; 762 const xcb_dri3_buffers_from_pixmap_reply_t *_aux = (xcb_dri3_buffers_from_pixmap_reply_t *)_buffer; 763 unsigned int xcb_buffer_len = 0; 764 unsigned int xcb_block_len = 0; 765 unsigned int xcb_pad = 0; 766 unsigned int xcb_align_to = 0; 767 768 769 xcb_block_len += sizeof(xcb_dri3_buffers_from_pixmap_reply_t); 770 xcb_tmp += xcb_block_len; 771 xcb_buffer_len += xcb_block_len; 772 xcb_block_len = 0; 773 /* strides */ 774 xcb_block_len += _aux->nfd * sizeof(uint32_t); 775 xcb_tmp += xcb_block_len; 776 xcb_align_to = ALIGNOF(uint32_t); 777 /* insert padding */ 778 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 779 xcb_buffer_len += xcb_block_len + xcb_pad; 780 if (0 != xcb_pad) { 781 xcb_tmp += xcb_pad; 782 xcb_pad = 0; 783 } 784 xcb_block_len = 0; 785 /* offsets */ 786 xcb_block_len += _aux->nfd * sizeof(uint32_t); 787 xcb_tmp += xcb_block_len; 788 xcb_align_to = ALIGNOF(uint32_t); 789 /* insert padding */ 790 xcb_pad = -xcb_block_len & (xcb_align_to - 1); 791 xcb_buffer_len += xcb_block_len + xcb_pad; 792 if (0 != xcb_pad) { 793 xcb_tmp += xcb_pad; 794 xcb_pad = 0; 795 } 796 xcb_block_len = 0; 797 798 return xcb_buffer_len; 799 } 800 801 xcb_dri3_buffers_from_pixmap_cookie_t 802 xcb_dri3_buffers_from_pixmap (xcb_connection_t *c, 803 xcb_pixmap_t pixmap) 804 { 805 static const xcb_protocol_request_t xcb_req = { 806 .count = 2, 807 .ext = &xcb_dri3_id, 808 .opcode = XCB_DRI3_BUFFERS_FROM_PIXMAP, 809 .isvoid = 0 810 }; 811 812 struct iovec xcb_parts[4]; 813 xcb_dri3_buffers_from_pixmap_cookie_t xcb_ret; 814 xcb_dri3_buffers_from_pixmap_request_t xcb_out; 815 816 xcb_out.pixmap = pixmap; 817 818 xcb_parts[2].iov_base = (char *) &xcb_out; 819 xcb_parts[2].iov_len = sizeof(xcb_out); 820 xcb_parts[3].iov_base = 0; 821 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 822 823 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED|XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 824 return xcb_ret; 825 } 826 827 xcb_dri3_buffers_from_pixmap_cookie_t 828 xcb_dri3_buffers_from_pixmap_unchecked (xcb_connection_t *c, 829 xcb_pixmap_t pixmap) 830 { 831 static const xcb_protocol_request_t xcb_req = { 832 .count = 2, 833 .ext = &xcb_dri3_id, 834 .opcode = XCB_DRI3_BUFFERS_FROM_PIXMAP, 835 .isvoid = 0 836 }; 837 838 struct iovec xcb_parts[4]; 839 xcb_dri3_buffers_from_pixmap_cookie_t xcb_ret; 840 xcb_dri3_buffers_from_pixmap_request_t xcb_out; 841 842 xcb_out.pixmap = pixmap; 843 844 xcb_parts[2].iov_base = (char *) &xcb_out; 845 xcb_parts[2].iov_len = sizeof(xcb_out); 846 xcb_parts[3].iov_base = 0; 847 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 848 849 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_REPLY_FDS, xcb_parts + 2, &xcb_req); 850 return xcb_ret; 851 } 852 853 uint32_t * 854 xcb_dri3_buffers_from_pixmap_strides (const xcb_dri3_buffers_from_pixmap_reply_t *R) 855 { 856 return (uint32_t *) (R + 1); 857 } 858 859 int 860 xcb_dri3_buffers_from_pixmap_strides_length (const xcb_dri3_buffers_from_pixmap_reply_t *R) 861 { 862 return R->nfd; 863 } 864 865 xcb_generic_iterator_t 866 xcb_dri3_buffers_from_pixmap_strides_end (const xcb_dri3_buffers_from_pixmap_reply_t *R) 867 { 868 xcb_generic_iterator_t i; 869 i.data = ((uint32_t *) (R + 1)) + (R->nfd); 870 i.rem = 0; 871 i.index = (char *) i.data - (char *) R; 872 return i; 873 } 874 875 uint32_t * 876 xcb_dri3_buffers_from_pixmap_offsets (const xcb_dri3_buffers_from_pixmap_reply_t *R) 877 { 878 xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_strides_end(R); 879 return (uint32_t *) ((char *) prev.data + XCB_TYPE_PAD(uint32_t, prev.index) + 0); 880 } 881 882 int 883 xcb_dri3_buffers_from_pixmap_offsets_length (const xcb_dri3_buffers_from_pixmap_reply_t *R) 884 { 885 return R->nfd; 886 } 887 888 xcb_generic_iterator_t 889 xcb_dri3_buffers_from_pixmap_offsets_end (const xcb_dri3_buffers_from_pixmap_reply_t *R) 890 { 891 xcb_generic_iterator_t i; 892 xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_strides_end(R); 893 i.data = ((uint32_t *) ((char*) prev.data + XCB_TYPE_PAD(uint32_t, prev.index))) + (R->nfd); 894 i.rem = 0; 895 i.index = (char *) i.data - (char *) R; 896 return i; 897 } 898 899 int32_t * 900 xcb_dri3_buffers_from_pixmap_buffers (const xcb_dri3_buffers_from_pixmap_reply_t *R) 901 { 902 xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_offsets_end(R); 903 return (int32_t *) ((char *) prev.data + XCB_TYPE_PAD(int32_t, prev.index) + 0); 904 } 905 906 int 907 xcb_dri3_buffers_from_pixmap_buffers_length (const xcb_dri3_buffers_from_pixmap_reply_t *R) 908 { 909 return R->nfd; 910 } 911 912 xcb_generic_iterator_t 913 xcb_dri3_buffers_from_pixmap_buffers_end (const xcb_dri3_buffers_from_pixmap_reply_t *R) 914 { 915 xcb_generic_iterator_t i; 916 xcb_generic_iterator_t prev = xcb_dri3_buffers_from_pixmap_offsets_end(R); 917 i.data = ((int32_t *) ((char*) prev.data + XCB_TYPE_PAD(int32_t, prev.index))) + (R->nfd); 918 i.rem = 0; 919 i.index = (char *) i.data - (char *) R; 920 return i; 921 } 922 923 xcb_dri3_buffers_from_pixmap_reply_t * 924 xcb_dri3_buffers_from_pixmap_reply (xcb_connection_t *c, 925 xcb_dri3_buffers_from_pixmap_cookie_t cookie /**< */, 926 xcb_generic_error_t **e) 927 { 928 return (xcb_dri3_buffers_from_pixmap_reply_t *) xcb_wait_for_reply(c, cookie.sequence, e); 929 } 930 931 int * 932 xcb_dri3_buffers_from_pixmap_reply_fds (xcb_connection_t *c /**< */, 933 xcb_dri3_buffers_from_pixmap_reply_t *reply) 934 { 935 return xcb_get_reply_fds(c, reply, sizeof(xcb_dri3_buffers_from_pixmap_reply_t) + 4 * reply->length); 936 } 937 938 xcb_void_cookie_t 939 xcb_dri3_set_drm_device_in_use_checked (xcb_connection_t *c, 940 xcb_window_t window, 941 uint32_t drmMajor, 942 uint32_t drmMinor) 943 { 944 static const xcb_protocol_request_t xcb_req = { 945 .count = 2, 946 .ext = &xcb_dri3_id, 947 .opcode = XCB_DRI3_SET_DRM_DEVICE_IN_USE, 948 .isvoid = 1 949 }; 950 951 struct iovec xcb_parts[4]; 952 xcb_void_cookie_t xcb_ret; 953 xcb_dri3_set_drm_device_in_use_request_t xcb_out; 954 955 xcb_out.window = window; 956 xcb_out.drmMajor = drmMajor; 957 xcb_out.drmMinor = drmMinor; 958 959 xcb_parts[2].iov_base = (char *) &xcb_out; 960 xcb_parts[2].iov_len = sizeof(xcb_out); 961 xcb_parts[3].iov_base = 0; 962 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 963 964 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 965 return xcb_ret; 966 } 967 968 xcb_void_cookie_t 969 xcb_dri3_set_drm_device_in_use (xcb_connection_t *c, 970 xcb_window_t window, 971 uint32_t drmMajor, 972 uint32_t drmMinor) 973 { 974 static const xcb_protocol_request_t xcb_req = { 975 .count = 2, 976 .ext = &xcb_dri3_id, 977 .opcode = XCB_DRI3_SET_DRM_DEVICE_IN_USE, 978 .isvoid = 1 979 }; 980 981 struct iovec xcb_parts[4]; 982 xcb_void_cookie_t xcb_ret; 983 xcb_dri3_set_drm_device_in_use_request_t xcb_out; 984 985 xcb_out.window = window; 986 xcb_out.drmMajor = drmMajor; 987 xcb_out.drmMinor = drmMinor; 988 989 xcb_parts[2].iov_base = (char *) &xcb_out; 990 xcb_parts[2].iov_len = sizeof(xcb_out); 991 xcb_parts[3].iov_base = 0; 992 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 993 994 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 995 return xcb_ret; 996 } 997 998 xcb_void_cookie_t 999 xcb_dri3_import_syncobj_checked (xcb_connection_t *c, 1000 xcb_dri3_syncobj_t syncobj, 1001 xcb_drawable_t drawable, 1002 int32_t syncobj_fd) 1003 { 1004 static const xcb_protocol_request_t xcb_req = { 1005 .count = 2, 1006 .ext = &xcb_dri3_id, 1007 .opcode = XCB_DRI3_IMPORT_SYNCOBJ, 1008 .isvoid = 1 1009 }; 1010 1011 struct iovec xcb_parts[4]; 1012 xcb_void_cookie_t xcb_ret; 1013 xcb_dri3_import_syncobj_request_t xcb_out; 1014 int fds[1]; 1015 int fd_index = 0; 1016 1017 xcb_out.syncobj = syncobj; 1018 xcb_out.drawable = drawable; 1019 1020 xcb_parts[2].iov_base = (char *) &xcb_out; 1021 xcb_parts[2].iov_len = sizeof(xcb_out); 1022 xcb_parts[3].iov_base = 0; 1023 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1024 1025 fds[fd_index++] = syncobj_fd; 1026 xcb_ret.sequence = xcb_send_request_with_fds(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req, 1, fds); 1027 return xcb_ret; 1028 } 1029 1030 xcb_void_cookie_t 1031 xcb_dri3_import_syncobj (xcb_connection_t *c, 1032 xcb_dri3_syncobj_t syncobj, 1033 xcb_drawable_t drawable, 1034 int32_t syncobj_fd) 1035 { 1036 static const xcb_protocol_request_t xcb_req = { 1037 .count = 2, 1038 .ext = &xcb_dri3_id, 1039 .opcode = XCB_DRI3_IMPORT_SYNCOBJ, 1040 .isvoid = 1 1041 }; 1042 1043 struct iovec xcb_parts[4]; 1044 xcb_void_cookie_t xcb_ret; 1045 xcb_dri3_import_syncobj_request_t xcb_out; 1046 int fds[1]; 1047 int fd_index = 0; 1048 1049 xcb_out.syncobj = syncobj; 1050 xcb_out.drawable = drawable; 1051 1052 xcb_parts[2].iov_base = (char *) &xcb_out; 1053 xcb_parts[2].iov_len = sizeof(xcb_out); 1054 xcb_parts[3].iov_base = 0; 1055 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1056 1057 fds[fd_index++] = syncobj_fd; 1058 xcb_ret.sequence = xcb_send_request_with_fds(c, 0, xcb_parts + 2, &xcb_req, 1, fds); 1059 return xcb_ret; 1060 } 1061 1062 xcb_void_cookie_t 1063 xcb_dri3_free_syncobj_checked (xcb_connection_t *c, 1064 xcb_dri3_syncobj_t syncobj) 1065 { 1066 static const xcb_protocol_request_t xcb_req = { 1067 .count = 2, 1068 .ext = &xcb_dri3_id, 1069 .opcode = XCB_DRI3_FREE_SYNCOBJ, 1070 .isvoid = 1 1071 }; 1072 1073 struct iovec xcb_parts[4]; 1074 xcb_void_cookie_t xcb_ret; 1075 xcb_dri3_free_syncobj_request_t xcb_out; 1076 1077 xcb_out.syncobj = syncobj; 1078 1079 xcb_parts[2].iov_base = (char *) &xcb_out; 1080 xcb_parts[2].iov_len = sizeof(xcb_out); 1081 xcb_parts[3].iov_base = 0; 1082 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1083 1084 xcb_ret.sequence = xcb_send_request(c, XCB_REQUEST_CHECKED, xcb_parts + 2, &xcb_req); 1085 return xcb_ret; 1086 } 1087 1088 xcb_void_cookie_t 1089 xcb_dri3_free_syncobj (xcb_connection_t *c, 1090 xcb_dri3_syncobj_t syncobj) 1091 { 1092 static const xcb_protocol_request_t xcb_req = { 1093 .count = 2, 1094 .ext = &xcb_dri3_id, 1095 .opcode = XCB_DRI3_FREE_SYNCOBJ, 1096 .isvoid = 1 1097 }; 1098 1099 struct iovec xcb_parts[4]; 1100 xcb_void_cookie_t xcb_ret; 1101 xcb_dri3_free_syncobj_request_t xcb_out; 1102 1103 xcb_out.syncobj = syncobj; 1104 1105 xcb_parts[2].iov_base = (char *) &xcb_out; 1106 xcb_parts[2].iov_len = sizeof(xcb_out); 1107 xcb_parts[3].iov_base = 0; 1108 xcb_parts[3].iov_len = -xcb_parts[2].iov_len & 3; 1109 1110 xcb_ret.sequence = xcb_send_request(c, 0, xcb_parts + 2, &xcb_req); 1111 return xcb_ret; 1112 } 1113 1114