vnd_dispatch_stubs.c revision 1b5d61b8
1 2#include <dix-config.h> 3#include <dix.h> 4#include "vndserver.h" 5 6// HACK: The opcode in old glxproto.h has a typo in it. 7#if !defined(X_GLXCreateContextAttribsARB) 8#define X_GLXCreateContextAttribsARB X_GLXCreateContextAtrribsARB 9#endif 10 11static int dispatch_Render(ClientPtr client) 12{ 13 REQUEST(xGLXRenderReq); 14 CARD32 contextTag; 15 GlxServerVendor *vendor = NULL; 16 REQUEST_AT_LEAST_SIZE(*stuff); 17 contextTag = GlxCheckSwap(client, stuff->contextTag); 18 vendor = glxServer.getContextTag(client, contextTag); 19 if (vendor != NULL) { 20 int ret; 21 ret = glxServer.forwardRequest(vendor, client); 22 return ret; 23 } else { 24 client->errorValue = contextTag; 25 return GlxErrorBase + GLXBadContextTag; 26 } 27} 28static int dispatch_RenderLarge(ClientPtr client) 29{ 30 REQUEST(xGLXRenderLargeReq); 31 CARD32 contextTag; 32 GlxServerVendor *vendor = NULL; 33 REQUEST_AT_LEAST_SIZE(*stuff); 34 contextTag = GlxCheckSwap(client, stuff->contextTag); 35 vendor = glxServer.getContextTag(client, contextTag); 36 if (vendor != NULL) { 37 int ret; 38 ret = glxServer.forwardRequest(vendor, client); 39 return ret; 40 } else { 41 client->errorValue = contextTag; 42 return GlxErrorBase + GLXBadContextTag; 43 } 44} 45static int dispatch_CreateContext(ClientPtr client) 46{ 47 REQUEST(xGLXCreateContextReq); 48 CARD32 screen, context; 49 GlxServerVendor *vendor = NULL; 50 REQUEST_SIZE_MATCH(*stuff); 51 screen = GlxCheckSwap(client, stuff->screen); 52 context = GlxCheckSwap(client, stuff->context); 53 LEGAL_NEW_RESOURCE(context, client); 54 if (screen < screenInfo.numScreens) { 55 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 56 } 57 if (vendor != NULL) { 58 int ret; 59 if (!glxServer.addXIDMap(context, vendor)) { 60 return BadAlloc; 61 } 62 ret = glxServer.forwardRequest(vendor, client); 63 if (ret != Success) { 64 glxServer.removeXIDMap(context); 65 } 66 return ret; 67 } else { 68 client->errorValue = screen; 69 return BadMatch; 70 } 71} 72static int dispatch_DestroyContext(ClientPtr client) 73{ 74 REQUEST(xGLXDestroyContextReq); 75 CARD32 context; 76 GlxServerVendor *vendor = NULL; 77 REQUEST_SIZE_MATCH(*stuff); 78 context = GlxCheckSwap(client, stuff->context); 79 vendor = glxServer.getXIDMap(context); 80 if (vendor != NULL) { 81 int ret; 82 ret = glxServer.forwardRequest(vendor, client); 83 if (ret == Success) { 84 glxServer.removeXIDMap(context); 85 } 86 return ret; 87 } else { 88 client->errorValue = context; 89 return GlxErrorBase + GLXBadContext; 90 } 91} 92static int dispatch_WaitGL(ClientPtr client) 93{ 94 REQUEST(xGLXWaitGLReq); 95 CARD32 contextTag; 96 GlxServerVendor *vendor = NULL; 97 REQUEST_SIZE_MATCH(*stuff); 98 contextTag = GlxCheckSwap(client, stuff->contextTag); 99 vendor = glxServer.getContextTag(client, contextTag); 100 if (vendor != NULL) { 101 int ret; 102 ret = glxServer.forwardRequest(vendor, client); 103 return ret; 104 } else { 105 client->errorValue = contextTag; 106 return GlxErrorBase + GLXBadContextTag; 107 } 108} 109static int dispatch_WaitX(ClientPtr client) 110{ 111 REQUEST(xGLXWaitXReq); 112 CARD32 contextTag; 113 GlxServerVendor *vendor = NULL; 114 REQUEST_SIZE_MATCH(*stuff); 115 contextTag = GlxCheckSwap(client, stuff->contextTag); 116 vendor = glxServer.getContextTag(client, contextTag); 117 if (vendor != NULL) { 118 int ret; 119 ret = glxServer.forwardRequest(vendor, client); 120 return ret; 121 } else { 122 client->errorValue = contextTag; 123 return GlxErrorBase + GLXBadContextTag; 124 } 125} 126static int dispatch_UseXFont(ClientPtr client) 127{ 128 REQUEST(xGLXUseXFontReq); 129 CARD32 contextTag; 130 GlxServerVendor *vendor = NULL; 131 REQUEST_SIZE_MATCH(*stuff); 132 contextTag = GlxCheckSwap(client, stuff->contextTag); 133 vendor = glxServer.getContextTag(client, contextTag); 134 if (vendor != NULL) { 135 int ret; 136 ret = glxServer.forwardRequest(vendor, client); 137 return ret; 138 } else { 139 client->errorValue = contextTag; 140 return GlxErrorBase + GLXBadContextTag; 141 } 142} 143static int dispatch_CreateGLXPixmap(ClientPtr client) 144{ 145 REQUEST(xGLXCreateGLXPixmapReq); 146 CARD32 screen, glxpixmap; 147 GlxServerVendor *vendor = NULL; 148 REQUEST_SIZE_MATCH(*stuff); 149 screen = GlxCheckSwap(client, stuff->screen); 150 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 151 LEGAL_NEW_RESOURCE(glxpixmap, client); 152 if (screen < screenInfo.numScreens) { 153 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 154 } 155 if (vendor != NULL) { 156 int ret; 157 if (!glxServer.addXIDMap(glxpixmap, vendor)) { 158 return BadAlloc; 159 } 160 ret = glxServer.forwardRequest(vendor, client); 161 if (ret != Success) { 162 glxServer.removeXIDMap(glxpixmap); 163 } 164 return ret; 165 } else { 166 client->errorValue = screen; 167 return BadMatch; 168 } 169} 170static int dispatch_GetVisualConfigs(ClientPtr client) 171{ 172 REQUEST(xGLXGetVisualConfigsReq); 173 CARD32 screen; 174 GlxServerVendor *vendor = NULL; 175 REQUEST_SIZE_MATCH(*stuff); 176 screen = GlxCheckSwap(client, stuff->screen); 177 if (screen < screenInfo.numScreens) { 178 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 179 } 180 if (vendor != NULL) { 181 int ret; 182 ret = glxServer.forwardRequest(vendor, client); 183 return ret; 184 } else { 185 client->errorValue = screen; 186 return BadMatch; 187 } 188} 189static int dispatch_DestroyGLXPixmap(ClientPtr client) 190{ 191 REQUEST(xGLXDestroyGLXPixmapReq); 192 CARD32 glxpixmap; 193 GlxServerVendor *vendor = NULL; 194 REQUEST_SIZE_MATCH(*stuff); 195 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 196 vendor = glxServer.getXIDMap(glxpixmap); 197 if (vendor != NULL) { 198 int ret; 199 ret = glxServer.forwardRequest(vendor, client); 200 return ret; 201 } else { 202 client->errorValue = glxpixmap; 203 return GlxErrorBase + GLXBadPixmap; 204 } 205} 206static int dispatch_QueryExtensionsString(ClientPtr client) 207{ 208 REQUEST(xGLXQueryExtensionsStringReq); 209 CARD32 screen; 210 GlxServerVendor *vendor = NULL; 211 REQUEST_SIZE_MATCH(*stuff); 212 screen = GlxCheckSwap(client, stuff->screen); 213 if (screen < screenInfo.numScreens) { 214 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 215 } 216 if (vendor != NULL) { 217 int ret; 218 ret = glxServer.forwardRequest(vendor, client); 219 return ret; 220 } else { 221 client->errorValue = screen; 222 return BadMatch; 223 } 224} 225static int dispatch_QueryServerString(ClientPtr client) 226{ 227 REQUEST(xGLXQueryServerStringReq); 228 CARD32 screen; 229 GlxServerVendor *vendor = NULL; 230 REQUEST_SIZE_MATCH(*stuff); 231 screen = GlxCheckSwap(client, stuff->screen); 232 if (screen < screenInfo.numScreens) { 233 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 234 } 235 if (vendor != NULL) { 236 int ret; 237 ret = glxServer.forwardRequest(vendor, client); 238 return ret; 239 } else { 240 client->errorValue = screen; 241 return BadMatch; 242 } 243} 244static int dispatch_ChangeDrawableAttributes(ClientPtr client) 245{ 246 REQUEST(xGLXChangeDrawableAttributesReq); 247 CARD32 drawable; 248 GlxServerVendor *vendor = NULL; 249 REQUEST_AT_LEAST_SIZE(*stuff); 250 drawable = GlxCheckSwap(client, stuff->drawable); 251 vendor = glxServer.getXIDMap(drawable); 252 if (vendor != NULL) { 253 int ret; 254 ret = glxServer.forwardRequest(vendor, client); 255 return ret; 256 } else { 257 client->errorValue = drawable; 258 return BadDrawable; 259 } 260} 261static int dispatch_CreateNewContext(ClientPtr client) 262{ 263 REQUEST(xGLXCreateNewContextReq); 264 CARD32 screen, context; 265 GlxServerVendor *vendor = NULL; 266 REQUEST_SIZE_MATCH(*stuff); 267 screen = GlxCheckSwap(client, stuff->screen); 268 context = GlxCheckSwap(client, stuff->context); 269 LEGAL_NEW_RESOURCE(context, client); 270 if (screen < screenInfo.numScreens) { 271 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 272 } 273 if (vendor != NULL) { 274 int ret; 275 if (!glxServer.addXIDMap(context, vendor)) { 276 return BadAlloc; 277 } 278 ret = glxServer.forwardRequest(vendor, client); 279 if (ret != Success) { 280 glxServer.removeXIDMap(context); 281 } 282 return ret; 283 } else { 284 client->errorValue = screen; 285 return BadMatch; 286 } 287} 288static int dispatch_CreatePbuffer(ClientPtr client) 289{ 290 REQUEST(xGLXCreatePbufferReq); 291 CARD32 screen, pbuffer; 292 GlxServerVendor *vendor = NULL; 293 REQUEST_AT_LEAST_SIZE(*stuff); 294 screen = GlxCheckSwap(client, stuff->screen); 295 pbuffer = GlxCheckSwap(client, stuff->pbuffer); 296 LEGAL_NEW_RESOURCE(pbuffer, client); 297 if (screen < screenInfo.numScreens) { 298 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 299 } 300 if (vendor != NULL) { 301 int ret; 302 if (!glxServer.addXIDMap(pbuffer, vendor)) { 303 return BadAlloc; 304 } 305 ret = glxServer.forwardRequest(vendor, client); 306 if (ret != Success) { 307 glxServer.removeXIDMap(pbuffer); 308 } 309 return ret; 310 } else { 311 client->errorValue = screen; 312 return BadMatch; 313 } 314} 315static int dispatch_CreatePixmap(ClientPtr client) 316{ 317 REQUEST(xGLXCreatePixmapReq); 318 CARD32 screen, glxpixmap; 319 GlxServerVendor *vendor = NULL; 320 REQUEST_AT_LEAST_SIZE(*stuff); 321 screen = GlxCheckSwap(client, stuff->screen); 322 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 323 LEGAL_NEW_RESOURCE(glxpixmap, client); 324 if (screen < screenInfo.numScreens) { 325 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 326 } 327 if (vendor != NULL) { 328 int ret; 329 if (!glxServer.addXIDMap(glxpixmap, vendor)) { 330 return BadAlloc; 331 } 332 ret = glxServer.forwardRequest(vendor, client); 333 if (ret != Success) { 334 glxServer.removeXIDMap(glxpixmap); 335 } 336 return ret; 337 } else { 338 client->errorValue = screen; 339 return BadMatch; 340 } 341} 342static int dispatch_CreateWindow(ClientPtr client) 343{ 344 REQUEST(xGLXCreateWindowReq); 345 CARD32 screen, glxwindow; 346 GlxServerVendor *vendor = NULL; 347 REQUEST_AT_LEAST_SIZE(*stuff); 348 screen = GlxCheckSwap(client, stuff->screen); 349 glxwindow = GlxCheckSwap(client, stuff->glxwindow); 350 LEGAL_NEW_RESOURCE(glxwindow, client); 351 if (screen < screenInfo.numScreens) { 352 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 353 } 354 if (vendor != NULL) { 355 int ret; 356 if (!glxServer.addXIDMap(glxwindow, vendor)) { 357 return BadAlloc; 358 } 359 ret = glxServer.forwardRequest(vendor, client); 360 if (ret != Success) { 361 glxServer.removeXIDMap(glxwindow); 362 } 363 return ret; 364 } else { 365 client->errorValue = screen; 366 return BadMatch; 367 } 368} 369static int dispatch_CreateContextAttribsARB(ClientPtr client) 370{ 371 REQUEST(xGLXCreateContextAttribsARBReq); 372 CARD32 screen, context; 373 GlxServerVendor *vendor = NULL; 374 REQUEST_AT_LEAST_SIZE(*stuff); 375 screen = GlxCheckSwap(client, stuff->screen); 376 context = GlxCheckSwap(client, stuff->context); 377 LEGAL_NEW_RESOURCE(context, client); 378 if (screen < screenInfo.numScreens) { 379 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 380 } 381 if (vendor != NULL) { 382 int ret; 383 if (!glxServer.addXIDMap(context, vendor)) { 384 return BadAlloc; 385 } 386 ret = glxServer.forwardRequest(vendor, client); 387 if (ret != Success) { 388 glxServer.removeXIDMap(context); 389 } 390 return ret; 391 } else { 392 client->errorValue = screen; 393 return BadMatch; 394 } 395} 396static int dispatch_DestroyPbuffer(ClientPtr client) 397{ 398 REQUEST(xGLXDestroyPbufferReq); 399 CARD32 pbuffer; 400 GlxServerVendor *vendor = NULL; 401 REQUEST_SIZE_MATCH(*stuff); 402 pbuffer = GlxCheckSwap(client, stuff->pbuffer); 403 vendor = glxServer.getXIDMap(pbuffer); 404 if (vendor != NULL) { 405 int ret; 406 ret = glxServer.forwardRequest(vendor, client); 407 if (ret == Success) { 408 glxServer.removeXIDMap(pbuffer); 409 } 410 return ret; 411 } else { 412 client->errorValue = pbuffer; 413 return GlxErrorBase + GLXBadPbuffer; 414 } 415} 416static int dispatch_DestroyPixmap(ClientPtr client) 417{ 418 REQUEST(xGLXDestroyPixmapReq); 419 CARD32 glxpixmap; 420 GlxServerVendor *vendor = NULL; 421 REQUEST_SIZE_MATCH(*stuff); 422 glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 423 vendor = glxServer.getXIDMap(glxpixmap); 424 if (vendor != NULL) { 425 int ret; 426 ret = glxServer.forwardRequest(vendor, client); 427 if (ret == Success) { 428 glxServer.removeXIDMap(glxpixmap); 429 } 430 return ret; 431 } else { 432 client->errorValue = glxpixmap; 433 return GlxErrorBase + GLXBadPixmap; 434 } 435} 436static int dispatch_DestroyWindow(ClientPtr client) 437{ 438 REQUEST(xGLXDestroyWindowReq); 439 CARD32 glxwindow; 440 GlxServerVendor *vendor = NULL; 441 REQUEST_SIZE_MATCH(*stuff); 442 glxwindow = GlxCheckSwap(client, stuff->glxwindow); 443 vendor = glxServer.getXIDMap(glxwindow); 444 if (vendor != NULL) { 445 int ret; 446 ret = glxServer.forwardRequest(vendor, client); 447 if (ret == Success) { 448 glxServer.removeXIDMap(glxwindow); 449 } 450 return ret; 451 } else { 452 client->errorValue = glxwindow; 453 return GlxErrorBase + GLXBadWindow; 454 } 455} 456static int dispatch_GetDrawableAttributes(ClientPtr client) 457{ 458 REQUEST(xGLXGetDrawableAttributesReq); 459 CARD32 drawable; 460 GlxServerVendor *vendor = NULL; 461 REQUEST_SIZE_MATCH(*stuff); 462 drawable = GlxCheckSwap(client, stuff->drawable); 463 vendor = glxServer.getXIDMap(drawable); 464 if (vendor != NULL) { 465 int ret; 466 ret = glxServer.forwardRequest(vendor, client); 467 return ret; 468 } else { 469 client->errorValue = drawable; 470 return BadDrawable; 471 } 472} 473static int dispatch_GetFBConfigs(ClientPtr client) 474{ 475 REQUEST(xGLXGetFBConfigsReq); 476 CARD32 screen; 477 GlxServerVendor *vendor = NULL; 478 REQUEST_SIZE_MATCH(*stuff); 479 screen = GlxCheckSwap(client, stuff->screen); 480 if (screen < screenInfo.numScreens) { 481 vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 482 } 483 if (vendor != NULL) { 484 int ret; 485 ret = glxServer.forwardRequest(vendor, client); 486 return ret; 487 } else { 488 client->errorValue = screen; 489 return BadMatch; 490 } 491} 492static int dispatch_QueryContext(ClientPtr client) 493{ 494 REQUEST(xGLXQueryContextReq); 495 CARD32 context; 496 GlxServerVendor *vendor = NULL; 497 REQUEST_SIZE_MATCH(*stuff); 498 context = GlxCheckSwap(client, stuff->context); 499 vendor = glxServer.getXIDMap(context); 500 if (vendor != NULL) { 501 int ret; 502 ret = glxServer.forwardRequest(vendor, client); 503 return ret; 504 } else { 505 client->errorValue = context; 506 return GlxErrorBase + GLXBadContext; 507 } 508} 509static int dispatch_IsDirect(ClientPtr client) 510{ 511 REQUEST(xGLXIsDirectReq); 512 CARD32 context; 513 GlxServerVendor *vendor = NULL; 514 REQUEST_SIZE_MATCH(*stuff); 515 context = GlxCheckSwap(client, stuff->context); 516 vendor = glxServer.getXIDMap(context); 517 if (vendor != NULL) { 518 int ret; 519 ret = glxServer.forwardRequest(vendor, client); 520 return ret; 521 } else { 522 client->errorValue = context; 523 return GlxErrorBase + GLXBadContext; 524 } 525} 526