X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fglx%2Fglxcmds.c;h=37c09336749c1adfb27d9bb035a5723be534ef88;hb=244dc0521439379a0a44f81ba432aa04ca6c1a91;hp=4f99023172da81a3c1dd1ce4cd505a485083792a;hpb=4dbd13cb3f5aeff6ddc85fd091b4677369c19778;p=mesa.git diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 4f99023172d..37c09336749 100644 --- a/src/glx/glxcmds.c +++ b/src/glx/glxcmds.c @@ -37,12 +37,12 @@ #include "glapi.h" #include "glxextensions.h" #include "indirect.h" +#include "glx_error.h" #ifdef GLX_DIRECT_RENDERING #ifdef GLX_USE_APPLEGL #include "apple_glx_context.h" #include "apple_glx.h" -#include "glx_error.h" #else #include #ifdef XF86VIDMODE @@ -150,7 +150,7 @@ DestroyGLXDrawable(Display *dpy, GLXDrawable drawable) * number range for \c dpy? */ -static struct glx_screen * +_X_HIDDEN struct glx_screen * GetGLXScreenConfigs(Display * dpy, int scrn) { struct glx_display *const priv = __glXInitialize(dpy); @@ -344,6 +344,7 @@ CreateContext(Display *dpy, int generic_id, struct glx_config *config, UnlockDisplay(dpy); SyncHandle(); + gc->share_xid = shareList ? shareList->xid : None; gc->imported = GL_FALSE; gc->renderType = renderType; @@ -588,12 +589,19 @@ __glXIsDirect(Display * dpy, GLXContextID contextID) #ifdef USE_XCB xcb_connection_t *c = XGetXCBConnection(dpy); + xcb_generic_error_t *err; xcb_glx_is_direct_reply_t *reply = xcb_glx_is_direct_reply(c, xcb_glx_is_direct (c, contextID), - NULL); + &err); const Bool is_direct = (reply != NULL && reply->is_direct) ? True : False; + + if (err != NULL) { + __glXSendErrorForXcb(dpy, err); + free(err); + } + free(reply); return is_direct; @@ -1428,7 +1436,23 @@ glXImportContextEXT(Display *dpy, GLXContextID contextID) uint32_t screen; Bool got_screen = False; - if (contextID == None || __glXIsDirect(dpy, contextID)) + /* The GLX_EXT_import_context spec says: + * + * "If does not refer to a valid context, then a BadContext + * error is generated; if refers to direct rendering + * context then no error is generated but glXImportContextEXT returns + * NULL." + * + * If contextID is None, generate BadContext on the client-side. Other + * sorts of invalid contexts will be detected by the server in the + * __glXIsDirect call. + */ + if (contextID == None) { + __glXSendError(dpy, GLXBadContext, contextID, X_GLXIsDirect, false); + return NULL; + } + + if (__glXIsDirect(dpy, contextID)) return NULL; opcode = __glXSetupForCommand(dpy); @@ -2579,6 +2603,9 @@ static const struct name_address_pair GLX_functions[] = { GLX_FUNCTION(glXGetDriverConfig), #endif + /*** GLX_ARB_create_context and GLX_ARB_create_context_profile ***/ + GLX_FUNCTION(glXCreateContextAttribsARB), + {NULL, NULL} /* end of list */ };