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