diff options
author | Kyle Brenneman <kbrenneman@nvidia.com> | 2016-02-26 14:41:30 -0700 |
---|---|---|
committer | Kyle Brenneman <kbrenneman@nvidia.com> | 2016-02-29 13:50:38 -0700 |
commit | 88807b95b9d119b8812446ae8a1fc585f9770e94 (patch) | |
tree | 8377ac66b6afb1cb911396d9614c0b64df2ec543 | |
parent | e59233a1a96afb30a50927ac7a93aef5978cd20b (diff) |
GLX: Change the mapping functions to return a vendor directly.
Changed vendorFromContext, vendorFromFBConfig, and vendorFromDrawable to return
the vendor pointer as its return value instead of using a pointer.
Returning by pointer was necessary when the functions would also return a
screen number. But, GLX objects are now associated directly with a vendor,
not with any particular screen or display.
-rw-r--r-- | include/glvnd/libglxabi.h | 27 | ||||
-rw-r--r-- | src/GLX/libglx.c | 15 | ||||
-rw-r--r-- | src/GLX/libglxmapping.c | 14 | ||||
-rw-r--r-- | src/GLX/libglxmapping.h | 6 |
4 files changed, 25 insertions, 37 deletions
diff --git a/include/glvnd/libglxabi.h b/include/glvnd/libglxabi.h index 3e4d773..4d25b24 100644 --- a/include/glvnd/libglxabi.h +++ b/include/glvnd/libglxabi.h @@ -151,13 +151,12 @@ typedef struct __GLXapiExportsRec { /************************************************************************ * These routines are used by vendor dispatch functions to look up - * and add mappings between various objects and screens. + * and add mappings between various objects and vendors. ************************************************************************/ /*! - * Records the screen number and vendor for a context. The screen and - * vendor must be the ones returned for the XVisualInfo or GLXFBConfig that - * the context is created from. + * Records the vendor for a context. The vendor must be the one returned + * for the XVisualInfo or GLXFBConfig that the context is created from. * * \param dpy The display pointer. * \param context The context handle. @@ -173,27 +172,25 @@ typedef struct __GLXapiExportsRec { void (*removeVendorContextMapping)(Display *dpy, GLXContext context); /*! - * Looks up the screen and vendor for a context. + * Looks up the vendor for a context. * - * If no mapping is found, then \p retScreen will be set to -1, and - * \p retVendor and \p retDisplay will be set to NULL. - * - * \p retScreen, \p retVendor, and \p retDisplay may be NULL if the screen, - * vendor, or display are not required. + * If no mapping is found, then this function will return \c NULL. No + * errors are raised, so the dispatch function must raise any appropriate X + * errors. * * Note that this function does not take a display connection, since * there are cases (e.g., glXGetContextIDEXT) that take a GLXContext but * not a display. * * \param context The context to look up. - * \param[out] retVendor Returns the vendor. - * \return Zero if a match was found, or non-zero if it was not. + * \return The vendor for the context, or NULL if no matching context was + * found. */ - int (*vendorFromContext)(GLXContext context, __GLXvendorInfo **retVendor); + __GLXvendorInfo * (*vendorFromContext)(GLXContext context); int (*addVendorFBConfigMapping)(Display *dpy, GLXFBConfig config, __GLXvendorInfo *vendor); void (*removeVendorFBConfigMapping)(Display *dpy, GLXFBConfig config); - int (*vendorFromFBConfig)(Display *dpy, GLXFBConfig config, __GLXvendorInfo **retVendor); + __GLXvendorInfo * (*vendorFromFBConfig)(Display *dpy, GLXFBConfig config); int (*addVendorDrawableMapping)(Display *dpy, GLXDrawable drawable, __GLXvendorInfo *vendor); void (*removeVendorDrawableMapping)(Display *dpy, GLXDrawable drawable); @@ -211,7 +208,7 @@ typedef struct __GLXapiExportsRec { * All of this should be opaque to a dispatch function, since the only * thing that matters is finding out which vendor to dispatch to. */ - int (*vendorFromDrawable)(Display *dpy, GLXDrawable drawable, __GLXvendorInfo **retVendor); + __GLXvendorInfo * (*vendorFromDrawable)(Display *dpy, GLXDrawable drawable); } __GLXapiExports; diff --git a/src/GLX/libglx.c b/src/GLX/libglx.c index 774bd25..01ea9a7 100644 --- a/src/GLX/libglx.c +++ b/src/GLX/libglx.c @@ -163,7 +163,7 @@ static __GLXvendorInfo *CommonDispatchDrawable(Display *dpy, GLXDrawable draw, if (draw != None) { __glXThreadInitialize(); - __glXVendorFromDrawable(dpy, draw, &vendor); + vendor = __glXVendorFromDrawable(dpy, draw); } if (vendor == NULL) { __glXSendError(dpy, errorCode, draw, minorCode, coreX11error); @@ -178,7 +178,7 @@ static __GLXvendorInfo *CommonDispatchContext(Display *dpy, GLXContext context, if (context != NULL) { __glXThreadInitialize(); - __glXVendorFromContext(context, &vendor); + vendor = __glXVendorFromContext(context); } if (vendor == NULL) { __glXSendError(dpy, GLXBadContext, 0, minorCode, False); @@ -193,7 +193,7 @@ static __GLXvendorInfo *CommonDispatchFBConfig(Display *dpy, GLXFBConfig config, if (config != NULL) { __glXThreadInitialize(); - __glXVendorFromFBConfig(dpy, config, &vendor); + vendor = __glXVendorFromFBConfig(dpy, config); } if (vendor == NULL) { __glXSendError(dpy, GLXBadFBConfig, 0, minorCode, False); @@ -432,7 +432,7 @@ static void glXFreeContextEXT(Display *dpy, GLXContext context) __glXThreadInitialize(); - __glXVendorFromContext(context, &vendor); + vendor = __glXVendorFromContext(context); if (vendor != NULL && vendor->staticDispatch.freeContextEXT != NULL) { __glXRemoveVendorContextMapping(dpy, context); vendor->staticDispatch.freeContextEXT(dpy, context); @@ -677,7 +677,7 @@ int __glXAddVendorContextMapping(Display *dpy, GLXContext context, __GLXvendorIn return 0; } -int __glXVendorFromContext(GLXContext context, __GLXvendorInfo **retVendor) +__GLXvendorInfo *__glXVendorFromContext(GLXContext context) { __GLXcontextInfo *ctxInfo; __GLXvendorInfo *vendor = NULL; @@ -689,10 +689,7 @@ int __glXVendorFromContext(GLXContext context, __GLXvendorInfo **retVendor) } __glvndPthreadFuncs.mutex_unlock(&glxContextHashLock); - if (retVendor != NULL) { - *retVendor = vendor; - } - return (vendor != NULL ? 0 : -1); + return vendor; } static void FreeContextInfo(__GLXcontextInfo *ctx) diff --git a/src/GLX/libglxmapping.c b/src/GLX/libglxmapping.c index 5b5d879..7701c24 100644 --- a/src/GLX/libglxmapping.c +++ b/src/GLX/libglxmapping.c @@ -849,7 +849,7 @@ void __glXRemoveVendorFBConfigMapping(Display *dpy, GLXFBConfig config) LKDHASH_UNLOCK(fbconfigHashtable); } -int __glXVendorFromFBConfig(Display *dpy, GLXFBConfig config, __GLXvendorInfo **retVendor) +__GLXvendorInfo *__glXVendorFromFBConfig(Display *dpy, GLXFBConfig config) { __GLXvendorConfigMappingHash *pEntry; __GLXvendorInfo *vendor = NULL; @@ -866,10 +866,7 @@ int __glXVendorFromFBConfig(Display *dpy, GLXFBConfig config, __GLXvendorInfo ** LKDHASH_UNLOCK(fbconfigHashtable); - if (retVendor != NULL) { - *retVendor = vendor; - } - return (vendor != NULL ? 0 : -1); + return vendor; } @@ -995,7 +992,7 @@ void __glXRemoveVendorDrawableMapping(Display *dpy, GLXDrawable drawable) } -int __glXVendorFromDrawable(Display *dpy, GLXDrawable drawable, __GLXvendorInfo **retVendor) +__GLXvendorInfo *__glXVendorFromDrawable(Display *dpy, GLXDrawable drawable) { __glXThreadInitialize(); @@ -1010,10 +1007,7 @@ int __glXVendorFromDrawable(Display *dpy, GLXDrawable drawable, __GLXvendorInfo } } - if (retVendor != NULL) { - *retVendor = vendor; - } - return (vendor != NULL ? 0 : -1); + return vendor; } /*! diff --git a/src/GLX/libglxmapping.h b/src/GLX/libglxmapping.h index 51a8bff..525ea27 100644 --- a/src/GLX/libglxmapping.h +++ b/src/GLX/libglxmapping.h @@ -100,15 +100,15 @@ __GLdispatchTable *__glXGetGLDispatch(Display *dpy, const int screen); */ int __glXAddVendorContextMapping(Display *dpy, GLXContext context, __GLXvendorInfo *vendor); void __glXRemoveVendorContextMapping(Display *dpy, GLXContext context); -int __glXVendorFromContext(GLXContext context, __GLXvendorInfo **retVendor); +__GLXvendorInfo *__glXVendorFromContext(GLXContext context); int __glXAddVendorFBConfigMapping(Display *dpy, GLXFBConfig config, __GLXvendorInfo *vendor); void __glXRemoveVendorFBConfigMapping(Display *dpy, GLXFBConfig config); -int __glXVendorFromFBConfig(Display *dpy, GLXFBConfig config, __GLXvendorInfo **retVendor); +__GLXvendorInfo *__glXVendorFromFBConfig(Display *dpy, GLXFBConfig config); int __glXAddVendorDrawableMapping(Display *dpy, GLXDrawable drawable, __GLXvendorInfo *vendor); void __glXRemoveVendorDrawableMapping(Display *dpy, GLXDrawable drawable); -int __glXVendorFromDrawable(Display *dpy, GLXDrawable drawable, __GLXvendorInfo **retVendor); +__GLXvendorInfo *__glXVendorFromDrawable(Display *dpy, GLXDrawable drawable); __GLXextFuncPtr __glXGetGLXDispatchAddress(const GLubyte *procName); __GLXextFuncPtr __glXGenerateGLXEntrypoint(const GLubyte *procName); |