2013-08-23 01:06:53 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013, NVIDIA CORPORATION.
|
2013-08-23 01:16:15 +02:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and/or associated documentation files (the
|
|
|
|
* "Materials"), to deal in the Materials without restriction, including
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
* distribute, sublicense, and/or sell copies of the Materials, and to
|
|
|
|
* permit persons to whom the Materials are furnished to do so, subject to
|
|
|
|
* the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included
|
|
|
|
* unaltered in all copies or substantial portions of the Materials.
|
|
|
|
* Any additions, deletions, or changes to the original source files
|
|
|
|
* must be clearly indicated in accompanying documentation.
|
|
|
|
*
|
|
|
|
* If only executable code is distributed, then the accompanying
|
|
|
|
* documentation must state that "this software is based in part on the
|
|
|
|
* work of the Khronos Group."
|
|
|
|
*
|
|
|
|
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
2013-08-23 01:06:53 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(__LIB_GLX_MAPPING_H)
|
|
|
|
#define __LIB_GLX_MAPPING_H
|
|
|
|
|
2013-08-23 01:16:15 +02:00
|
|
|
#include "libglxabipriv.h"
|
2013-08-12 22:12:09 +02:00
|
|
|
#include "GLdispatch.h"
|
2015-04-23 20:30:34 +02:00
|
|
|
#include "lkdhash.h"
|
2013-08-23 01:06:53 +02:00
|
|
|
|
2015-04-14 19:58:43 +02:00
|
|
|
#define GLX_CLIENT_STRING_LAST_ATTRIB GLX_EXTENSIONS
|
|
|
|
|
2015-04-19 18:30:21 +02:00
|
|
|
typedef struct __GLXdispatchTableDynamicRec __GLXdispatchTableDynamic;
|
|
|
|
|
2013-08-23 01:16:15 +02:00
|
|
|
/*!
|
|
|
|
* Structure containing relevant per-vendor information.
|
|
|
|
*/
|
2015-04-29 18:19:51 +02:00
|
|
|
struct __GLXvendorInfoRec {
|
2014-01-24 04:51:49 +01:00
|
|
|
int vendorID; //< unique GLdispatch ID
|
2013-08-23 01:16:15 +02:00
|
|
|
char *name; //< name of the vendor
|
|
|
|
void *dlhandle; //< shared library handle
|
|
|
|
__GLXdispatchTableDynamic *dynDispatch; //< dynamic GLX dispatch table
|
2013-08-12 22:12:09 +02:00
|
|
|
__GLdispatchTable *glDispatch; //< GL dispatch table
|
2015-08-29 00:50:42 +02:00
|
|
|
|
|
|
|
const __GLXapiImports *glxvc;
|
|
|
|
__GLXdispatchTableStatic staticDispatch; //< static GLX dispatch table
|
2015-04-29 18:19:51 +02:00
|
|
|
};
|
2013-08-23 01:16:15 +02:00
|
|
|
|
2015-04-23 20:30:34 +02:00
|
|
|
typedef struct __GLXscreenXIDMappingHashRec __GLXscreenXIDMappingHash;
|
|
|
|
|
2015-04-14 19:58:43 +02:00
|
|
|
/*!
|
|
|
|
* Structure containing per-display information.
|
|
|
|
*/
|
|
|
|
typedef struct __GLXdisplayInfoRec {
|
|
|
|
char *clientStrings[GLX_CLIENT_STRING_LAST_ATTRIB];
|
2015-04-23 20:30:34 +02:00
|
|
|
|
2015-05-05 18:04:45 +02:00
|
|
|
/**
|
|
|
|
* An array of vendors for each screen.
|
|
|
|
*
|
|
|
|
* Do not access this directly. Instead, call \c __glXLookupVendorByScreen.
|
|
|
|
*/
|
|
|
|
__GLXvendorInfo **vendors;
|
|
|
|
glvnd_rwlock_t vendorLock;
|
|
|
|
|
2015-04-23 20:30:34 +02:00
|
|
|
DEFINE_LKDHASH(__GLXscreenXIDMappingHash, xidScreenHash);
|
2015-04-24 01:00:52 +02:00
|
|
|
|
2015-09-28 23:55:57 +02:00
|
|
|
/// True if the server supports the GLX extension.
|
|
|
|
Bool glxSupported;
|
|
|
|
|
|
|
|
/// The major opcode for GLX, if it's supported.
|
|
|
|
int glxMajorOpcode;
|
|
|
|
int glxFirstError;
|
|
|
|
|
|
|
|
Bool x11glvndSupported;
|
2015-04-24 01:00:52 +02:00
|
|
|
int x11glvndMajor;
|
|
|
|
int x11glvndMinor;
|
2015-04-14 19:58:43 +02:00
|
|
|
} __GLXdisplayInfo;
|
|
|
|
|
2013-08-23 01:16:15 +02:00
|
|
|
/*!
|
|
|
|
* Accessor functions used to retrieve the "current" dispatch table for each of
|
|
|
|
* the three types of dispatch tables (see libglxabi.h for an explanation of
|
|
|
|
* these types).
|
|
|
|
*/
|
|
|
|
const __GLXdispatchTableStatic * __glXGetStaticDispatch(Display *dpy,
|
|
|
|
const int screen);
|
2015-04-19 18:30:21 +02:00
|
|
|
__GLXvendorInfo *__glXGetDynDispatch(Display *dpy,
|
2013-08-23 01:16:15 +02:00
|
|
|
const int screen);
|
2013-08-12 22:12:09 +02:00
|
|
|
__GLdispatchTable *__glXGetGLDispatch(Display *dpy, const int screen);
|
2013-08-23 01:06:53 +02:00
|
|
|
|
2013-08-23 01:16:15 +02:00
|
|
|
/*!
|
|
|
|
* Various functions to manage mappings used to determine the screen
|
|
|
|
* of a particular GLX call.
|
|
|
|
*/
|
2016-01-04 21:05:09 +01:00
|
|
|
void __glXAddVendorContextMapping(Display *dpy, GLXContext context, __GLXvendorInfo *vendor);
|
|
|
|
void __glXRemoveVendorContextMapping(Display *dpy, GLXContext context);
|
2016-01-04 23:01:32 +01:00
|
|
|
int __glXVendorFromContext(GLXContext context, __GLXvendorInfo **retVendor);
|
2013-08-23 01:06:53 +02:00
|
|
|
|
2016-01-04 21:20:46 +01:00
|
|
|
void __glXAddVendorFBConfigMapping(Display *dpy, GLXFBConfig config, __GLXvendorInfo *vendor);
|
|
|
|
void __glXRemoveVendorFBConfigMapping(Display *dpy, GLXFBConfig config);
|
|
|
|
int __glXVendorFromFBConfig(Display *dpy, GLXFBConfig config, __GLXvendorInfo **retVendor);
|
2013-08-23 01:06:53 +02:00
|
|
|
|
2015-04-20 22:29:07 +02:00
|
|
|
void __glXAddScreenVisualMapping(Display *dpy, const XVisualInfo *visual, __GLXvendorInfo *vendor);
|
|
|
|
void __glXRemoveScreenVisualMapping(Display *dpy, const XVisualInfo *visual);
|
|
|
|
int __glXVendorFromVisual(Display *dpy, const XVisualInfo *visual, __GLXvendorInfo **retVendor);
|
|
|
|
|
2016-01-04 20:37:08 +01:00
|
|
|
void __glXAddVendorDrawableMapping(Display *dpy, GLXDrawable drawable, __GLXvendorInfo *vendor);
|
|
|
|
void __glXRemoveVendorDrawableMapping(Display *dpy, GLXDrawable drawable);
|
|
|
|
int __glXVendorFromDrawable(Display *dpy, GLXDrawable drawable, __GLXvendorInfo **retVendor);
|
2013-08-23 01:16:15 +02:00
|
|
|
|
|
|
|
__GLXextFuncPtr __glXGetGLXDispatchAddress(const GLubyte *procName);
|
2015-05-27 17:11:19 +02:00
|
|
|
__GLXextFuncPtr __glXGenerateGLXEntrypoint(const GLubyte *procName);
|
2013-08-23 01:16:15 +02:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* Looks up the vendor by name or screen number. This has the side effect of
|
|
|
|
* loading the vendor library if it has not been previously loaded.
|
|
|
|
*/
|
|
|
|
__GLXvendorInfo *__glXLookupVendorByName(const char *vendorName);
|
|
|
|
__GLXvendorInfo *__glXLookupVendorByScreen(Display *dpy, const int screen);
|
|
|
|
|
2015-04-14 19:58:43 +02:00
|
|
|
/*!
|
|
|
|
* Looks up the __GLXdisplayInfo structure for a display, creating it if
|
|
|
|
* necessary.
|
|
|
|
*/
|
|
|
|
__GLXdisplayInfo *__glXLookupDisplay(Display *dpy);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Frees the __GLXdisplayInfo structure for a display, if one exists.
|
|
|
|
*/
|
|
|
|
void __glXFreeDisplay(Display *dpy);
|
|
|
|
|
2013-11-24 23:01:49 +01:00
|
|
|
/*!
|
|
|
|
* Notifies libglvnd that a context has been marked for destruction.
|
|
|
|
*/
|
|
|
|
void __glXNotifyContextDestroyed(GLXContext ctx);
|
|
|
|
|
2013-08-23 01:16:15 +02:00
|
|
|
/*
|
|
|
|
* Close the vendor library and perform any relevant teardown. This should
|
2014-10-03 01:17:59 +02:00
|
|
|
* be called when the API library is unloaded.
|
2013-08-23 01:16:15 +02:00
|
|
|
*/
|
2014-10-03 01:17:59 +02:00
|
|
|
void __glXMappingTeardown(Bool doReset);
|
2013-08-23 01:06:53 +02:00
|
|
|
|
|
|
|
#endif /* __LIB_GLX_MAPPING_H */
|