11b5d61b8Smrg 21b5d61b8Smrg#include <dix-config.h> 31b5d61b8Smrg#include <dix.h> 41b5d61b8Smrg#include "vndserver.h" 51b5d61b8Smrg 61b5d61b8Smrg// HACK: The opcode in old glxproto.h has a typo in it. 71b5d61b8Smrg#if !defined(X_GLXCreateContextAttribsARB) 81b5d61b8Smrg#define X_GLXCreateContextAttribsARB X_GLXCreateContextAtrribsARB 91b5d61b8Smrg#endif 101b5d61b8Smrg 111b5d61b8Smrgstatic int dispatch_Render(ClientPtr client) 121b5d61b8Smrg{ 131b5d61b8Smrg REQUEST(xGLXRenderReq); 141b5d61b8Smrg CARD32 contextTag; 151b5d61b8Smrg GlxServerVendor *vendor = NULL; 161b5d61b8Smrg REQUEST_AT_LEAST_SIZE(*stuff); 171b5d61b8Smrg contextTag = GlxCheckSwap(client, stuff->contextTag); 181b5d61b8Smrg vendor = glxServer.getContextTag(client, contextTag); 191b5d61b8Smrg if (vendor != NULL) { 201b5d61b8Smrg int ret; 211b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 221b5d61b8Smrg return ret; 231b5d61b8Smrg } else { 241b5d61b8Smrg client->errorValue = contextTag; 251b5d61b8Smrg return GlxErrorBase + GLXBadContextTag; 261b5d61b8Smrg } 271b5d61b8Smrg} 281b5d61b8Smrgstatic int dispatch_RenderLarge(ClientPtr client) 291b5d61b8Smrg{ 301b5d61b8Smrg REQUEST(xGLXRenderLargeReq); 311b5d61b8Smrg CARD32 contextTag; 321b5d61b8Smrg GlxServerVendor *vendor = NULL; 331b5d61b8Smrg REQUEST_AT_LEAST_SIZE(*stuff); 341b5d61b8Smrg contextTag = GlxCheckSwap(client, stuff->contextTag); 351b5d61b8Smrg vendor = glxServer.getContextTag(client, contextTag); 361b5d61b8Smrg if (vendor != NULL) { 371b5d61b8Smrg int ret; 381b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 391b5d61b8Smrg return ret; 401b5d61b8Smrg } else { 411b5d61b8Smrg client->errorValue = contextTag; 421b5d61b8Smrg return GlxErrorBase + GLXBadContextTag; 431b5d61b8Smrg } 441b5d61b8Smrg} 451b5d61b8Smrgstatic int dispatch_CreateContext(ClientPtr client) 461b5d61b8Smrg{ 471b5d61b8Smrg REQUEST(xGLXCreateContextReq); 481b5d61b8Smrg CARD32 screen, context; 491b5d61b8Smrg GlxServerVendor *vendor = NULL; 501b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 511b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 521b5d61b8Smrg context = GlxCheckSwap(client, stuff->context); 531b5d61b8Smrg LEGAL_NEW_RESOURCE(context, client); 541b5d61b8Smrg if (screen < screenInfo.numScreens) { 551b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 561b5d61b8Smrg } 571b5d61b8Smrg if (vendor != NULL) { 581b5d61b8Smrg int ret; 591b5d61b8Smrg if (!glxServer.addXIDMap(context, vendor)) { 601b5d61b8Smrg return BadAlloc; 611b5d61b8Smrg } 621b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 631b5d61b8Smrg if (ret != Success) { 641b5d61b8Smrg glxServer.removeXIDMap(context); 651b5d61b8Smrg } 661b5d61b8Smrg return ret; 671b5d61b8Smrg } else { 681b5d61b8Smrg client->errorValue = screen; 691b5d61b8Smrg return BadMatch; 701b5d61b8Smrg } 711b5d61b8Smrg} 721b5d61b8Smrgstatic int dispatch_DestroyContext(ClientPtr client) 731b5d61b8Smrg{ 741b5d61b8Smrg REQUEST(xGLXDestroyContextReq); 751b5d61b8Smrg CARD32 context; 761b5d61b8Smrg GlxServerVendor *vendor = NULL; 771b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 781b5d61b8Smrg context = GlxCheckSwap(client, stuff->context); 791b5d61b8Smrg vendor = glxServer.getXIDMap(context); 801b5d61b8Smrg if (vendor != NULL) { 811b5d61b8Smrg int ret; 821b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 831b5d61b8Smrg if (ret == Success) { 841b5d61b8Smrg glxServer.removeXIDMap(context); 851b5d61b8Smrg } 861b5d61b8Smrg return ret; 871b5d61b8Smrg } else { 881b5d61b8Smrg client->errorValue = context; 891b5d61b8Smrg return GlxErrorBase + GLXBadContext; 901b5d61b8Smrg } 911b5d61b8Smrg} 921b5d61b8Smrgstatic int dispatch_WaitGL(ClientPtr client) 931b5d61b8Smrg{ 941b5d61b8Smrg REQUEST(xGLXWaitGLReq); 951b5d61b8Smrg CARD32 contextTag; 961b5d61b8Smrg GlxServerVendor *vendor = NULL; 971b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 981b5d61b8Smrg contextTag = GlxCheckSwap(client, stuff->contextTag); 991b5d61b8Smrg vendor = glxServer.getContextTag(client, contextTag); 1001b5d61b8Smrg if (vendor != NULL) { 1011b5d61b8Smrg int ret; 1021b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 1031b5d61b8Smrg return ret; 1041b5d61b8Smrg } else { 1051b5d61b8Smrg client->errorValue = contextTag; 1061b5d61b8Smrg return GlxErrorBase + GLXBadContextTag; 1071b5d61b8Smrg } 1081b5d61b8Smrg} 1091b5d61b8Smrgstatic int dispatch_WaitX(ClientPtr client) 1101b5d61b8Smrg{ 1111b5d61b8Smrg REQUEST(xGLXWaitXReq); 1121b5d61b8Smrg CARD32 contextTag; 1131b5d61b8Smrg GlxServerVendor *vendor = NULL; 1141b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 1151b5d61b8Smrg contextTag = GlxCheckSwap(client, stuff->contextTag); 1161b5d61b8Smrg vendor = glxServer.getContextTag(client, contextTag); 1171b5d61b8Smrg if (vendor != NULL) { 1181b5d61b8Smrg int ret; 1191b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 1201b5d61b8Smrg return ret; 1211b5d61b8Smrg } else { 1221b5d61b8Smrg client->errorValue = contextTag; 1231b5d61b8Smrg return GlxErrorBase + GLXBadContextTag; 1241b5d61b8Smrg } 1251b5d61b8Smrg} 1261b5d61b8Smrgstatic int dispatch_UseXFont(ClientPtr client) 1271b5d61b8Smrg{ 1281b5d61b8Smrg REQUEST(xGLXUseXFontReq); 1291b5d61b8Smrg CARD32 contextTag; 1301b5d61b8Smrg GlxServerVendor *vendor = NULL; 1311b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 1321b5d61b8Smrg contextTag = GlxCheckSwap(client, stuff->contextTag); 1331b5d61b8Smrg vendor = glxServer.getContextTag(client, contextTag); 1341b5d61b8Smrg if (vendor != NULL) { 1351b5d61b8Smrg int ret; 1361b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 1371b5d61b8Smrg return ret; 1381b5d61b8Smrg } else { 1391b5d61b8Smrg client->errorValue = contextTag; 1401b5d61b8Smrg return GlxErrorBase + GLXBadContextTag; 1411b5d61b8Smrg } 1421b5d61b8Smrg} 1431b5d61b8Smrgstatic int dispatch_CreateGLXPixmap(ClientPtr client) 1441b5d61b8Smrg{ 1451b5d61b8Smrg REQUEST(xGLXCreateGLXPixmapReq); 1461b5d61b8Smrg CARD32 screen, glxpixmap; 1471b5d61b8Smrg GlxServerVendor *vendor = NULL; 1481b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 1491b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 1501b5d61b8Smrg glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 1511b5d61b8Smrg LEGAL_NEW_RESOURCE(glxpixmap, client); 1521b5d61b8Smrg if (screen < screenInfo.numScreens) { 1531b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 1541b5d61b8Smrg } 1551b5d61b8Smrg if (vendor != NULL) { 1561b5d61b8Smrg int ret; 1571b5d61b8Smrg if (!glxServer.addXIDMap(glxpixmap, vendor)) { 1581b5d61b8Smrg return BadAlloc; 1591b5d61b8Smrg } 1601b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 1611b5d61b8Smrg if (ret != Success) { 1621b5d61b8Smrg glxServer.removeXIDMap(glxpixmap); 1631b5d61b8Smrg } 1641b5d61b8Smrg return ret; 1651b5d61b8Smrg } else { 1661b5d61b8Smrg client->errorValue = screen; 1671b5d61b8Smrg return BadMatch; 1681b5d61b8Smrg } 1691b5d61b8Smrg} 1701b5d61b8Smrgstatic int dispatch_GetVisualConfigs(ClientPtr client) 1711b5d61b8Smrg{ 1721b5d61b8Smrg REQUEST(xGLXGetVisualConfigsReq); 1731b5d61b8Smrg CARD32 screen; 1741b5d61b8Smrg GlxServerVendor *vendor = NULL; 1751b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 1761b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 1771b5d61b8Smrg if (screen < screenInfo.numScreens) { 1781b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 1791b5d61b8Smrg } 1801b5d61b8Smrg if (vendor != NULL) { 1811b5d61b8Smrg int ret; 1821b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 1831b5d61b8Smrg return ret; 1841b5d61b8Smrg } else { 1851b5d61b8Smrg client->errorValue = screen; 1861b5d61b8Smrg return BadMatch; 1871b5d61b8Smrg } 1881b5d61b8Smrg} 1891b5d61b8Smrgstatic int dispatch_DestroyGLXPixmap(ClientPtr client) 1901b5d61b8Smrg{ 1911b5d61b8Smrg REQUEST(xGLXDestroyGLXPixmapReq); 1921b5d61b8Smrg CARD32 glxpixmap; 1931b5d61b8Smrg GlxServerVendor *vendor = NULL; 1941b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 1951b5d61b8Smrg glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 1961b5d61b8Smrg vendor = glxServer.getXIDMap(glxpixmap); 1971b5d61b8Smrg if (vendor != NULL) { 1981b5d61b8Smrg int ret; 1991b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 2001b5d61b8Smrg return ret; 2011b5d61b8Smrg } else { 2021b5d61b8Smrg client->errorValue = glxpixmap; 2031b5d61b8Smrg return GlxErrorBase + GLXBadPixmap; 2041b5d61b8Smrg } 2051b5d61b8Smrg} 2061b5d61b8Smrgstatic int dispatch_QueryExtensionsString(ClientPtr client) 2071b5d61b8Smrg{ 2081b5d61b8Smrg REQUEST(xGLXQueryExtensionsStringReq); 2091b5d61b8Smrg CARD32 screen; 2101b5d61b8Smrg GlxServerVendor *vendor = NULL; 2111b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 2121b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 2131b5d61b8Smrg if (screen < screenInfo.numScreens) { 2141b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 2151b5d61b8Smrg } 2161b5d61b8Smrg if (vendor != NULL) { 2171b5d61b8Smrg int ret; 2181b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 2191b5d61b8Smrg return ret; 2201b5d61b8Smrg } else { 2211b5d61b8Smrg client->errorValue = screen; 2221b5d61b8Smrg return BadMatch; 2231b5d61b8Smrg } 2241b5d61b8Smrg} 2251b5d61b8Smrgstatic int dispatch_QueryServerString(ClientPtr client) 2261b5d61b8Smrg{ 2271b5d61b8Smrg REQUEST(xGLXQueryServerStringReq); 2281b5d61b8Smrg CARD32 screen; 2291b5d61b8Smrg GlxServerVendor *vendor = NULL; 2301b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 2311b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 2321b5d61b8Smrg if (screen < screenInfo.numScreens) { 2331b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 2341b5d61b8Smrg } 2351b5d61b8Smrg if (vendor != NULL) { 2361b5d61b8Smrg int ret; 2371b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 2381b5d61b8Smrg return ret; 2391b5d61b8Smrg } else { 2401b5d61b8Smrg client->errorValue = screen; 2411b5d61b8Smrg return BadMatch; 2421b5d61b8Smrg } 2431b5d61b8Smrg} 2441b5d61b8Smrgstatic int dispatch_ChangeDrawableAttributes(ClientPtr client) 2451b5d61b8Smrg{ 2461b5d61b8Smrg REQUEST(xGLXChangeDrawableAttributesReq); 2471b5d61b8Smrg CARD32 drawable; 2481b5d61b8Smrg GlxServerVendor *vendor = NULL; 2491b5d61b8Smrg REQUEST_AT_LEAST_SIZE(*stuff); 2501b5d61b8Smrg drawable = GlxCheckSwap(client, stuff->drawable); 2511b5d61b8Smrg vendor = glxServer.getXIDMap(drawable); 2521b5d61b8Smrg if (vendor != NULL) { 2531b5d61b8Smrg int ret; 2541b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 2551b5d61b8Smrg return ret; 2561b5d61b8Smrg } else { 2571b5d61b8Smrg client->errorValue = drawable; 2581b5d61b8Smrg return BadDrawable; 2591b5d61b8Smrg } 2601b5d61b8Smrg} 2611b5d61b8Smrgstatic int dispatch_CreateNewContext(ClientPtr client) 2621b5d61b8Smrg{ 2631b5d61b8Smrg REQUEST(xGLXCreateNewContextReq); 2641b5d61b8Smrg CARD32 screen, context; 2651b5d61b8Smrg GlxServerVendor *vendor = NULL; 2661b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 2671b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 2681b5d61b8Smrg context = GlxCheckSwap(client, stuff->context); 2691b5d61b8Smrg LEGAL_NEW_RESOURCE(context, client); 2701b5d61b8Smrg if (screen < screenInfo.numScreens) { 2711b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 2721b5d61b8Smrg } 2731b5d61b8Smrg if (vendor != NULL) { 2741b5d61b8Smrg int ret; 2751b5d61b8Smrg if (!glxServer.addXIDMap(context, vendor)) { 2761b5d61b8Smrg return BadAlloc; 2771b5d61b8Smrg } 2781b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 2791b5d61b8Smrg if (ret != Success) { 2801b5d61b8Smrg glxServer.removeXIDMap(context); 2811b5d61b8Smrg } 2821b5d61b8Smrg return ret; 2831b5d61b8Smrg } else { 2841b5d61b8Smrg client->errorValue = screen; 2851b5d61b8Smrg return BadMatch; 2861b5d61b8Smrg } 2871b5d61b8Smrg} 2881b5d61b8Smrgstatic int dispatch_CreatePbuffer(ClientPtr client) 2891b5d61b8Smrg{ 2901b5d61b8Smrg REQUEST(xGLXCreatePbufferReq); 2911b5d61b8Smrg CARD32 screen, pbuffer; 2921b5d61b8Smrg GlxServerVendor *vendor = NULL; 2931b5d61b8Smrg REQUEST_AT_LEAST_SIZE(*stuff); 2941b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 2951b5d61b8Smrg pbuffer = GlxCheckSwap(client, stuff->pbuffer); 2961b5d61b8Smrg LEGAL_NEW_RESOURCE(pbuffer, client); 2971b5d61b8Smrg if (screen < screenInfo.numScreens) { 2981b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 2991b5d61b8Smrg } 3001b5d61b8Smrg if (vendor != NULL) { 3011b5d61b8Smrg int ret; 3021b5d61b8Smrg if (!glxServer.addXIDMap(pbuffer, vendor)) { 3031b5d61b8Smrg return BadAlloc; 3041b5d61b8Smrg } 3051b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 3061b5d61b8Smrg if (ret != Success) { 3071b5d61b8Smrg glxServer.removeXIDMap(pbuffer); 3081b5d61b8Smrg } 3091b5d61b8Smrg return ret; 3101b5d61b8Smrg } else { 3111b5d61b8Smrg client->errorValue = screen; 3121b5d61b8Smrg return BadMatch; 3131b5d61b8Smrg } 3141b5d61b8Smrg} 3151b5d61b8Smrgstatic int dispatch_CreatePixmap(ClientPtr client) 3161b5d61b8Smrg{ 3171b5d61b8Smrg REQUEST(xGLXCreatePixmapReq); 3181b5d61b8Smrg CARD32 screen, glxpixmap; 3191b5d61b8Smrg GlxServerVendor *vendor = NULL; 3201b5d61b8Smrg REQUEST_AT_LEAST_SIZE(*stuff); 3211b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 3221b5d61b8Smrg glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 3231b5d61b8Smrg LEGAL_NEW_RESOURCE(glxpixmap, client); 3241b5d61b8Smrg if (screen < screenInfo.numScreens) { 3251b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 3261b5d61b8Smrg } 3271b5d61b8Smrg if (vendor != NULL) { 3281b5d61b8Smrg int ret; 3291b5d61b8Smrg if (!glxServer.addXIDMap(glxpixmap, vendor)) { 3301b5d61b8Smrg return BadAlloc; 3311b5d61b8Smrg } 3321b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 3331b5d61b8Smrg if (ret != Success) { 3341b5d61b8Smrg glxServer.removeXIDMap(glxpixmap); 3351b5d61b8Smrg } 3361b5d61b8Smrg return ret; 3371b5d61b8Smrg } else { 3381b5d61b8Smrg client->errorValue = screen; 3391b5d61b8Smrg return BadMatch; 3401b5d61b8Smrg } 3411b5d61b8Smrg} 3421b5d61b8Smrgstatic int dispatch_CreateWindow(ClientPtr client) 3431b5d61b8Smrg{ 3441b5d61b8Smrg REQUEST(xGLXCreateWindowReq); 3451b5d61b8Smrg CARD32 screen, glxwindow; 3461b5d61b8Smrg GlxServerVendor *vendor = NULL; 3471b5d61b8Smrg REQUEST_AT_LEAST_SIZE(*stuff); 3481b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 3491b5d61b8Smrg glxwindow = GlxCheckSwap(client, stuff->glxwindow); 3501b5d61b8Smrg LEGAL_NEW_RESOURCE(glxwindow, client); 3511b5d61b8Smrg if (screen < screenInfo.numScreens) { 3521b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 3531b5d61b8Smrg } 3541b5d61b8Smrg if (vendor != NULL) { 3551b5d61b8Smrg int ret; 3561b5d61b8Smrg if (!glxServer.addXIDMap(glxwindow, vendor)) { 3571b5d61b8Smrg return BadAlloc; 3581b5d61b8Smrg } 3591b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 3601b5d61b8Smrg if (ret != Success) { 3611b5d61b8Smrg glxServer.removeXIDMap(glxwindow); 3621b5d61b8Smrg } 3631b5d61b8Smrg return ret; 3641b5d61b8Smrg } else { 3651b5d61b8Smrg client->errorValue = screen; 3661b5d61b8Smrg return BadMatch; 3671b5d61b8Smrg } 3681b5d61b8Smrg} 3691b5d61b8Smrgstatic int dispatch_CreateContextAttribsARB(ClientPtr client) 3701b5d61b8Smrg{ 3711b5d61b8Smrg REQUEST(xGLXCreateContextAttribsARBReq); 3721b5d61b8Smrg CARD32 screen, context; 3731b5d61b8Smrg GlxServerVendor *vendor = NULL; 3741b5d61b8Smrg REQUEST_AT_LEAST_SIZE(*stuff); 3751b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 3761b5d61b8Smrg context = GlxCheckSwap(client, stuff->context); 3771b5d61b8Smrg LEGAL_NEW_RESOURCE(context, client); 3781b5d61b8Smrg if (screen < screenInfo.numScreens) { 3791b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 3801b5d61b8Smrg } 3811b5d61b8Smrg if (vendor != NULL) { 3821b5d61b8Smrg int ret; 3831b5d61b8Smrg if (!glxServer.addXIDMap(context, vendor)) { 3841b5d61b8Smrg return BadAlloc; 3851b5d61b8Smrg } 3861b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 3871b5d61b8Smrg if (ret != Success) { 3881b5d61b8Smrg glxServer.removeXIDMap(context); 3891b5d61b8Smrg } 3901b5d61b8Smrg return ret; 3911b5d61b8Smrg } else { 3921b5d61b8Smrg client->errorValue = screen; 3931b5d61b8Smrg return BadMatch; 3941b5d61b8Smrg } 3951b5d61b8Smrg} 3961b5d61b8Smrgstatic int dispatch_DestroyPbuffer(ClientPtr client) 3971b5d61b8Smrg{ 3981b5d61b8Smrg REQUEST(xGLXDestroyPbufferReq); 3991b5d61b8Smrg CARD32 pbuffer; 4001b5d61b8Smrg GlxServerVendor *vendor = NULL; 4011b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 4021b5d61b8Smrg pbuffer = GlxCheckSwap(client, stuff->pbuffer); 4031b5d61b8Smrg vendor = glxServer.getXIDMap(pbuffer); 4041b5d61b8Smrg if (vendor != NULL) { 4051b5d61b8Smrg int ret; 4061b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 4071b5d61b8Smrg if (ret == Success) { 4081b5d61b8Smrg glxServer.removeXIDMap(pbuffer); 4091b5d61b8Smrg } 4101b5d61b8Smrg return ret; 4111b5d61b8Smrg } else { 4121b5d61b8Smrg client->errorValue = pbuffer; 4131b5d61b8Smrg return GlxErrorBase + GLXBadPbuffer; 4141b5d61b8Smrg } 4151b5d61b8Smrg} 4161b5d61b8Smrgstatic int dispatch_DestroyPixmap(ClientPtr client) 4171b5d61b8Smrg{ 4181b5d61b8Smrg REQUEST(xGLXDestroyPixmapReq); 4191b5d61b8Smrg CARD32 glxpixmap; 4201b5d61b8Smrg GlxServerVendor *vendor = NULL; 4211b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 4221b5d61b8Smrg glxpixmap = GlxCheckSwap(client, stuff->glxpixmap); 4231b5d61b8Smrg vendor = glxServer.getXIDMap(glxpixmap); 4241b5d61b8Smrg if (vendor != NULL) { 4251b5d61b8Smrg int ret; 4261b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 4271b5d61b8Smrg if (ret == Success) { 4281b5d61b8Smrg glxServer.removeXIDMap(glxpixmap); 4291b5d61b8Smrg } 4301b5d61b8Smrg return ret; 4311b5d61b8Smrg } else { 4321b5d61b8Smrg client->errorValue = glxpixmap; 4331b5d61b8Smrg return GlxErrorBase + GLXBadPixmap; 4341b5d61b8Smrg } 4351b5d61b8Smrg} 4361b5d61b8Smrgstatic int dispatch_DestroyWindow(ClientPtr client) 4371b5d61b8Smrg{ 4381b5d61b8Smrg REQUEST(xGLXDestroyWindowReq); 4391b5d61b8Smrg CARD32 glxwindow; 4401b5d61b8Smrg GlxServerVendor *vendor = NULL; 4411b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 4421b5d61b8Smrg glxwindow = GlxCheckSwap(client, stuff->glxwindow); 4431b5d61b8Smrg vendor = glxServer.getXIDMap(glxwindow); 4441b5d61b8Smrg if (vendor != NULL) { 4451b5d61b8Smrg int ret; 4461b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 4471b5d61b8Smrg if (ret == Success) { 4481b5d61b8Smrg glxServer.removeXIDMap(glxwindow); 4491b5d61b8Smrg } 4501b5d61b8Smrg return ret; 4511b5d61b8Smrg } else { 4521b5d61b8Smrg client->errorValue = glxwindow; 4531b5d61b8Smrg return GlxErrorBase + GLXBadWindow; 4541b5d61b8Smrg } 4551b5d61b8Smrg} 4561b5d61b8Smrgstatic int dispatch_GetDrawableAttributes(ClientPtr client) 4571b5d61b8Smrg{ 4581b5d61b8Smrg REQUEST(xGLXGetDrawableAttributesReq); 4591b5d61b8Smrg CARD32 drawable; 4601b5d61b8Smrg GlxServerVendor *vendor = NULL; 4611b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 4621b5d61b8Smrg drawable = GlxCheckSwap(client, stuff->drawable); 4631b5d61b8Smrg vendor = glxServer.getXIDMap(drawable); 4641b5d61b8Smrg if (vendor != NULL) { 4651b5d61b8Smrg int ret; 4661b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 4671b5d61b8Smrg return ret; 4681b5d61b8Smrg } else { 4691b5d61b8Smrg client->errorValue = drawable; 4701b5d61b8Smrg return BadDrawable; 4711b5d61b8Smrg } 4721b5d61b8Smrg} 4731b5d61b8Smrgstatic int dispatch_GetFBConfigs(ClientPtr client) 4741b5d61b8Smrg{ 4751b5d61b8Smrg REQUEST(xGLXGetFBConfigsReq); 4761b5d61b8Smrg CARD32 screen; 4771b5d61b8Smrg GlxServerVendor *vendor = NULL; 4781b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 4791b5d61b8Smrg screen = GlxCheckSwap(client, stuff->screen); 4801b5d61b8Smrg if (screen < screenInfo.numScreens) { 4811b5d61b8Smrg vendor = glxServer.getVendorForScreen(client, screenInfo.screens[screen]); 4821b5d61b8Smrg } 4831b5d61b8Smrg if (vendor != NULL) { 4841b5d61b8Smrg int ret; 4851b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 4861b5d61b8Smrg return ret; 4871b5d61b8Smrg } else { 4881b5d61b8Smrg client->errorValue = screen; 4891b5d61b8Smrg return BadMatch; 4901b5d61b8Smrg } 4911b5d61b8Smrg} 4921b5d61b8Smrgstatic int dispatch_QueryContext(ClientPtr client) 4931b5d61b8Smrg{ 4941b5d61b8Smrg REQUEST(xGLXQueryContextReq); 4951b5d61b8Smrg CARD32 context; 4961b5d61b8Smrg GlxServerVendor *vendor = NULL; 4971b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 4981b5d61b8Smrg context = GlxCheckSwap(client, stuff->context); 4991b5d61b8Smrg vendor = glxServer.getXIDMap(context); 5001b5d61b8Smrg if (vendor != NULL) { 5011b5d61b8Smrg int ret; 5021b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 5031b5d61b8Smrg return ret; 5041b5d61b8Smrg } else { 5051b5d61b8Smrg client->errorValue = context; 5061b5d61b8Smrg return GlxErrorBase + GLXBadContext; 5071b5d61b8Smrg } 5081b5d61b8Smrg} 5091b5d61b8Smrgstatic int dispatch_IsDirect(ClientPtr client) 5101b5d61b8Smrg{ 5111b5d61b8Smrg REQUEST(xGLXIsDirectReq); 5121b5d61b8Smrg CARD32 context; 5131b5d61b8Smrg GlxServerVendor *vendor = NULL; 5141b5d61b8Smrg REQUEST_SIZE_MATCH(*stuff); 5151b5d61b8Smrg context = GlxCheckSwap(client, stuff->context); 5161b5d61b8Smrg vendor = glxServer.getXIDMap(context); 5171b5d61b8Smrg if (vendor != NULL) { 5181b5d61b8Smrg int ret; 5191b5d61b8Smrg ret = glxServer.forwardRequest(vendor, client); 5201b5d61b8Smrg return ret; 5211b5d61b8Smrg } else { 5221b5d61b8Smrg client->errorValue = context; 5231b5d61b8Smrg return GlxErrorBase + GLXBadContext; 5241b5d61b8Smrg } 5251b5d61b8Smrg} 526