glxcmdsswap.c (21498B)
1 /* 2 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) 3 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. 4 * 5 * Permission is hereby granted, free of charge, to any person obtaining a 6 * copy of this software and associated documentation files (the "Software"), 7 * to deal in the Software without restriction, including without limitation 8 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * and/or sell copies of the Software, and to permit persons to whom the 10 * Software is furnished to do so, subject to the following conditions: 11 * 12 * The above copyright notice including the dates of first publication and 13 * either this permission notice or a reference to 14 * http://oss.sgi.com/projects/FreeB/ 15 * shall be included in all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 22 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 * SOFTWARE. 24 * 25 * Except as contained in this notice, the name of Silicon Graphics, Inc. 26 * shall not be used in advertising or otherwise to promote the sale, use or 27 * other dealings in this Software without prior written authorization from 28 * Silicon Graphics, Inc. 29 */ 30 31 #ifdef HAVE_DIX_CONFIG_H 32 #include <dix-config.h> 33 #endif 34 35 #include <string.h> 36 #include "glxserver.h" 37 #include "glxutil.h" 38 #include <GL/glxtokens.h> 39 #include <unpack.h> 40 #include <pixmapstr.h> 41 #include <windowstr.h> 42 #include "glxext.h" 43 #include "indirect_dispatch.h" 44 #include "indirect_table.h" 45 #include "indirect_util.h" 46 47 /************************************************************************/ 48 49 /* 50 ** Byteswapping versions of GLX commands. In most cases they just swap 51 ** the incoming arguments and then call the unswapped routine. For commands 52 ** that have replies, a separate swapping routine for the reply is provided; 53 ** it is called at the end of the unswapped routine. 54 */ 55 56 int 57 __glXDispSwap_CreateContext(__GLXclientState * cl, GLbyte * pc) 58 { 59 xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; 60 61 __GLX_DECLARE_SWAP_VARIABLES; 62 63 __GLX_SWAP_SHORT(&req->length); 64 __GLX_SWAP_INT(&req->context); 65 __GLX_SWAP_INT(&req->visual); 66 __GLX_SWAP_INT(&req->screen); 67 __GLX_SWAP_INT(&req->shareList); 68 69 return __glXDisp_CreateContext(cl, pc); 70 } 71 72 int 73 __glXDispSwap_CreateNewContext(__GLXclientState * cl, GLbyte * pc) 74 { 75 xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; 76 77 __GLX_DECLARE_SWAP_VARIABLES; 78 79 __GLX_SWAP_SHORT(&req->length); 80 __GLX_SWAP_INT(&req->context); 81 __GLX_SWAP_INT(&req->fbconfig); 82 __GLX_SWAP_INT(&req->screen); 83 __GLX_SWAP_INT(&req->renderType); 84 __GLX_SWAP_INT(&req->shareList); 85 86 return __glXDisp_CreateNewContext(cl, pc); 87 } 88 89 int 90 __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) 91 { 92 ClientPtr client = cl->client; 93 xGLXCreateContextWithConfigSGIXReq *req = 94 (xGLXCreateContextWithConfigSGIXReq *) pc; 95 __GLX_DECLARE_SWAP_VARIABLES; 96 97 REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq); 98 99 __GLX_SWAP_SHORT(&req->length); 100 __GLX_SWAP_INT(&req->context); 101 __GLX_SWAP_INT(&req->fbconfig); 102 __GLX_SWAP_INT(&req->screen); 103 __GLX_SWAP_INT(&req->renderType); 104 __GLX_SWAP_INT(&req->shareList); 105 106 return __glXDisp_CreateContextWithConfigSGIX(cl, pc); 107 } 108 109 int 110 __glXDispSwap_DestroyContext(__GLXclientState * cl, GLbyte * pc) 111 { 112 xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; 113 114 __GLX_DECLARE_SWAP_VARIABLES; 115 116 __GLX_SWAP_SHORT(&req->length); 117 __GLX_SWAP_INT(&req->context); 118 119 return __glXDisp_DestroyContext(cl, pc); 120 } 121 122 int 123 __glXDispSwap_MakeCurrent(__GLXclientState * cl, GLbyte * pc) 124 { 125 return BadImplementation; 126 } 127 128 int 129 __glXDispSwap_MakeContextCurrent(__GLXclientState * cl, GLbyte * pc) 130 { 131 return BadImplementation; 132 } 133 134 int 135 __glXDispSwap_MakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc) 136 { 137 return BadImplementation; 138 } 139 140 int 141 __glXDispSwap_IsDirect(__GLXclientState * cl, GLbyte * pc) 142 { 143 xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; 144 145 __GLX_DECLARE_SWAP_VARIABLES; 146 147 __GLX_SWAP_SHORT(&req->length); 148 __GLX_SWAP_INT(&req->context); 149 150 return __glXDisp_IsDirect(cl, pc); 151 } 152 153 int 154 __glXDispSwap_QueryVersion(__GLXclientState * cl, GLbyte * pc) 155 { 156 xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; 157 158 __GLX_DECLARE_SWAP_VARIABLES; 159 160 __GLX_SWAP_SHORT(&req->length); 161 __GLX_SWAP_INT(&req->majorVersion); 162 __GLX_SWAP_INT(&req->minorVersion); 163 164 return __glXDisp_QueryVersion(cl, pc); 165 } 166 167 int 168 __glXDispSwap_WaitGL(__GLXclientState * cl, GLbyte * pc) 169 { 170 xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; 171 172 __GLX_DECLARE_SWAP_VARIABLES; 173 174 __GLX_SWAP_SHORT(&req->length); 175 __GLX_SWAP_INT(&req->contextTag); 176 177 return __glXDisp_WaitGL(cl, pc); 178 } 179 180 int 181 __glXDispSwap_WaitX(__GLXclientState * cl, GLbyte * pc) 182 { 183 xGLXWaitXReq *req = (xGLXWaitXReq *) pc; 184 185 __GLX_DECLARE_SWAP_VARIABLES; 186 187 __GLX_SWAP_SHORT(&req->length); 188 __GLX_SWAP_INT(&req->contextTag); 189 190 return __glXDisp_WaitX(cl, pc); 191 } 192 193 int 194 __glXDispSwap_CopyContext(__GLXclientState * cl, GLbyte * pc) 195 { 196 xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; 197 198 __GLX_DECLARE_SWAP_VARIABLES; 199 200 __GLX_SWAP_SHORT(&req->length); 201 __GLX_SWAP_INT(&req->source); 202 __GLX_SWAP_INT(&req->dest); 203 __GLX_SWAP_INT(&req->mask); 204 205 return __glXDisp_CopyContext(cl, pc); 206 } 207 208 int 209 __glXDispSwap_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc) 210 { 211 xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; 212 213 __GLX_DECLARE_SWAP_VARIABLES; 214 215 __GLX_SWAP_INT(&req->screen); 216 return __glXDisp_GetVisualConfigs(cl, pc); 217 } 218 219 int 220 __glXDispSwap_GetFBConfigs(__GLXclientState * cl, GLbyte * pc) 221 { 222 xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; 223 224 __GLX_DECLARE_SWAP_VARIABLES; 225 226 __GLX_SWAP_INT(&req->screen); 227 return __glXDisp_GetFBConfigs(cl, pc); 228 } 229 230 int 231 __glXDispSwap_GetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc) 232 { 233 ClientPtr client = cl->client; 234 xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; 235 236 __GLX_DECLARE_SWAP_VARIABLES; 237 238 REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq); 239 240 __GLX_SWAP_INT(&req->screen); 241 return __glXDisp_GetFBConfigsSGIX(cl, pc); 242 } 243 244 int 245 __glXDispSwap_CreateGLXPixmap(__GLXclientState * cl, GLbyte * pc) 246 { 247 xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; 248 249 __GLX_DECLARE_SWAP_VARIABLES; 250 251 __GLX_SWAP_SHORT(&req->length); 252 __GLX_SWAP_INT(&req->screen); 253 __GLX_SWAP_INT(&req->visual); 254 __GLX_SWAP_INT(&req->pixmap); 255 __GLX_SWAP_INT(&req->glxpixmap); 256 257 return __glXDisp_CreateGLXPixmap(cl, pc); 258 } 259 260 int 261 __glXDispSwap_CreatePixmap(__GLXclientState * cl, GLbyte * pc) 262 { 263 ClientPtr client = cl->client; 264 xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; 265 CARD32 *attribs; 266 267 __GLX_DECLARE_SWAP_VARIABLES; 268 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 269 270 REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq); 271 272 __GLX_SWAP_SHORT(&req->length); 273 __GLX_SWAP_INT(&req->screen); 274 __GLX_SWAP_INT(&req->fbconfig); 275 __GLX_SWAP_INT(&req->pixmap); 276 __GLX_SWAP_INT(&req->glxpixmap); 277 __GLX_SWAP_INT(&req->numAttribs); 278 279 if (req->numAttribs > (UINT32_MAX >> 3)) { 280 client->errorValue = req->numAttribs; 281 return BadValue; 282 } 283 REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3); 284 attribs = (CARD32 *) (req + 1); 285 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); 286 287 return __glXDisp_CreatePixmap(cl, pc); 288 } 289 290 int 291 __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) 292 { 293 ClientPtr client = cl->client; 294 xGLXCreateGLXPixmapWithConfigSGIXReq *req = 295 (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; 296 __GLX_DECLARE_SWAP_VARIABLES; 297 298 REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq); 299 300 __GLX_SWAP_SHORT(&req->length); 301 __GLX_SWAP_INT(&req->screen); 302 __GLX_SWAP_INT(&req->fbconfig); 303 __GLX_SWAP_INT(&req->pixmap); 304 __GLX_SWAP_INT(&req->glxpixmap); 305 306 return __glXDisp_CreateGLXPixmapWithConfigSGIX(cl, pc); 307 } 308 309 int 310 __glXDispSwap_DestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) 311 { 312 xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; 313 314 __GLX_DECLARE_SWAP_VARIABLES; 315 316 __GLX_SWAP_SHORT(&req->length); 317 __GLX_SWAP_INT(&req->glxpixmap); 318 319 return __glXDisp_DestroyGLXPixmap(cl, pc); 320 } 321 322 int 323 __glXDispSwap_DestroyPixmap(__GLXclientState * cl, GLbyte * pc) 324 { 325 ClientPtr client = cl->client; 326 xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; 327 328 __GLX_DECLARE_SWAP_VARIABLES; 329 330 REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq); 331 332 __GLX_SWAP_SHORT(&req->length); 333 __GLX_SWAP_INT(&req->glxpixmap); 334 335 return __glXDisp_DestroyGLXPixmap(cl, pc); 336 } 337 338 int 339 __glXDispSwap_QueryContext(__GLXclientState * cl, GLbyte * pc) 340 { 341 xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; 342 343 __GLX_DECLARE_SWAP_VARIABLES; 344 345 __GLX_SWAP_INT(&req->context); 346 347 return __glXDisp_QueryContext(cl, pc); 348 } 349 350 int 351 __glXDispSwap_CreatePbuffer(__GLXclientState * cl, GLbyte * pc) 352 { 353 ClientPtr client = cl->client; 354 xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; 355 356 __GLX_DECLARE_SWAP_VARIABLES; 357 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 358 CARD32 *attribs; 359 360 REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq); 361 362 __GLX_SWAP_INT(&req->screen); 363 __GLX_SWAP_INT(&req->fbconfig); 364 __GLX_SWAP_INT(&req->pbuffer); 365 __GLX_SWAP_INT(&req->numAttribs); 366 367 if (req->numAttribs > (UINT32_MAX >> 3)) { 368 client->errorValue = req->numAttribs; 369 return BadValue; 370 } 371 REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3); 372 attribs = (CARD32 *) (req + 1); 373 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); 374 375 return __glXDisp_CreatePbuffer(cl, pc); 376 } 377 378 int 379 __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) 380 { 381 ClientPtr client = cl->client; 382 xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; 383 384 __GLX_DECLARE_SWAP_VARIABLES; 385 386 REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq); 387 388 __GLX_SWAP_INT(&req->screen); 389 __GLX_SWAP_INT(&req->fbconfig); 390 __GLX_SWAP_INT(&req->pbuffer); 391 __GLX_SWAP_INT(&req->width); 392 __GLX_SWAP_INT(&req->height); 393 394 return __glXDisp_CreateGLXPbufferSGIX(cl, pc); 395 } 396 397 int 398 __glXDispSwap_DestroyPbuffer(__GLXclientState * cl, GLbyte * pc) 399 { 400 xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; 401 402 __GLX_DECLARE_SWAP_VARIABLES; 403 404 __GLX_SWAP_INT(&req->pbuffer); 405 406 return __glXDisp_DestroyPbuffer(cl, pc); 407 } 408 409 int 410 __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) 411 { 412 ClientPtr client = cl->client; 413 xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; 414 415 __GLX_DECLARE_SWAP_VARIABLES; 416 417 REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq); 418 419 __GLX_SWAP_INT(&req->pbuffer); 420 421 return __glXDisp_DestroyGLXPbufferSGIX(cl, pc); 422 } 423 424 int 425 __glXDispSwap_ChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) 426 { 427 ClientPtr client = cl->client; 428 xGLXChangeDrawableAttributesReq *req = 429 (xGLXChangeDrawableAttributesReq *) pc; 430 __GLX_DECLARE_SWAP_VARIABLES; 431 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 432 CARD32 *attribs; 433 434 REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq); 435 436 __GLX_SWAP_INT(&req->drawable); 437 __GLX_SWAP_INT(&req->numAttribs); 438 439 if (req->numAttribs > (UINT32_MAX >> 3)) { 440 client->errorValue = req->numAttribs; 441 return BadValue; 442 } 443 if (((sizeof(xGLXChangeDrawableAttributesReq) + 444 (req->numAttribs << 3)) >> 2) < client->req_len) 445 return BadLength; 446 447 attribs = (CARD32 *) (req + 1); 448 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); 449 450 return __glXDisp_ChangeDrawableAttributes(cl, pc); 451 } 452 453 int 454 __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc) 455 { 456 ClientPtr client = cl->client; 457 xGLXChangeDrawableAttributesSGIXReq *req = 458 (xGLXChangeDrawableAttributesSGIXReq *) pc; 459 __GLX_DECLARE_SWAP_VARIABLES; 460 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 461 CARD32 *attribs; 462 463 REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq); 464 465 __GLX_SWAP_INT(&req->drawable); 466 __GLX_SWAP_INT(&req->numAttribs); 467 468 if (req->numAttribs > (UINT32_MAX >> 3)) { 469 client->errorValue = req->numAttribs; 470 return BadValue; 471 } 472 REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, 473 req->numAttribs << 3); 474 attribs = (CARD32 *) (req + 1); 475 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); 476 477 return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc); 478 } 479 480 int 481 __glXDispSwap_CreateWindow(__GLXclientState * cl, GLbyte * pc) 482 { 483 ClientPtr client = cl->client; 484 xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; 485 486 __GLX_DECLARE_SWAP_VARIABLES; 487 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 488 CARD32 *attribs; 489 490 REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq); 491 492 __GLX_SWAP_INT(&req->screen); 493 __GLX_SWAP_INT(&req->fbconfig); 494 __GLX_SWAP_INT(&req->window); 495 __GLX_SWAP_INT(&req->glxwindow); 496 __GLX_SWAP_INT(&req->numAttribs); 497 498 if (req->numAttribs > (UINT32_MAX >> 3)) { 499 client->errorValue = req->numAttribs; 500 return BadValue; 501 } 502 REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3); 503 attribs = (CARD32 *) (req + 1); 504 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); 505 506 return __glXDisp_CreateWindow(cl, pc); 507 } 508 509 int 510 __glXDispSwap_DestroyWindow(__GLXclientState * cl, GLbyte * pc) 511 { 512 ClientPtr client = cl->client; 513 xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; 514 515 __GLX_DECLARE_SWAP_VARIABLES; 516 517 REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq); 518 519 __GLX_SWAP_INT(&req->glxwindow); 520 521 return __glXDisp_DestroyWindow(cl, pc); 522 } 523 524 int 525 __glXDispSwap_SwapBuffers(__GLXclientState * cl, GLbyte * pc) 526 { 527 xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; 528 529 __GLX_DECLARE_SWAP_VARIABLES; 530 531 __GLX_SWAP_SHORT(&req->length); 532 __GLX_SWAP_INT(&req->contextTag); 533 __GLX_SWAP_INT(&req->drawable); 534 535 return __glXDisp_SwapBuffers(cl, pc); 536 } 537 538 int 539 __glXDispSwap_UseXFont(__GLXclientState * cl, GLbyte * pc) 540 { 541 xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; 542 543 __GLX_DECLARE_SWAP_VARIABLES; 544 545 __GLX_SWAP_SHORT(&req->length); 546 __GLX_SWAP_INT(&req->contextTag); 547 __GLX_SWAP_INT(&req->font); 548 __GLX_SWAP_INT(&req->first); 549 __GLX_SWAP_INT(&req->count); 550 __GLX_SWAP_INT(&req->listBase); 551 552 return __glXDisp_UseXFont(cl, pc); 553 } 554 555 int 556 __glXDispSwap_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc) 557 { 558 xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; 559 560 __GLX_DECLARE_SWAP_VARIABLES; 561 562 __GLX_SWAP_SHORT(&req->length); 563 __GLX_SWAP_INT(&req->screen); 564 565 return __glXDisp_QueryExtensionsString(cl, pc); 566 } 567 568 int 569 __glXDispSwap_QueryServerString(__GLXclientState * cl, GLbyte * pc) 570 { 571 xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; 572 573 __GLX_DECLARE_SWAP_VARIABLES; 574 575 __GLX_SWAP_SHORT(&req->length); 576 __GLX_SWAP_INT(&req->screen); 577 __GLX_SWAP_INT(&req->name); 578 579 return __glXDisp_QueryServerString(cl, pc); 580 } 581 582 int 583 __glXDispSwap_ClientInfo(__GLXclientState * cl, GLbyte * pc) 584 { 585 ClientPtr client = cl->client; 586 xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; 587 588 __GLX_DECLARE_SWAP_VARIABLES; 589 590 REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); 591 592 __GLX_SWAP_SHORT(&req->length); 593 __GLX_SWAP_INT(&req->major); 594 __GLX_SWAP_INT(&req->minor); 595 __GLX_SWAP_INT(&req->numbytes); 596 597 return __glXDisp_ClientInfo(cl, pc); 598 } 599 600 int 601 __glXDispSwap_QueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc) 602 { 603 ClientPtr client = cl->client; 604 xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; 605 606 __GLX_DECLARE_SWAP_VARIABLES; 607 608 REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq); 609 610 __GLX_SWAP_SHORT(&req->length); 611 __GLX_SWAP_INT(&req->context); 612 613 return __glXDisp_QueryContextInfoEXT(cl, pc); 614 } 615 616 int 617 __glXDispSwap_BindTexImageEXT(__GLXclientState * cl, GLbyte * pc) 618 { 619 ClientPtr client = cl->client; 620 xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; 621 GLXDrawable *drawId; 622 int *buffer; 623 CARD32 *num_attribs; 624 625 __GLX_DECLARE_SWAP_VARIABLES; 626 627 if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len) 628 return BadLength; 629 630 pc += __GLX_VENDPRIV_HDR_SIZE; 631 632 drawId = ((GLXDrawable *) (pc)); 633 buffer = ((int *) (pc + 4)); 634 num_attribs = ((CARD32 *) (pc + 8)); 635 636 __GLX_SWAP_SHORT(&req->length); 637 __GLX_SWAP_INT(&req->contextTag); 638 __GLX_SWAP_INT(drawId); 639 __GLX_SWAP_INT(buffer); 640 __GLX_SWAP_INT(num_attribs); 641 642 return __glXDisp_BindTexImageEXT(cl, (GLbyte *) pc); 643 } 644 645 int 646 __glXDispSwap_ReleaseTexImageEXT(__GLXclientState * cl, GLbyte * pc) 647 { 648 ClientPtr client = cl->client; 649 xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; 650 GLXDrawable *drawId; 651 int *buffer; 652 653 __GLX_DECLARE_SWAP_VARIABLES; 654 655 REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); 656 657 pc += __GLX_VENDPRIV_HDR_SIZE; 658 659 drawId = ((GLXDrawable *) (pc)); 660 buffer = ((int *) (pc + 4)); 661 662 __GLX_SWAP_SHORT(&req->length); 663 __GLX_SWAP_INT(&req->contextTag); 664 __GLX_SWAP_INT(drawId); 665 __GLX_SWAP_INT(buffer); 666 667 return __glXDisp_ReleaseTexImageEXT(cl, (GLbyte *) pc); 668 } 669 670 int 671 __glXDispSwap_CopySubBufferMESA(__GLXclientState * cl, GLbyte * pc) 672 { 673 ClientPtr client = cl->client; 674 xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; 675 GLXDrawable *drawId; 676 int *buffer; 677 678 __GLX_DECLARE_SWAP_VARIABLES; 679 680 REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20); 681 682 (void) drawId; 683 (void) buffer; 684 685 pc += __GLX_VENDPRIV_HDR_SIZE; 686 687 __GLX_SWAP_SHORT(&req->length); 688 __GLX_SWAP_INT(&req->contextTag); 689 __GLX_SWAP_INT(pc); 690 __GLX_SWAP_INT(pc + 4); 691 __GLX_SWAP_INT(pc + 8); 692 __GLX_SWAP_INT(pc + 12); 693 __GLX_SWAP_INT(pc + 16); 694 695 return __glXDisp_CopySubBufferMESA(cl, pc); 696 697 } 698 699 int 700 __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState * cl, GLbyte * pc) 701 { 702 ClientPtr client = cl->client; 703 xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *) pc; 704 CARD32 *data; 705 706 __GLX_DECLARE_SWAP_VARIABLES; 707 708 REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq); 709 710 data = (CARD32 *) (req + 1); 711 __GLX_SWAP_SHORT(&req->length); 712 __GLX_SWAP_INT(&req->contextTag); 713 __GLX_SWAP_INT(data); 714 715 return __glXDisp_GetDrawableAttributesSGIX(cl, pc); 716 } 717 718 int 719 __glXDispSwap_GetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) 720 { 721 ClientPtr client = cl->client; 722 xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc; 723 724 __GLX_DECLARE_SWAP_VARIABLES; 725 726 REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq); 727 728 __GLX_SWAP_SHORT(&req->length); 729 __GLX_SWAP_INT(&req->drawable); 730 731 return __glXDisp_GetDrawableAttributes(cl, pc); 732 } 733 734 /************************************************************************/ 735 736 /* 737 ** Render and Renderlarge are not in the GLX API. They are used by the GLX 738 ** client library to send batches of GL rendering commands. 739 */ 740 741 int 742 __glXDispSwap_Render(__GLXclientState * cl, GLbyte * pc) 743 { 744 return __glXDisp_Render(cl, pc); 745 } 746 747 /* 748 ** Execute a large rendering request (one that spans multiple X requests). 749 */ 750 int 751 __glXDispSwap_RenderLarge(__GLXclientState * cl, GLbyte * pc) 752 { 753 return __glXDisp_RenderLarge(cl, pc); 754 } 755 756 /************************************************************************/ 757 758 /* 759 ** No support is provided for the vendor-private requests other than 760 ** allocating these entry points in the dispatch table. 761 */ 762 763 int 764 __glXDispSwap_VendorPrivate(__GLXclientState * cl, GLbyte * pc) 765 { 766 ClientPtr client = cl->client; 767 xGLXVendorPrivateReq *req; 768 GLint vendorcode; 769 __GLXdispatchVendorPrivProcPtr proc; 770 771 __GLX_DECLARE_SWAP_VARIABLES; 772 REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); 773 774 req = (xGLXVendorPrivateReq *) pc; 775 __GLX_SWAP_SHORT(&req->length); 776 __GLX_SWAP_INT(&req->vendorCode); 777 778 vendorcode = req->vendorCode; 779 780 proc = (__GLXdispatchVendorPrivProcPtr) 781 __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, 782 vendorcode, 1); 783 if (proc != NULL) { 784 return (*proc) (cl, (GLbyte *) req); 785 } 786 787 cl->client->errorValue = req->vendorCode; 788 return __glXError(GLXUnsupportedPrivateRequest); 789 } 790 791 int 792 __glXDispSwap_VendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) 793 { 794 ClientPtr client = cl->client; 795 xGLXVendorPrivateWithReplyReq *req; 796 GLint vendorcode; 797 __GLXdispatchVendorPrivProcPtr proc; 798 799 __GLX_DECLARE_SWAP_VARIABLES; 800 REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateWithReplyReq); 801 802 req = (xGLXVendorPrivateWithReplyReq *) pc; 803 __GLX_SWAP_SHORT(&req->length); 804 __GLX_SWAP_INT(&req->vendorCode); 805 806 vendorcode = req->vendorCode; 807 808 proc = (__GLXdispatchVendorPrivProcPtr) 809 __glXGetProtocolDecodeFunction(&VendorPriv_dispatch_info, 810 vendorcode, 1); 811 if (proc != NULL) { 812 return (*proc) (cl, (GLbyte *) req); 813 } 814 815 cl->client->errorValue = req->vendorCode; 816 return __glXError(GLXUnsupportedPrivateRequest); 817 }