| 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 | #include "glxserver.h" |
| 32 | #include "glxutil.h" |
| 33 | #include <GL/glxtokens.h> |
| 34 | #include <g_disptab.h> |
| 35 | #include <pixmapstr.h> |
| 36 | #include <windowstr.h> |
| 37 | #include "unpack.h" |
| 38 | #include "glxcmds.h" |
| 39 | #include "glxext.h" |
| 40 | #include "glxvendor.h" |
| 41 | |
| 42 | extern int glxIsExtensionSupported(char *ext); |
| 43 | |
| 44 | int __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc); |
| 45 | |
| 46 | /************************************************************************/ |
| 47 | |
| 48 | /* |
| 49 | ** Byteswapping versions of GLX commands. In most cases they just swap |
| 50 | ** the incoming arguments and then call the unswapped routine. For commands |
| 51 | ** that have replies, a separate swapping routine for the reply is provided; |
| 52 | ** it is called at the end of the unswapped routine. |
| 53 | */ |
| 54 | |
| 55 | int |
| 56 | __glXSwapCreateContext(__GLXclientState * cl, GLbyte * pc) |
| 57 | { |
| 58 | xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; |
| 59 | |
| 60 | __GLX_DECLARE_SWAP_VARIABLES; |
| 61 | |
| 62 | __GLX_SWAP_SHORT(&req->length); |
| 63 | __GLX_SWAP_INT(&req->context); |
| 64 | __GLX_SWAP_INT(&req->visual); |
| 65 | __GLX_SWAP_INT(&req->screen); |
| 66 | __GLX_SWAP_INT(&req->shareList); |
| 67 | |
| 68 | return __glXCreateContext(cl, pc); |
| 69 | } |
| 70 | |
| 71 | int |
| 72 | __glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc) |
| 73 | { |
| 74 | xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; |
| 75 | |
| 76 | __GLX_DECLARE_SWAP_VARIABLES; |
| 77 | |
| 78 | __GLX_SWAP_SHORT(&req->length); |
| 79 | __GLX_SWAP_INT(&req->context); |
| 80 | __GLX_SWAP_INT(&req->fbconfig); |
| 81 | __GLX_SWAP_INT(&req->screen); |
| 82 | __GLX_SWAP_INT(&req->shareList); |
| 83 | |
| 84 | return __glXCreateNewContext(cl, pc); |
| 85 | } |
| 86 | |
| 87 | int |
| 88 | __glXSwapCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) |
| 89 | { |
| 90 | xGLXCreateContextWithConfigSGIXReq *req = |
| 91 | (xGLXCreateContextWithConfigSGIXReq *) pc; |
| 92 | __GLX_DECLARE_SWAP_VARIABLES; |
| 93 | |
| 94 | __GLX_SWAP_SHORT(&req->length); |
| 95 | __GLX_SWAP_INT(&req->context); |
| 96 | __GLX_SWAP_INT(&req->fbconfig); |
| 97 | __GLX_SWAP_INT(&req->screen); |
| 98 | __GLX_SWAP_INT(&req->shareList); |
| 99 | |
| 100 | return __glXCreateContextWithConfigSGIX(cl, pc); |
| 101 | } |
| 102 | |
| 103 | int |
| 104 | __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc) |
| 105 | { |
| 106 | xGLXQueryMaxSwapBarriersSGIXReq *req = |
| 107 | (xGLXQueryMaxSwapBarriersSGIXReq *) pc; |
| 108 | __GLX_DECLARE_SWAP_VARIABLES; |
| 109 | |
| 110 | __GLX_SWAP_SHORT(&req->length); |
| 111 | __GLX_SWAP_INT(&req->screen); |
| 112 | |
| 113 | return __glXQueryMaxSwapBarriersSGIX(cl, pc); |
| 114 | } |
| 115 | |
| 116 | int |
| 117 | __glXSwapBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc) |
| 118 | { |
| 119 | xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; |
| 120 | |
| 121 | __GLX_DECLARE_SWAP_VARIABLES; |
| 122 | |
| 123 | __GLX_SWAP_SHORT(&req->length); |
| 124 | __GLX_SWAP_INT(&req->drawable); |
| 125 | __GLX_SWAP_INT(&req->barrier); |
| 126 | |
| 127 | return __glXBindSwapBarrierSGIX(cl, pc); |
| 128 | } |
| 129 | |
| 130 | int |
| 131 | __glXSwapJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc) |
| 132 | { |
| 133 | xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc; |
| 134 | |
| 135 | __GLX_DECLARE_SWAP_VARIABLES; |
| 136 | |
| 137 | __GLX_SWAP_SHORT(&req->length); |
| 138 | __GLX_SWAP_INT(&req->drawable); |
| 139 | __GLX_SWAP_INT(&req->member); |
| 140 | |
| 141 | return __glXJoinSwapGroupSGIX(cl, pc); |
| 142 | } |
| 143 | |
| 144 | int |
| 145 | __glXSwapDestroyContext(__GLXclientState * cl, GLbyte * pc) |
| 146 | { |
| 147 | xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; |
| 148 | |
| 149 | __GLX_DECLARE_SWAP_VARIABLES; |
| 150 | |
| 151 | __GLX_SWAP_SHORT(&req->length); |
| 152 | __GLX_SWAP_INT(&req->context); |
| 153 | |
| 154 | return __glXDestroyContext(cl, pc); |
| 155 | } |
| 156 | |
| 157 | int |
| 158 | __glXSwapMakeCurrent(__GLXclientState * cl, GLbyte * pc) |
| 159 | { |
| 160 | xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; |
| 161 | |
| 162 | __GLX_DECLARE_SWAP_VARIABLES; |
| 163 | |
| 164 | __GLX_SWAP_SHORT(&req->length); |
| 165 | __GLX_SWAP_INT(&req->drawable); |
| 166 | __GLX_SWAP_INT(&req->context); |
| 167 | __GLX_SWAP_INT(&req->oldContextTag); |
| 168 | |
| 169 | return __glXMakeCurrent(cl, pc); |
| 170 | } |
| 171 | |
| 172 | int |
| 173 | __glXSwapMakeContextCurrent(__GLXclientState * cl, GLbyte * pc) |
| 174 | { |
| 175 | xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; |
| 176 | |
| 177 | __GLX_DECLARE_SWAP_VARIABLES; |
| 178 | |
| 179 | __GLX_SWAP_SHORT(&req->length); |
| 180 | __GLX_SWAP_INT(&req->drawable); |
| 181 | __GLX_SWAP_INT(&req->readdrawable); |
| 182 | __GLX_SWAP_INT(&req->context); |
| 183 | __GLX_SWAP_INT(&req->oldContextTag); |
| 184 | |
| 185 | return __glXMakeContextCurrent(cl, pc); |
| 186 | } |
| 187 | |
| 188 | int |
| 189 | __glXSwapMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc) |
| 190 | { |
| 191 | xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; |
| 192 | |
| 193 | __GLX_DECLARE_SWAP_VARIABLES; |
| 194 | |
| 195 | __GLX_SWAP_SHORT(&req->length); |
| 196 | __GLX_SWAP_INT(&req->drawable); |
| 197 | __GLX_SWAP_INT(&req->readable); |
| 198 | __GLX_SWAP_INT(&req->context); |
| 199 | __GLX_SWAP_INT(&req->oldContextTag); |
| 200 | |
| 201 | return __glXMakeCurrentReadSGI(cl, pc); |
| 202 | } |
| 203 | |
| 204 | int |
| 205 | __glXSwapIsDirect(__GLXclientState * cl, GLbyte * pc) |
| 206 | { |
| 207 | xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; |
| 208 | |
| 209 | __GLX_DECLARE_SWAP_VARIABLES; |
| 210 | |
| 211 | __GLX_SWAP_SHORT(&req->length); |
| 212 | __GLX_SWAP_INT(&req->context); |
| 213 | |
| 214 | return __glXIsDirect(cl, pc); |
| 215 | } |
| 216 | |
| 217 | int |
| 218 | __glXSwapQueryVersion(__GLXclientState * cl, GLbyte * pc) |
| 219 | { |
| 220 | xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; |
| 221 | |
| 222 | __GLX_DECLARE_SWAP_VARIABLES; |
| 223 | |
| 224 | __GLX_SWAP_SHORT(&req->length); |
| 225 | __GLX_SWAP_INT(&req->majorVersion); |
| 226 | __GLX_SWAP_INT(&req->minorVersion); |
| 227 | |
| 228 | return __glXQueryVersion(cl, pc); |
| 229 | } |
| 230 | |
| 231 | int |
| 232 | __glXSwapWaitGL(__GLXclientState * cl, GLbyte * pc) |
| 233 | { |
| 234 | xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; |
| 235 | |
| 236 | __GLX_DECLARE_SWAP_VARIABLES; |
| 237 | |
| 238 | __GLX_SWAP_SHORT(&req->length); |
| 239 | __GLX_SWAP_INT(&req->contextTag); |
| 240 | |
| 241 | return __glXWaitGL(cl, pc); |
| 242 | } |
| 243 | |
| 244 | int |
| 245 | __glXSwapWaitX(__GLXclientState * cl, GLbyte * pc) |
| 246 | { |
| 247 | xGLXWaitXReq *req = (xGLXWaitXReq *) pc; |
| 248 | |
| 249 | __GLX_DECLARE_SWAP_VARIABLES; |
| 250 | |
| 251 | __GLX_SWAP_SHORT(&req->length); |
| 252 | __GLX_SWAP_INT(&req->contextTag); |
| 253 | |
| 254 | return __glXWaitX(cl, pc); |
| 255 | } |
| 256 | |
| 257 | int |
| 258 | __glXSwapCopyContext(__GLXclientState * cl, GLbyte * pc) |
| 259 | { |
| 260 | xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; |
| 261 | |
| 262 | __GLX_DECLARE_SWAP_VARIABLES; |
| 263 | |
| 264 | __GLX_SWAP_SHORT(&req->length); |
| 265 | __GLX_SWAP_INT(&req->source); |
| 266 | __GLX_SWAP_INT(&req->dest); |
| 267 | __GLX_SWAP_INT(&req->mask); |
| 268 | |
| 269 | return __glXCopyContext(cl, pc); |
| 270 | } |
| 271 | |
| 272 | int |
| 273 | __glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc) |
| 274 | { |
| 275 | ClientPtr client = cl->client; |
| 276 | xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; |
| 277 | xGLXGetVisualConfigsReply reply; |
| 278 | __GLXscreenInfo *pGlxScreen; |
| 279 | __GLXvisualConfig *pGlxVisual; |
| 280 | CARD32 buf[__GLX_TOTAL_CONFIG]; |
| 281 | unsigned int screen; |
| 282 | int i, p; |
| 283 | |
| 284 | __GLX_DECLARE_SWAP_VARIABLES; |
| 285 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 286 | |
| 287 | __GLX_SWAP_INT(&req->screen); |
| 288 | screen = req->screen; |
| 289 | if (screen >= screenInfo.numScreens) { |
| 290 | /* The client library must send a valid screen number. */ |
| 291 | client->errorValue = screen; |
| 292 | return BadValue; |
| 293 | } |
| 294 | pGlxScreen = &__glXActiveScreens[screen]; |
| 295 | |
| 296 | reply = (xGLXGetVisualConfigsReply) { |
| 297 | .type = X_Reply, |
| 298 | .sequenceNumber = client->sequence, |
| 299 | .length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * |
| 300 | __GLX_TOTAL_CONFIG) >> 2, |
| 301 | .numVisuals = pGlxScreen->numGLXVisuals, |
| 302 | .numProps = __GLX_TOTAL_CONFIG |
| 303 | }; |
| 304 | |
| 305 | __GLX_SWAP_SHORT(&reply.sequenceNumber); |
| 306 | __GLX_SWAP_INT(&reply.length); |
| 307 | __GLX_SWAP_INT(&reply.numVisuals); |
| 308 | __GLX_SWAP_INT(&reply.numProps); |
| 309 | WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); |
| 310 | |
| 311 | for (i = 0; i < pGlxScreen->numVisuals; i++) { |
| 312 | pGlxVisual = &pGlxScreen->pGlxVisual[i]; |
| 313 | if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) { |
| 314 | /* not a usable visual */ |
| 315 | continue; |
| 316 | } |
| 317 | p = 0; |
| 318 | buf[p++] = pGlxVisual->vid; |
| 319 | buf[p++] = pGlxVisual->class; |
| 320 | buf[p++] = pGlxVisual->rgba; |
| 321 | |
| 322 | buf[p++] = pGlxVisual->redSize; |
| 323 | buf[p++] = pGlxVisual->greenSize; |
| 324 | buf[p++] = pGlxVisual->blueSize; |
| 325 | buf[p++] = pGlxVisual->alphaSize; |
| 326 | buf[p++] = pGlxVisual->accumRedSize; |
| 327 | buf[p++] = pGlxVisual->accumGreenSize; |
| 328 | buf[p++] = pGlxVisual->accumBlueSize; |
| 329 | buf[p++] = pGlxVisual->accumAlphaSize; |
| 330 | |
| 331 | buf[p++] = pGlxVisual->doubleBuffer; |
| 332 | buf[p++] = pGlxVisual->stereo; |
| 333 | |
| 334 | buf[p++] = pGlxVisual->bufferSize; |
| 335 | buf[p++] = pGlxVisual->depthSize; |
| 336 | buf[p++] = pGlxVisual->stencilSize; |
| 337 | buf[p++] = pGlxVisual->auxBuffers; |
| 338 | buf[p++] = pGlxVisual->level; |
| 339 | /* |
| 340 | ** Add token/value pairs for extensions. |
| 341 | */ |
| 342 | buf[p++] = GLX_VISUAL_CAVEAT_EXT; |
| 343 | buf[p++] = pGlxVisual->visualRating; |
| 344 | buf[p++] = GLX_TRANSPARENT_TYPE_EXT; |
| 345 | buf[p++] = pGlxVisual->transparentPixel; |
| 346 | buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; |
| 347 | buf[p++] = pGlxVisual->transparentRed; |
| 348 | buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; |
| 349 | buf[p++] = pGlxVisual->transparentGreen; |
| 350 | buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; |
| 351 | buf[p++] = pGlxVisual->transparentBlue; |
| 352 | buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; |
| 353 | buf[p++] = pGlxVisual->transparentAlpha; |
| 354 | buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; |
| 355 | buf[p++] = pGlxVisual->transparentIndex; |
| 356 | |
| 357 | __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); |
| 358 | WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, buf); |
| 359 | } |
| 360 | return Success; |
| 361 | } |
| 362 | |
| 363 | int |
| 364 | __glXSwapCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc) |
| 365 | { |
| 366 | xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; |
| 367 | |
| 368 | __GLX_DECLARE_SWAP_VARIABLES; |
| 369 | |
| 370 | __GLX_SWAP_SHORT(&req->length); |
| 371 | __GLX_SWAP_INT(&req->screen); |
| 372 | __GLX_SWAP_INT(&req->visual); |
| 373 | __GLX_SWAP_INT(&req->pixmap); |
| 374 | __GLX_SWAP_INT(&req->glxpixmap); |
| 375 | |
| 376 | return __glXCreateGLXPixmap(cl, pc); |
| 377 | } |
| 378 | |
| 379 | int |
| 380 | __glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc) |
| 381 | { |
| 382 | xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; |
| 383 | |
| 384 | __GLX_DECLARE_SWAP_VARIABLES; |
| 385 | |
| 386 | __GLX_SWAP_SHORT(&req->length); |
| 387 | __GLX_SWAP_INT(&req->screen); |
| 388 | __GLX_SWAP_INT(&req->fbconfig); |
| 389 | __GLX_SWAP_INT(&req->pixmap); |
| 390 | __GLX_SWAP_INT(&req->glxpixmap); |
| 391 | __GLX_SWAP_INT(&req->numAttribs); |
| 392 | |
| 393 | return __glXCreatePixmap(cl, pc); |
| 394 | } |
| 395 | |
| 396 | int |
| 397 | __glXSwapDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) |
| 398 | { |
| 399 | xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; |
| 400 | |
| 401 | __GLX_DECLARE_SWAP_VARIABLES; |
| 402 | |
| 403 | __GLX_SWAP_SHORT(&req->length); |
| 404 | __GLX_SWAP_INT(&req->glxpixmap); |
| 405 | |
| 406 | return __glXDestroyGLXPixmap(cl, pc); |
| 407 | } |
| 408 | |
| 409 | int |
| 410 | __glXSwapSwapBuffers(__GLXclientState * cl, GLbyte * pc) |
| 411 | { |
| 412 | xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; |
| 413 | |
| 414 | __GLX_DECLARE_SWAP_VARIABLES; |
| 415 | |
| 416 | __GLX_SWAP_SHORT(&req->length); |
| 417 | __GLX_SWAP_INT(&req->contextTag); |
| 418 | __GLX_SWAP_INT(&req->drawable); |
| 419 | |
| 420 | return __glXSwapBuffers(cl, pc); |
| 421 | } |
| 422 | |
| 423 | int |
| 424 | __glXSwapUseXFont(__GLXclientState * cl, GLbyte * pc) |
| 425 | { |
| 426 | xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; |
| 427 | |
| 428 | __GLX_DECLARE_SWAP_VARIABLES; |
| 429 | |
| 430 | __GLX_SWAP_SHORT(&req->length); |
| 431 | __GLX_SWAP_INT(&req->contextTag); |
| 432 | __GLX_SWAP_INT(&req->font); |
| 433 | __GLX_SWAP_INT(&req->first); |
| 434 | __GLX_SWAP_INT(&req->count); |
| 435 | __GLX_SWAP_INT(&req->listBase); |
| 436 | |
| 437 | return __glXUseXFont(cl, pc); |
| 438 | } |
| 439 | |
| 440 | int |
| 441 | __glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc) |
| 442 | { |
| 443 | xGLXQueryExtensionsStringReq *req = NULL; |
| 444 | |
| 445 | __GLX_DECLARE_SWAP_VARIABLES; |
| 446 | |
| 447 | __GLX_SWAP_SHORT(&req->length); |
| 448 | __GLX_SWAP_INT(&req->screen); |
| 449 | |
| 450 | return __glXQueryExtensionsString(cl, pc); |
| 451 | } |
| 452 | |
| 453 | int |
| 454 | __glXSwapQueryServerString(__GLXclientState * cl, GLbyte * pc) |
| 455 | { |
| 456 | xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; |
| 457 | |
| 458 | __GLX_DECLARE_SWAP_VARIABLES; |
| 459 | |
| 460 | __GLX_SWAP_SHORT(&req->length); |
| 461 | __GLX_SWAP_INT(&req->screen); |
| 462 | __GLX_SWAP_INT(&req->name); |
| 463 | |
| 464 | return __glXQueryServerString(cl, pc); |
| 465 | } |
| 466 | |
| 467 | int |
| 468 | __glXSwapClientInfo(__GLXclientState * cl, GLbyte * pc) |
| 469 | { |
| 470 | xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; |
| 471 | |
| 472 | __GLX_DECLARE_SWAP_VARIABLES; |
| 473 | |
| 474 | __GLX_SWAP_SHORT(&req->length); |
| 475 | __GLX_SWAP_INT(&req->major); |
| 476 | __GLX_SWAP_INT(&req->minor); |
| 477 | __GLX_SWAP_INT(&req->numbytes); |
| 478 | |
| 479 | return __glXClientInfo(cl, pc); |
| 480 | } |
| 481 | |
| 482 | int |
| 483 | __glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc) |
| 484 | { |
| 485 | xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; |
| 486 | |
| 487 | __GLX_DECLARE_SWAP_VARIABLES; |
| 488 | |
| 489 | __GLX_SWAP_SHORT(&req->length); |
| 490 | __GLX_SWAP_INT(&req->context); |
| 491 | |
| 492 | return __glXQueryContextInfoEXT(cl, (GLbyte *) pc); |
| 493 | } |
| 494 | |
| 495 | /************************************************************************/ |
| 496 | |
| 497 | /* |
| 498 | ** Swap replies. |
| 499 | */ |
| 500 | |
| 501 | void |
| 502 | __glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply * reply) |
| 503 | { |
| 504 | __GLX_DECLARE_SWAP_VARIABLES; |
| 505 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 506 | __GLX_SWAP_INT(&reply->length); |
| 507 | __GLX_SWAP_INT(&reply->contextTag); |
| 508 | __GLX_SWAP_INT(&reply->writeVid); |
| 509 | __GLX_SWAP_INT(&reply->writeType); |
| 510 | __GLX_SWAP_INT(&reply->readVid); |
| 511 | __GLX_SWAP_INT(&reply->readType); |
| 512 | WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, reply); |
| 513 | } |
| 514 | |
| 515 | void |
| 516 | __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply) |
| 517 | { |
| 518 | __GLX_DECLARE_SWAP_VARIABLES; |
| 519 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 520 | __GLX_SWAP_INT(&reply->length); |
| 521 | WriteToClient(client, sz_xGLXIsDirectReply, reply); |
| 522 | } |
| 523 | |
| 524 | void |
| 525 | __glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply) |
| 526 | { |
| 527 | __GLX_DECLARE_SWAP_VARIABLES; |
| 528 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 529 | __GLX_SWAP_INT(&reply->length); |
| 530 | __GLX_SWAP_INT(&reply->majorVersion); |
| 531 | __GLX_SWAP_INT(&reply->minorVersion); |
| 532 | WriteToClient(client, sz_xGLXQueryVersionReply, reply); |
| 533 | } |
| 534 | |
| 535 | void |
| 536 | glxSwapQueryExtensionsStringReply(ClientPtr client, |
| 537 | xGLXQueryExtensionsStringReply * reply, |
| 538 | char *buf) |
| 539 | { |
| 540 | int length = reply->length; |
| 541 | |
| 542 | __GLX_DECLARE_SWAP_VARIABLES; |
| 543 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 544 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 545 | __GLX_SWAP_INT(&reply->length); |
| 546 | __GLX_SWAP_INT(&reply->n); |
| 547 | WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply); |
| 548 | __GLX_SWAP_INT_ARRAY((int *) buf, length); |
| 549 | WriteToClient(client, length << 2, buf); |
| 550 | } |
| 551 | |
| 552 | void |
| 553 | glxSwapQueryServerStringReply(ClientPtr client, |
| 554 | xGLXQueryServerStringReply * reply, char *buf) |
| 555 | { |
| 556 | int length = reply->length; |
| 557 | |
| 558 | __GLX_DECLARE_SWAP_VARIABLES; |
| 559 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 560 | __GLX_SWAP_INT(&reply->length); |
| 561 | __GLX_SWAP_INT(&reply->n); |
| 562 | WriteToClient(client, sz_xGLXQueryServerStringReply, reply); |
| 563 | /** no swap is needed for an array of chars **/ |
| 564 | /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ |
| 565 | WriteToClient(client, length << 2, buf); |
| 566 | } |
| 567 | |
| 568 | void |
| 569 | __glXSwapQueryContextInfoEXTReply(ClientPtr client, |
| 570 | xGLXQueryContextInfoEXTReply * reply, |
| 571 | int *buf) |
| 572 | { |
| 573 | int length = reply->length; |
| 574 | |
| 575 | __GLX_DECLARE_SWAP_VARIABLES; |
| 576 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 577 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 578 | __GLX_SWAP_INT(&reply->length); |
| 579 | __GLX_SWAP_INT(&reply->n); |
| 580 | WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply); |
| 581 | __GLX_SWAP_INT_ARRAY((int *) buf, length); |
| 582 | WriteToClient(client, length << 2, buf); |
| 583 | } |
| 584 | |
| 585 | void |
| 586 | __glXSwapQueryContextReply(ClientPtr client, |
| 587 | xGLXQueryContextReply * reply, int *buf) |
| 588 | { |
| 589 | int length = reply->length; |
| 590 | |
| 591 | __GLX_DECLARE_SWAP_VARIABLES; |
| 592 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 593 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 594 | __GLX_SWAP_INT(&reply->length); |
| 595 | __GLX_SWAP_INT(&reply->n); |
| 596 | WriteToClient(client, sz_xGLXQueryContextReply, reply); |
| 597 | __GLX_SWAP_INT_ARRAY((int *) buf, length); |
| 598 | WriteToClient(client, length << 2, buf); |
| 599 | } |
| 600 | |
| 601 | void |
| 602 | __glXSwapGetDrawableAttributesReply(ClientPtr client, |
| 603 | xGLXGetDrawableAttributesReply * reply, |
| 604 | int *buf) |
| 605 | { |
| 606 | __GLX_DECLARE_SWAP_VARIABLES; |
| 607 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 608 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 609 | __GLX_SWAP_INT(&reply->length); |
| 610 | __GLX_SWAP_INT(&reply->numAttribs); |
| 611 | __GLX_SWAP_INT_ARRAY(buf, reply->length); |
| 612 | WriteToClient(client, sz_xGLXGetDrawableAttributesReply, reply); |
| 613 | WriteToClient(client, reply->length << 2, buf); |
| 614 | } |
| 615 | |
| 616 | void |
| 617 | __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, |
| 618 | xGLXQueryMaxSwapBarriersSGIXReply * |
| 619 | reply) |
| 620 | { |
| 621 | __GLX_DECLARE_SWAP_VARIABLES; |
| 622 | __GLX_SWAP_SHORT(&reply->sequenceNumber); |
| 623 | __GLX_SWAP_INT(&reply->length); |
| 624 | __GLX_SWAP_INT(&reply->max); |
| 625 | WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, reply); |
| 626 | } |
| 627 | |
| 628 | /************************************************************************/ |
| 629 | |
| 630 | /* |
| 631 | ** Render and Renderlarge are not in the GLX API. They are used by the GLX |
| 632 | ** client library to send batches of GL rendering commands. |
| 633 | */ |
| 634 | |
| 635 | int |
| 636 | __glXSwapRender(__GLXclientState * cl, GLbyte * pc) |
| 637 | { |
| 638 | xGLXRenderReq *req; |
| 639 | int left; |
| 640 | __GLXrenderHeader *hdr; |
| 641 | ClientPtr client = cl->client; |
| 642 | |
| 643 | __GLX_DECLARE_SWAP_VARIABLES; |
| 644 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 645 | |
| 646 | /* |
| 647 | ** NOTE: much of this code also appears in the nonswapping version of this |
| 648 | ** routine, __glXRender(). Any changes made here should also be |
| 649 | ** duplicated there. |
| 650 | */ |
| 651 | |
| 652 | req = (xGLXRenderReq *) pc; |
| 653 | __GLX_SWAP_SHORT(&req->length); |
| 654 | __GLX_SWAP_INT(&req->contextTag); |
| 655 | |
| 656 | pc += sz_xGLXRenderReq; |
| 657 | left = (req->length << 2) - sz_xGLXRenderReq; |
| 658 | while (left > 0) { |
| 659 | void (*proc) (GLbyte *); |
| 660 | CARD16 opcode; |
| 661 | |
| 662 | /* |
| 663 | ** Verify that the header length and the overall length agree. |
| 664 | ** Also, each command must be word aligned. |
| 665 | */ |
| 666 | hdr = (__GLXrenderHeader *) pc; |
| 667 | __GLX_SWAP_SHORT(&hdr->length); |
| 668 | __GLX_SWAP_SHORT(&hdr->opcode); |
| 669 | |
| 670 | /* |
| 671 | * call the command procedure to swap any arguments |
| 672 | */ |
| 673 | opcode = hdr->opcode; |
| 674 | if ((opcode >= __GLX_MIN_RENDER_OPCODE) && |
| 675 | (opcode <= __GLX_MAX_RENDER_OPCODE)) { |
| 676 | proc = __glXSwapRenderTable[opcode]; |
| 677 | #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT |
| 678 | } |
| 679 | else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && |
| 680 | (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) { |
| 681 | int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; |
| 682 | __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index]; |
| 683 | |
| 684 | if (info->swapfunc) { |
| 685 | proc = info->swapfunc; |
| 686 | } |
| 687 | else { |
| 688 | proc = NULL; |
| 689 | if (info->elem_size == 4 && info->nelems > 0) { |
| 690 | __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_HDR_SIZE), |
| 691 | info->nelems); |
| 692 | } |
| 693 | else if (info->elem_size == 2 && info->nelems > 0) { |
| 694 | __GLX_SWAP_SHORT_ARRAY((short *) (pc + |
| 695 | __GLX_RENDER_HDR_SIZE), |
| 696 | info->nelems); |
| 697 | } |
| 698 | else if (info->elem_size == 8 && info->nelems > 0) { |
| 699 | __GLX_SWAP_DOUBLE_ARRAY((double *) (pc + |
| 700 | __GLX_RENDER_HDR_SIZE), |
| 701 | info->nelems); |
| 702 | } |
| 703 | } |
| 704 | #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ |
| 705 | } |
| 706 | else { |
| 707 | client->errorValue = 0; |
| 708 | return __glXBadRenderRequest; |
| 709 | } |
| 710 | |
| 711 | if (proc != NULL) |
| 712 | (*proc) (pc + __GLX_RENDER_HDR_SIZE); |
| 713 | |
| 714 | /* |
| 715 | * proceed to the next command |
| 716 | */ |
| 717 | pc += hdr->length; |
| 718 | left -= hdr->length; |
| 719 | } |
| 720 | |
| 721 | return __glXRender(cl, (GLbyte *) req); |
| 722 | } |
| 723 | |
| 724 | /* |
| 725 | ** Execute a large rendering request (one that spans multiple X requests). |
| 726 | */ |
| 727 | int |
| 728 | __glXSwapRenderLarge(__GLXclientState * cl, GLbyte * pc) |
| 729 | { |
| 730 | ClientPtr client = cl->client; |
| 731 | xGLXRenderLargeReq *req; |
| 732 | __GLXrenderLargeHeader *hdr; |
| 733 | |
| 734 | __GLX_DECLARE_SWAP_VARIABLES; |
| 735 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 736 | |
| 737 | req = (xGLXRenderLargeReq *) pc; |
| 738 | __GLX_SWAP_SHORT(&req->length); |
| 739 | __GLX_SWAP_INT(&req->contextTag); |
| 740 | __GLX_SWAP_INT(&req->dataBytes); |
| 741 | __GLX_SWAP_SHORT(&req->requestNumber); |
| 742 | __GLX_SWAP_SHORT(&req->requestTotal); |
| 743 | |
| 744 | pc += sz_xGLXRenderLargeReq; |
| 745 | |
| 746 | if (req->requestNumber == 1) { |
| 747 | void (*proc) (GLbyte *) = NULL; |
| 748 | __GLXRenderSwapInfo *info = NULL; |
| 749 | CARD16 opcode; |
| 750 | |
| 751 | hdr = (__GLXrenderLargeHeader *) pc; |
| 752 | __GLX_SWAP_INT(&hdr->length); |
| 753 | __GLX_SWAP_INT(&hdr->opcode); |
| 754 | |
| 755 | /* |
| 756 | * call the command procedure to swap any arguments |
| 757 | * Note that we are assuming that all arguments that needs to be |
| 758 | * swaped are on the first req only ! |
| 759 | */ |
| 760 | opcode = hdr->opcode; |
| 761 | if ((opcode >= __GLX_MIN_RENDER_OPCODE) && |
| 762 | (opcode <= __GLX_MAX_RENDER_OPCODE)) { |
| 763 | proc = __glXSwapRenderTable[opcode]; |
| 764 | #if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT |
| 765 | } |
| 766 | else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && |
| 767 | (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) { |
| 768 | int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; |
| 769 | |
| 770 | info = &__glXSwapRenderTable_EXT[index]; |
| 771 | if (info->swapfunc) { |
| 772 | proc = info->swapfunc; |
| 773 | } |
| 774 | #endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ |
| 775 | } |
| 776 | else { |
| 777 | client->errorValue = 0; |
| 778 | cl->largeCmdRequestsTotal = 0; |
| 779 | return __glXBadLargeRequest; |
| 780 | } |
| 781 | |
| 782 | /* |
| 783 | ** Make enough space in the buffer, then copy the entire request. |
| 784 | */ |
| 785 | if (cl->largeCmdBufSize < hdr->length) { |
| 786 | if (!cl->largeCmdBuf) { |
| 787 | cl->largeCmdBuf = (GLbyte *) malloc(hdr->length); |
| 788 | } |
| 789 | else { |
| 790 | cl->largeCmdBuf = |
| 791 | (GLbyte *) realloc(cl->largeCmdBuf, hdr->length); |
| 792 | } |
| 793 | if (!cl->largeCmdBuf) { |
| 794 | cl->largeCmdRequestsTotal = 0; |
| 795 | return BadAlloc; |
| 796 | } |
| 797 | cl->largeCmdBufSize = hdr->length; |
| 798 | } |
| 799 | memcpy(cl->largeCmdBuf, pc, req->dataBytes); |
| 800 | |
| 801 | cl->largeCmdBytesSoFar = req->dataBytes; |
| 802 | cl->largeCmdBytesTotal = hdr->length; |
| 803 | cl->largeCmdRequestsSoFar = 1; |
| 804 | cl->largeCmdRequestsTotal = req->requestTotal; |
| 805 | cl->largeCmdRequestsSwapProc = proc; |
| 806 | cl->largeCmdMaxReqDataSize = req->dataBytes; |
| 807 | cl->largeCmdRequestsSwap_info = info; |
| 808 | |
| 809 | return Success; |
| 810 | |
| 811 | } |
| 812 | else if (req->requestNumber < cl->largeCmdRequestsTotal) { |
| 813 | /* |
| 814 | * This is not the first nor last request - just copy the data |
| 815 | */ |
| 816 | if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { |
| 817 | cl->largeCmdRequestsTotal = 0; |
| 818 | return __glXBadLargeRequest; |
| 819 | } |
| 820 | |
| 821 | memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes); |
| 822 | |
| 823 | cl->largeCmdBytesSoFar += req->dataBytes; |
| 824 | |
| 825 | if (req->dataBytes > cl->largeCmdMaxReqDataSize) |
| 826 | cl->largeCmdMaxReqDataSize = req->dataBytes; |
| 827 | |
| 828 | return Success; |
| 829 | } |
| 830 | else if (req->requestNumber == cl->largeCmdRequestsTotal) { |
| 831 | /* |
| 832 | * this is the last request |
| 833 | * copy the remainder bytes, call the procedure to swap any |
| 834 | * needed data, and then call to transfer the command to all |
| 835 | * back-end servers |
| 836 | */ |
| 837 | if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { |
| 838 | cl->largeCmdRequestsTotal = 0; |
| 839 | return __glXBadLargeRequest; |
| 840 | } |
| 841 | |
| 842 | memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes); |
| 843 | |
| 844 | cl->largeCmdBytesSoFar += req->dataBytes; |
| 845 | |
| 846 | if (req->dataBytes > cl->largeCmdMaxReqDataSize) |
| 847 | cl->largeCmdMaxReqDataSize = req->dataBytes; |
| 848 | |
| 849 | if (cl->largeCmdRequestsSwapProc != NULL) { |
| 850 | (*cl->largeCmdRequestsSwapProc) (cl->largeCmdBuf + |
| 851 | __GLX_RENDER_LARGE_HDR_SIZE); |
| 852 | } |
| 853 | else if (cl->largeCmdRequestsSwap_info && |
| 854 | cl->largeCmdRequestsSwap_info->nelems > 0) { |
| 855 | if (cl->largeCmdRequestsSwap_info->elem_size == 4) { |
| 856 | __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_LARGE_HDR_SIZE), |
| 857 | cl->largeCmdRequestsSwap_info->nelems); |
| 858 | } |
| 859 | else if (cl->largeCmdRequestsSwap_info->elem_size == 2) { |
| 860 | __GLX_SWAP_SHORT_ARRAY((short *) (pc + |
| 861 | __GLX_RENDER_LARGE_HDR_SIZE), |
| 862 | cl->largeCmdRequestsSwap_info->nelems); |
| 863 | } |
| 864 | else if (cl->largeCmdRequestsSwap_info->elem_size == 8) { |
| 865 | __GLX_SWAP_DOUBLE_ARRAY((double *) (pc + |
| 866 | __GLX_RENDER_LARGE_HDR_SIZE), |
| 867 | cl->largeCmdRequestsSwap_info->nelems); |
| 868 | } |
| 869 | } |
| 870 | |
| 871 | cl->largeCmdRequestsTotal = 0; |
| 872 | return (__glXSendLargeCommand(cl, req->contextTag)); |
| 873 | |
| 874 | } |
| 875 | else { |
| 876 | cl->largeCmdRequestsTotal = 0; |
| 877 | return __glXBadLargeRequest; |
| 878 | } |
| 879 | |
| 880 | } |
| 881 | |
| 882 | /************************************************************************/ |
| 883 | |
| 884 | /* |
| 885 | ** No support is provided for the vendor-private requests other than |
| 886 | ** allocating these entry points in the dispatch table. |
| 887 | */ |
| 888 | |
| 889 | int |
| 890 | __glXSwapVendorPrivate(__GLXclientState * cl, GLbyte * pc) |
| 891 | { |
| 892 | xGLXVendorPrivateReq *req; |
| 893 | CARD32 vendorCode; |
| 894 | |
| 895 | __GLX_DECLARE_SWAP_VARIABLES; |
| 896 | |
| 897 | req = (xGLXVendorPrivateReq *) pc; |
| 898 | vendorCode = req->vendorCode; |
| 899 | __GLX_SWAP_INT(&vendorCode); |
| 900 | |
| 901 | switch (vendorCode) { |
| 902 | |
| 903 | case X_GLvop_DeleteTexturesEXT: |
| 904 | return __glXVForwardSingleReqSwap(cl, pc); |
| 905 | break; |
| 906 | |
| 907 | case X_GLXvop_SwapIntervalSGI: |
| 908 | if (glxIsExtensionSupported("SGI_swap_control")) { |
| 909 | return __glXVForwardSingleReqSwap(cl, pc); |
| 910 | } |
| 911 | else { |
| 912 | return Success; |
| 913 | } |
| 914 | break; |
| 915 | |
| 916 | #if 0 /* glx 1.3 */ |
| 917 | case X_GLXvop_CreateGLXVideoSourceSGIX: |
| 918 | break; |
| 919 | case X_GLXvop_DestroyGLXVideoSourceSGIX: |
| 920 | break; |
| 921 | case X_GLXvop_CreateGLXPixmapWithConfigSGIX: |
| 922 | break; |
| 923 | case X_GLXvop_DestroyGLXPbufferSGIX: |
| 924 | break; |
| 925 | case X_GLXvop_ChangeDrawableAttributesSGIX: |
| 926 | break; |
| 927 | #endif |
| 928 | |
| 929 | case X_GLXvop_JoinSwapGroupSGIX: |
| 930 | return __glXSwapJoinSwapGroupSGIX(cl, pc); |
| 931 | break; |
| 932 | |
| 933 | case X_GLXvop_BindSwapBarrierSGIX: |
| 934 | return __glXSwapBindSwapBarrierSGIX(cl, pc); |
| 935 | break; |
| 936 | |
| 937 | case X_GLXvop_CreateContextWithConfigSGIX: |
| 938 | return __glXSwapCreateContextWithConfigSGIX(cl, pc); |
| 939 | break; |
| 940 | |
| 941 | default: |
| 942 | /* |
| 943 | ** unsupported private request |
| 944 | */ |
| 945 | cl->client->errorValue = req->vendorCode; |
| 946 | return __glXUnsupportedPrivateRequest; |
| 947 | } |
| 948 | |
| 949 | } |
| 950 | |
| 951 | int |
| 952 | __glXSwapVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) |
| 953 | { |
| 954 | xGLXVendorPrivateWithReplyReq *req; |
| 955 | CARD32 vendorCode; |
| 956 | |
| 957 | __GLX_DECLARE_SWAP_VARIABLES; |
| 958 | |
| 959 | req = (xGLXVendorPrivateWithReplyReq *) pc; |
| 960 | vendorCode = req->vendorCode; |
| 961 | __GLX_SWAP_INT(&vendorCode); |
| 962 | |
| 963 | switch (vendorCode) { |
| 964 | |
| 965 | case X_GLvop_GetConvolutionFilterEXT: |
| 966 | case X_GLvop_GetSeparableFilterEXT: |
| 967 | case X_GLvop_GetHistogramEXT: |
| 968 | case X_GLvop_GetMinmaxEXT: |
| 969 | return (__glXNoSuchSingleOpcode(cl, pc)); |
| 970 | break; |
| 971 | |
| 972 | case X_GLvop_GetConvolutionParameterfvEXT: |
| 973 | case X_GLvop_GetConvolutionParameterivEXT: |
| 974 | case X_GLvop_GetHistogramParameterivEXT: |
| 975 | case X_GLvop_GetMinmaxParameterfvEXT: |
| 976 | case X_GLvop_GetMinmaxParameterivEXT: |
| 977 | case X_GLvop_GenTexturesEXT: |
| 978 | return (__glXVForwardAllWithReplySwapiv(cl, pc)); |
| 979 | break; |
| 980 | |
| 981 | case X_GLvop_AreTexturesResidentEXT: |
| 982 | case X_GLvop_IsTextureEXT: |
| 983 | return (__glXVForwardPipe0WithReplySwap(cl, pc)); |
| 984 | break; |
| 985 | |
| 986 | #if 0 /* glx1.3 */ |
| 987 | case X_GLvop_GetDetailTexFuncSGIS: |
| 988 | case X_GLvop_GetSharpenTexFuncSGIS: |
| 989 | case X_GLvop_GetColorTableSGI: |
| 990 | case X_GLvop_GetColorTableParameterfvSGI: |
| 991 | case X_GLvop_GetColorTableParameterivSGI: |
| 992 | case X_GLvop_GetTexFilterFuncSGIS: |
| 993 | case X_GLvop_GetInstrumentsSGIX: |
| 994 | case X_GLvop_InstrumentsBufferSGIX: |
| 995 | case X_GLvop_PollInstrumentsSGIX: |
| 996 | case X_GLvop_FlushRasterSGIX: |
| 997 | case X_GLXvop_CreateGLXPbufferSGIX: |
| 998 | case X_GLXvop_GetDrawableAttributesSGIX: |
| 999 | case X_GLXvop_QueryHyperpipeNetworkSGIX: |
| 1000 | case X_GLXvop_QueryHyperpipeConfigSGIX: |
| 1001 | case X_GLXvop_HyperpipeConfigSGIX: |
| 1002 | case X_GLXvop_DestroyHyperpipeConfigSGIX: |
| 1003 | #endif |
| 1004 | case X_GLXvop_QueryMaxSwapBarriersSGIX: |
| 1005 | return (__glXSwapQueryMaxSwapBarriersSGIX(cl, pc)); |
| 1006 | break; |
| 1007 | |
| 1008 | case X_GLXvop_GetFBConfigsSGIX: |
| 1009 | return (__glXSwapGetFBConfigsSGIX(cl, pc)); |
| 1010 | break; |
| 1011 | |
| 1012 | case X_GLXvop_MakeCurrentReadSGI: |
| 1013 | return (__glXSwapMakeCurrentReadSGI(cl, pc)); |
| 1014 | break; |
| 1015 | |
| 1016 | case X_GLXvop_QueryContextInfoEXT: |
| 1017 | return (__glXSwapQueryContextInfoEXT(cl, (char *) pc)); |
| 1018 | break; |
| 1019 | |
| 1020 | default: |
| 1021 | /* |
| 1022 | ** unsupported private request |
| 1023 | */ |
| 1024 | cl->client->errorValue = req->vendorCode; |
| 1025 | return __glXUnsupportedPrivateRequest; |
| 1026 | } |
| 1027 | |
| 1028 | } |
| 1029 | |
| 1030 | int |
| 1031 | __glXSwapGetFBConfigs(__GLXclientState * cl, GLbyte * pc) |
| 1032 | { |
| 1033 | xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; |
| 1034 | |
| 1035 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1036 | |
| 1037 | __GLX_SWAP_SHORT(&req->length); |
| 1038 | __GLX_SWAP_INT(&req->screen); |
| 1039 | |
| 1040 | return __glXGetFBConfigs(cl, pc); |
| 1041 | } |
| 1042 | |
| 1043 | int |
| 1044 | __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc) |
| 1045 | { |
| 1046 | xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; |
| 1047 | xGLXGetFBConfigsReq new_req; |
| 1048 | |
| 1049 | new_req.reqType = req->reqType; |
| 1050 | new_req.glxCode = req->glxCode; |
| 1051 | new_req.length = req->length; |
| 1052 | new_req.screen = req->screen; |
| 1053 | |
| 1054 | return (__glXSwapGetFBConfigs(cl, (GLbyte *) &new_req)); |
| 1055 | } |
| 1056 | |
| 1057 | int |
| 1058 | __glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc) |
| 1059 | { |
| 1060 | xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; |
| 1061 | |
| 1062 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1063 | |
| 1064 | __GLX_SWAP_SHORT(&req->length); |
| 1065 | __GLX_SWAP_INT(&req->screen); |
| 1066 | __GLX_SWAP_INT(&req->fbconfig); |
| 1067 | __GLX_SWAP_INT(&req->window); |
| 1068 | __GLX_SWAP_INT(&req->glxwindow); |
| 1069 | __GLX_SWAP_INT(&req->numAttribs); |
| 1070 | |
| 1071 | return (__glXCreateWindow(cl, (GLbyte *) pc)); |
| 1072 | } |
| 1073 | |
| 1074 | int |
| 1075 | __glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc) |
| 1076 | { |
| 1077 | xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; |
| 1078 | |
| 1079 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1080 | |
| 1081 | __GLX_SWAP_SHORT(&req->length); |
| 1082 | __GLX_SWAP_INT(&req->glxwindow); |
| 1083 | |
| 1084 | return (__glXDestroyWindow(cl, (GLbyte *) pc)); |
| 1085 | } |
| 1086 | |
| 1087 | int |
| 1088 | __glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc) |
| 1089 | { |
| 1090 | xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; |
| 1091 | |
| 1092 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1093 | |
| 1094 | __GLX_SWAP_SHORT(&req->length); |
| 1095 | __GLX_SWAP_INT(&req->context); |
| 1096 | |
| 1097 | return (__glXQueryContext(cl, (GLbyte *) pc)); |
| 1098 | |
| 1099 | } |
| 1100 | |
| 1101 | int |
| 1102 | __glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc) |
| 1103 | { |
| 1104 | xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; |
| 1105 | int nattr = req->numAttribs; |
| 1106 | |
| 1107 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1108 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 1109 | |
| 1110 | __GLX_SWAP_SHORT(&req->length); |
| 1111 | __GLX_SWAP_INT(&req->screen); |
| 1112 | __GLX_SWAP_INT(&req->fbconfig); |
| 1113 | __GLX_SWAP_INT(&req->pbuffer); |
| 1114 | __GLX_SWAP_INT(&req->numAttribs); |
| 1115 | __GLX_SWAP_INT_ARRAY((int *) (req + 1), nattr * 2); |
| 1116 | |
| 1117 | return (__glXCreatePbuffer(cl, pc)); |
| 1118 | } |
| 1119 | |
| 1120 | int |
| 1121 | __glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc) |
| 1122 | { |
| 1123 | xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; |
| 1124 | |
| 1125 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1126 | |
| 1127 | __GLX_SWAP_SHORT(&req->length); |
| 1128 | __GLX_SWAP_INT(&req->pbuffer); |
| 1129 | |
| 1130 | return (__glXDestroyPbuffer(cl, (GLbyte *) pc)); |
| 1131 | } |
| 1132 | |
| 1133 | int |
| 1134 | __glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) |
| 1135 | { |
| 1136 | xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc; |
| 1137 | |
| 1138 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1139 | |
| 1140 | __GLX_SWAP_SHORT(&req->length); |
| 1141 | __GLX_SWAP_INT(&req->drawable); |
| 1142 | |
| 1143 | return (__glXGetDrawableAttributes(cl, pc)); |
| 1144 | } |
| 1145 | |
| 1146 | int |
| 1147 | __glXSwapChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) |
| 1148 | { |
| 1149 | xGLXChangeDrawableAttributesReq *req = |
| 1150 | (xGLXChangeDrawableAttributesReq *) pc; |
| 1151 | __GLX_DECLARE_SWAP_VARIABLES; |
| 1152 | __GLX_DECLARE_SWAP_ARRAY_VARIABLES; |
| 1153 | |
| 1154 | __GLX_SWAP_SHORT(&req->length); |
| 1155 | __GLX_SWAP_INT(&req->drawable); |
| 1156 | __GLX_SWAP_INT(&req->numAttribs); |
| 1157 | __GLX_SWAP_INT_ARRAY((int *) (req + 1), req->numAttribs * 2); |
| 1158 | |
| 1159 | return (__glXChangeDrawableAttributes(cl, pc)); |
| 1160 | } |