diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2011-12-07 16:13:02 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2011-12-23 08:40:30 -0800 |
commit | ed4a65c3cfdf88afba48860be34ce26f7c371869 (patch) | |
tree | bc48f68998c384735d73aa4af9fd771e8a925de0 /src/glx/glxcmds.c | |
parent | fba400072fb64dd326d35bb12a27ca17f9e03ada (diff) | |
download | external_mesa3d-ed4a65c3cfdf88afba48860be34ce26f7c371869.zip external_mesa3d-ed4a65c3cfdf88afba48860be34ce26f7c371869.tar.gz external_mesa3d-ed4a65c3cfdf88afba48860be34ce26f7c371869.tar.bz2 |
glx: Propagate the glXIsDirect protocol error back to the application
If the server returned BadContext, the error would just get droped on
the floor.
Fixes the piglit test glx-import-context-single-process
NOTE: This is a candidate for the 7.11 branch, but it also requires
the previous patch.
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'src/glx/glxcmds.c')
-rw-r--r-- | src/glx/glxcmds.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c index 0c77817..d3f5bf0 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 <sys/time.h> #ifdef XF86VIDMODE @@ -589,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; @@ -1429,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 <contextID> does not refer to a valid context, then a BadContext + * error is generated; if <contextID> 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); |