glxcmdsswap.c revision 4642e01f
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#define NEED_REPLIES 32#define FONT_PCF 33#ifdef HAVE_DIX_CONFIG_H 34#include <dix-config.h> 35#endif 36 37#include <string.h> 38#include "glxserver.h" 39#include "glxutil.h" 40#include <GL/glxtokens.h> 41#include <unpack.h> 42#include "g_disptab.h" 43#include <pixmapstr.h> 44#include <windowstr.h> 45#include "glxext.h" 46#include "glapitable.h" 47#include "glapi.h" 48#include "glthread.h" 49#include "dispatch.h" 50#include "indirect_dispatch.h" 51#include "indirect_table.h" 52#include "indirect_util.h" 53 54 55/************************************************************************/ 56 57/* 58** Byteswapping versions of GLX commands. In most cases they just swap 59** the incoming arguments and then call the unswapped routine. For commands 60** that have replies, a separate swapping routine for the reply is provided; 61** it is called at the end of the unswapped routine. 62*/ 63 64int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc) 65{ 66 xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; 67 __GLX_DECLARE_SWAP_VARIABLES; 68 69 __GLX_SWAP_SHORT(&req->length); 70 __GLX_SWAP_INT(&req->context); 71 __GLX_SWAP_INT(&req->visual); 72 __GLX_SWAP_INT(&req->screen); 73 __GLX_SWAP_INT(&req->shareList); 74 75 return __glXDisp_CreateContext(cl, pc); 76} 77 78int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc) 79{ 80 xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; 81 __GLX_DECLARE_SWAP_VARIABLES; 82 83 __GLX_SWAP_SHORT(&req->length); 84 __GLX_SWAP_INT(&req->context); 85 __GLX_SWAP_INT(&req->fbconfig); 86 __GLX_SWAP_INT(&req->screen); 87 __GLX_SWAP_INT(&req->renderType); 88 __GLX_SWAP_INT(&req->shareList); 89 90 return __glXDisp_CreateNewContext(cl, pc); 91} 92 93int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) 94{ 95 xGLXCreateContextWithConfigSGIXReq *req = 96 (xGLXCreateContextWithConfigSGIXReq *) pc; 97 __GLX_DECLARE_SWAP_VARIABLES; 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 109int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc) 110{ 111 xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; 112 __GLX_DECLARE_SWAP_VARIABLES; 113 114 __GLX_SWAP_SHORT(&req->length); 115 __GLX_SWAP_INT(&req->context); 116 117 return __glXDisp_DestroyContext(cl, pc); 118} 119 120int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc) 121{ 122 xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; 123 __GLX_DECLARE_SWAP_VARIABLES; 124 125 __GLX_SWAP_SHORT(&req->length); 126 __GLX_SWAP_INT(&req->drawable); 127 __GLX_SWAP_INT(&req->context); 128 __GLX_SWAP_INT(&req->oldContextTag); 129 130 return __glXDisp_MakeCurrent(cl, pc); 131} 132 133int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc) 134{ 135 xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; 136 __GLX_DECLARE_SWAP_VARIABLES; 137 138 __GLX_SWAP_SHORT(&req->length); 139 __GLX_SWAP_INT(&req->drawable); 140 __GLX_SWAP_INT(&req->readdrawable); 141 __GLX_SWAP_INT(&req->context); 142 __GLX_SWAP_INT(&req->oldContextTag); 143 144 return __glXDisp_MakeContextCurrent(cl, pc); 145} 146 147int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) 148{ 149 xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; 150 __GLX_DECLARE_SWAP_VARIABLES; 151 152 __GLX_SWAP_SHORT(&req->length); 153 __GLX_SWAP_INT(&req->drawable); 154 __GLX_SWAP_INT(&req->readable); 155 __GLX_SWAP_INT(&req->context); 156 __GLX_SWAP_INT(&req->oldContextTag); 157 158 return __glXDisp_MakeCurrentReadSGI(cl, pc); 159} 160 161int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc) 162{ 163 xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; 164 __GLX_DECLARE_SWAP_VARIABLES; 165 166 __GLX_SWAP_SHORT(&req->length); 167 __GLX_SWAP_INT(&req->context); 168 169 return __glXDisp_IsDirect(cl, pc); 170} 171 172int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc) 173{ 174 xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; 175 __GLX_DECLARE_SWAP_VARIABLES; 176 177 __GLX_SWAP_SHORT(&req->length); 178 __GLX_SWAP_INT(&req->majorVersion); 179 __GLX_SWAP_INT(&req->minorVersion); 180 181 return __glXDisp_QueryVersion(cl, pc); 182} 183 184int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc) 185{ 186 xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; 187 __GLX_DECLARE_SWAP_VARIABLES; 188 189 __GLX_SWAP_SHORT(&req->length); 190 __GLX_SWAP_INT(&req->contextTag); 191 192 return __glXDisp_WaitGL(cl, pc); 193} 194 195int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc) 196{ 197 xGLXWaitXReq *req = (xGLXWaitXReq *) pc; 198 __GLX_DECLARE_SWAP_VARIABLES; 199 200 __GLX_SWAP_SHORT(&req->length); 201 __GLX_SWAP_INT(&req->contextTag); 202 203 return __glXDisp_WaitX(cl, pc); 204} 205 206int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc) 207{ 208 xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; 209 __GLX_DECLARE_SWAP_VARIABLES; 210 211 __GLX_SWAP_SHORT(&req->length); 212 __GLX_SWAP_INT(&req->source); 213 __GLX_SWAP_INT(&req->dest); 214 __GLX_SWAP_INT(&req->mask); 215 216 return __glXDisp_CopyContext(cl, pc); 217} 218 219int __glXDispSwap_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) 220{ 221 xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; 222 __GLX_DECLARE_SWAP_VARIABLES; 223 224 __GLX_SWAP_INT(&req->screen); 225 return __glXDisp_GetVisualConfigs(cl, pc); 226} 227 228int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc) 229{ 230 xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; 231 __GLX_DECLARE_SWAP_VARIABLES; 232 233 __GLX_SWAP_INT(&req->screen); 234 return __glXDisp_GetFBConfigs(cl, pc); 235} 236 237int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) 238{ 239 xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; 240 __GLX_DECLARE_SWAP_VARIABLES; 241 242 __GLX_SWAP_INT(&req->screen); 243 return __glXDisp_GetFBConfigsSGIX(cl, pc); 244} 245 246int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) 247{ 248 xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; 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 260int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc) 261{ 262 xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; 263 CARD32 *attribs; 264 __GLX_DECLARE_SWAP_VARIABLES; 265 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 266 267 __GLX_SWAP_SHORT(&req->length); 268 __GLX_SWAP_INT(&req->screen); 269 __GLX_SWAP_INT(&req->fbconfig); 270 __GLX_SWAP_INT(&req->pixmap); 271 __GLX_SWAP_INT(&req->glxpixmap); 272 __GLX_SWAP_INT(&req->numAttribs); 273 attribs = (CARD32*)(req + 1); 274 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); 275 276 return __glXDisp_CreatePixmap(cl, pc); 277} 278 279int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) 280{ 281 xGLXCreateGLXPixmapWithConfigSGIXReq *req = 282 (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; 283 __GLX_DECLARE_SWAP_VARIABLES; 284 285 __GLX_SWAP_SHORT(&req->length); 286 __GLX_SWAP_INT(&req->screen); 287 __GLX_SWAP_INT(&req->fbconfig); 288 __GLX_SWAP_INT(&req->pixmap); 289 __GLX_SWAP_INT(&req->glxpixmap); 290 291 return __glXDisp_CreateGLXPixmapWithConfigSGIX(cl, pc); 292} 293 294int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) 295{ 296 xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; 297 __GLX_DECLARE_SWAP_VARIABLES; 298 299 __GLX_SWAP_SHORT(&req->length); 300 __GLX_SWAP_INT(&req->glxpixmap); 301 302 return __glXDisp_DestroyGLXPixmap(cl, pc); 303} 304 305int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc) 306{ 307 xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; 308 __GLX_DECLARE_SWAP_VARIABLES; 309 310 __GLX_SWAP_SHORT(&req->length); 311 __GLX_SWAP_INT(&req->glxpixmap); 312 313 return __glXDisp_DestroyGLXPixmap(cl, pc); 314} 315 316int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc) 317{ 318 xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; 319 __GLX_DECLARE_SWAP_VARIABLES; 320 321 __GLX_SWAP_INT(&req->context); 322 323 return __glXDisp_QueryContext(cl, pc); 324} 325 326int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) 327{ 328 xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; 329 __GLX_DECLARE_SWAP_VARIABLES; 330 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 331 CARD32 *attribs; 332 333 __GLX_SWAP_INT(&req->screen); 334 __GLX_SWAP_INT(&req->fbconfig); 335 __GLX_SWAP_INT(&req->pbuffer); 336 __GLX_SWAP_INT(&req->numAttribs); 337 attribs = (CARD32*)(req + 1); 338 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); 339 340 return __glXDisp_CreatePbuffer(cl, pc); 341} 342 343int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) 344{ 345 xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; 346 __GLX_DECLARE_SWAP_VARIABLES; 347 348 __GLX_SWAP_INT(&req->screen); 349 __GLX_SWAP_INT(&req->fbconfig); 350 __GLX_SWAP_INT(&req->pbuffer); 351 __GLX_SWAP_INT(&req->width); 352 __GLX_SWAP_INT(&req->height); 353 354 return __glXDisp_CreateGLXPbufferSGIX(cl, pc); 355} 356 357int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) 358{ 359 xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) req; 360 __GLX_DECLARE_SWAP_VARIABLES; 361 362 __GLX_SWAP_INT(&req->pbuffer); 363 364 return __glXDisp_DestroyPbuffer(cl, pc); 365} 366 367int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) 368{ 369 xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) req; 370 __GLX_DECLARE_SWAP_VARIABLES; 371 372 __GLX_SWAP_INT(&req->pbuffer); 373 374 return __glXDisp_DestroyGLXPbufferSGIX(cl, pc); 375} 376 377int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) 378{ 379 xGLXChangeDrawableAttributesReq *req = 380 (xGLXChangeDrawableAttributesReq *) req; 381 __GLX_DECLARE_SWAP_VARIABLES; 382 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 383 CARD32 *attribs; 384 385 __GLX_SWAP_INT(&req->drawable); 386 __GLX_SWAP_INT(&req->numAttribs); 387 attribs = (CARD32*)(req + 1); 388 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); 389 390 return __glXDisp_ChangeDrawableAttributes(cl, pc); 391} 392 393int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl, 394 GLbyte *pc) 395{ 396 xGLXChangeDrawableAttributesSGIXReq *req = 397 (xGLXChangeDrawableAttributesSGIXReq *) req; 398 __GLX_DECLARE_SWAP_VARIABLES; 399 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 400 CARD32 *attribs; 401 402 __GLX_SWAP_INT(&req->drawable); 403 __GLX_SWAP_INT(&req->numAttribs); 404 attribs = (CARD32*)(req + 1); 405 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); 406 407 return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc); 408} 409 410int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc) 411{ 412 xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; 413 __GLX_DECLARE_SWAP_VARIABLES; 414 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 415 CARD32 *attribs; 416 417 __GLX_SWAP_INT(&req->screen); 418 __GLX_SWAP_INT(&req->fbconfig); 419 __GLX_SWAP_INT(&req->window); 420 __GLX_SWAP_INT(&req->glxwindow); 421 __GLX_SWAP_INT(&req->numAttribs); 422 attribs = (CARD32*)(req + 1); 423 __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); 424 425 return __glXDisp_CreateWindow(cl, pc); 426} 427 428int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc) 429{ 430 xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; 431 __GLX_DECLARE_SWAP_VARIABLES; 432 433 __GLX_SWAP_INT(&req->glxwindow); 434 435 return __glXDisp_DestroyWindow(cl, pc); 436} 437 438int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc) 439{ 440 xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; 441 __GLX_DECLARE_SWAP_VARIABLES; 442 443 __GLX_SWAP_SHORT(&req->length); 444 __GLX_SWAP_INT(&req->contextTag); 445 __GLX_SWAP_INT(&req->drawable); 446 447 return __glXDisp_SwapBuffers(cl, pc); 448} 449 450int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc) 451{ 452 xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; 453 __GLX_DECLARE_SWAP_VARIABLES; 454 455 __GLX_SWAP_SHORT(&req->length); 456 __GLX_SWAP_INT(&req->contextTag); 457 __GLX_SWAP_INT(&req->font); 458 __GLX_SWAP_INT(&req->first); 459 __GLX_SWAP_INT(&req->count); 460 __GLX_SWAP_INT(&req->listBase); 461 462 return __glXDisp_UseXFont(cl, pc); 463} 464 465 466int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc) 467{ 468 xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *)pc; 469 __GLX_DECLARE_SWAP_VARIABLES; 470 471 __GLX_SWAP_SHORT(&req->length); 472 __GLX_SWAP_INT(&req->screen); 473 474 return __glXDisp_QueryExtensionsString(cl, pc); 475} 476 477int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc) 478{ 479 xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; 480 __GLX_DECLARE_SWAP_VARIABLES; 481 482 __GLX_SWAP_SHORT(&req->length); 483 __GLX_SWAP_INT(&req->screen); 484 __GLX_SWAP_INT(&req->name); 485 486 return __glXDisp_QueryServerString(cl, pc); 487} 488 489int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc) 490{ 491 xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; 492 __GLX_DECLARE_SWAP_VARIABLES; 493 494 __GLX_SWAP_SHORT(&req->length); 495 __GLX_SWAP_INT(&req->major); 496 __GLX_SWAP_INT(&req->minor); 497 __GLX_SWAP_INT(&req->numbytes); 498 499 return __glXDisp_ClientInfo(cl, pc); 500} 501 502int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) 503{ 504 xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; 505 __GLX_DECLARE_SWAP_VARIABLES; 506 507 __GLX_SWAP_SHORT(&req->length); 508 __GLX_SWAP_INT(&req->context); 509 510 return __glXDisp_QueryContextInfoEXT(cl, pc); 511} 512 513int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) 514{ 515 xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; 516 GLXDrawable *drawId; 517 int *buffer; 518 519 __GLX_DECLARE_SWAP_VARIABLES; 520 521 pc += __GLX_VENDPRIV_HDR_SIZE; 522 523 drawId = ((GLXDrawable *) (pc)); 524 buffer = ((int *) (pc + 4)); 525 526 __GLX_SWAP_SHORT(&req->length); 527 __GLX_SWAP_INT(&req->contextTag); 528 __GLX_SWAP_INT(drawId); 529 __GLX_SWAP_INT(buffer); 530 531 return __glXDisp_BindTexImageEXT(cl, (GLbyte *)pc); 532} 533 534int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) 535{ 536 xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; 537 GLXDrawable *drawId; 538 int *buffer; 539 540 __GLX_DECLARE_SWAP_VARIABLES; 541 542 pc += __GLX_VENDPRIV_HDR_SIZE; 543 544 drawId = ((GLXDrawable *) (pc)); 545 buffer = ((int *) (pc + 4)); 546 547 __GLX_SWAP_SHORT(&req->length); 548 __GLX_SWAP_INT(&req->contextTag); 549 __GLX_SWAP_INT(drawId); 550 __GLX_SWAP_INT(buffer); 551 552 return __glXDisp_ReleaseTexImageEXT(cl, (GLbyte *)pc); 553} 554 555int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) 556{ 557 xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; 558 GLXDrawable *drawId; 559 int *buffer; 560 561 __GLX_DECLARE_SWAP_VARIABLES; 562 563 (void) drawId; 564 (void) buffer; 565 566 pc += __GLX_VENDPRIV_HDR_SIZE; 567 568 __GLX_SWAP_SHORT(&req->length); 569 __GLX_SWAP_INT(&req->contextTag); 570 __GLX_SWAP_INT(pc); 571 __GLX_SWAP_INT(pc + 4); 572 __GLX_SWAP_INT(pc + 8); 573 __GLX_SWAP_INT(pc + 12); 574 __GLX_SWAP_INT(pc + 16); 575 576 return __glXDisp_CopySubBufferMESA(cl, pc); 577 578} 579 580int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) 581{ 582 xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc; 583 CARD32 *data; 584 585 __GLX_DECLARE_SWAP_VARIABLES; 586 587 data = (CARD32 *) (req + 1); 588 __GLX_SWAP_SHORT(&req->length); 589 __GLX_SWAP_INT(&req->contextTag); 590 __GLX_SWAP_INT(data); 591 592 return __glXDisp_GetDrawableAttributesSGIX(cl, pc); 593} 594 595int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) 596{ 597 xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; 598 599 __GLX_DECLARE_SWAP_VARIABLES; 600 601 __GLX_SWAP_SHORT(&req->length); 602 __GLX_SWAP_INT(&req->drawable); 603 604 return __glXDisp_GetDrawableAttributes(cl, pc); 605} 606 607 608/************************************************************************/ 609 610/* 611** Swap replies. 612*/ 613 614void __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReply *reply) 615{ 616 __GLX_DECLARE_SWAP_VARIABLES; 617 __GLX_SWAP_SHORT(&reply->sequenceNumber); 618 __GLX_SWAP_INT(&reply->length); 619 __GLX_SWAP_INT(&reply->contextTag); 620 WriteToClient(client, sz_xGLXMakeCurrentReply, (char *)reply); 621} 622 623void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply *reply) 624{ 625 __GLX_DECLARE_SWAP_VARIABLES; 626 __GLX_SWAP_SHORT(&reply->sequenceNumber); 627 __GLX_SWAP_INT(&reply->length); 628 WriteToClient(client, sz_xGLXIsDirectReply, (char *)reply); 629} 630 631void __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply *reply) 632{ 633 __GLX_DECLARE_SWAP_VARIABLES; 634 __GLX_SWAP_SHORT(&reply->sequenceNumber); 635 __GLX_SWAP_INT(&reply->length); 636 __GLX_SWAP_INT(&reply->majorVersion); 637 __GLX_SWAP_INT(&reply->minorVersion); 638 WriteToClient(client, sz_xGLXQueryVersionReply, (char *)reply); 639} 640 641void glxSwapQueryExtensionsStringReply(ClientPtr client, 642 xGLXQueryExtensionsStringReply *reply, char *buf) 643{ 644 int length = reply->length; 645 __GLX_DECLARE_SWAP_VARIABLES; 646 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 647 __GLX_SWAP_SHORT(&reply->sequenceNumber); 648 __GLX_SWAP_INT(&reply->length); 649 __GLX_SWAP_INT(&reply->n); 650 WriteToClient(client, sz_xGLXQueryExtensionsStringReply, (char *)reply); 651 __GLX_SWAP_INT_ARRAY((int *)buf, length); 652 WriteToClient(client, length << 2, buf); 653} 654 655void glxSwapQueryServerStringReply(ClientPtr client, 656 xGLXQueryServerStringReply *reply, char *buf) 657{ 658 int length = reply->length; 659 __GLX_DECLARE_SWAP_VARIABLES; 660 __GLX_SWAP_SHORT(&reply->sequenceNumber); 661 __GLX_SWAP_INT(&reply->length); 662 __GLX_SWAP_INT(&reply->n); 663 WriteToClient(client, sz_xGLXQueryServerStringReply, (char *)reply); 664 /** no swap is needed for an array of chars **/ 665 /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ 666 WriteToClient(client, length << 2, buf); 667} 668 669void __glXSwapQueryContextInfoEXTReply(ClientPtr client, xGLXQueryContextInfoEXTReply *reply, int *buf) 670{ 671 int length = reply->length; 672 __GLX_DECLARE_SWAP_VARIABLES; 673 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 674 __GLX_SWAP_SHORT(&reply->sequenceNumber); 675 __GLX_SWAP_INT(&reply->length); 676 __GLX_SWAP_INT(&reply->n); 677 WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, (char *)reply); 678 __GLX_SWAP_INT_ARRAY((int *)buf, length); 679 WriteToClient(client, length << 2, (char *)buf); 680} 681 682void __glXSwapGetDrawableAttributesReply(ClientPtr client, 683 xGLXGetDrawableAttributesReply *reply, CARD32 *buf) 684{ 685 int length = reply->length; 686 __GLX_DECLARE_SWAP_VARIABLES; 687 __GLX_DECLARE_SWAP_ARRAY_VARIABLES; 688 __GLX_SWAP_SHORT(&reply->sequenceNumber); 689 __GLX_SWAP_INT(&reply->length); 690 __GLX_SWAP_INT(&reply->numAttribs); 691 WriteToClient(client, sz_xGLXGetDrawableAttributesReply, (char *)reply); 692 __GLX_SWAP_INT_ARRAY((int *)buf, length); 693 WriteToClient(client, length << 2, (char *)buf); 694} 695 696/************************************************************************/ 697 698/* 699** Render and Renderlarge are not in the GLX API. They are used by the GLX 700** client library to send batches of GL rendering commands. 701*/ 702 703int __glXDispSwap_Render(__GLXclientState *cl, GLbyte *pc) 704{ 705 return __glXDisp_Render(cl, pc); 706} 707 708/* 709** Execute a large rendering request (one that spans multiple X requests). 710*/ 711int __glXDispSwap_RenderLarge(__GLXclientState *cl, GLbyte *pc) 712{ 713 return __glXDisp_RenderLarge(cl, pc); 714} 715 716/************************************************************************/ 717 718/* 719** No support is provided for the vendor-private requests other than 720** allocating these entry points in the dispatch table. 721*/ 722 723int __glXDispSwap_VendorPrivate(__GLXclientState *cl, GLbyte *pc) 724{ 725 xGLXVendorPrivateReq *req; 726 GLint vendorcode; 727 __GLXdispatchVendorPrivProcPtr proc; 728 729 __GLX_DECLARE_SWAP_VARIABLES; 730 731 req = (xGLXVendorPrivateReq *) pc; 732 __GLX_SWAP_SHORT(&req->length); 733 __GLX_SWAP_INT(&req->vendorCode); 734 735 vendorcode = req->vendorCode; 736 737 proc = (__GLXdispatchVendorPrivProcPtr) 738 __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info, 739 vendorcode, 1); 740 if (proc != NULL) { 741 (*proc)(cl, (GLbyte*)req); 742 return Success; 743 } 744 745 cl->client->errorValue = req->vendorCode; 746 return __glXError(GLXUnsupportedPrivateRequest); 747} 748 749 750int __glXDispSwap_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) 751{ 752 xGLXVendorPrivateWithReplyReq *req; 753 GLint vendorcode; 754 __GLXdispatchVendorPrivProcPtr proc; 755 756 __GLX_DECLARE_SWAP_VARIABLES; 757 758 req = (xGLXVendorPrivateWithReplyReq *) pc; 759 __GLX_SWAP_SHORT(&req->length); 760 __GLX_SWAP_INT(&req->vendorCode); 761 762 vendorcode = req->vendorCode; 763 764 proc = (__GLXdispatchVendorPrivProcPtr) 765 __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info, 766 vendorcode, 1); 767 if (proc != NULL) { 768 return (*proc)(cl, (GLbyte*)req); 769 } 770 771 cl->client->errorValue = req->vendorCode; 772 return __glXError(GLXUnsupportedPrivateRequest); 773} 774