summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Brenneman <kbrenneman@nvidia.com>2016-03-03 11:11:11 -0700
committerKyle Brenneman <kbrenneman@nvidia.com>2016-03-03 11:11:11 -0700
commit58d8dcaeb0eb8e1e80f8e086613d08c4817de9e5 (patch)
treeadd487d3b5736a385098068ecae2eaa057e00168
parentb45f4d8efbdaf6b752f10365ec32f1eda33356d8 (diff)
GLX: Change the __glx_Main function prototype.
Removed the vendorID and vendorName parameters from the __glx_Main function, since neither one is useful to a vendor. Instead, __glx_Main now takes the __GLXvendorInfo pointer as a parameter. We can use that to look up any additional per-vendor information that might be added in the future.
-rw-r--r--include/glvnd/libglxabi.h41
-rw-r--r--src/GLX/libglxmapping.c23
-rw-r--r--tests/GLX_dummy/GLX_dummy.c10
3 files changed, 45 insertions, 29 deletions
diff --git a/include/glvnd/libglxabi.h b/include/glvnd/libglxabi.h
index facd9c3..63d6186 100644
--- a/include/glvnd/libglxabi.h
+++ b/include/glvnd/libglxabi.h
@@ -311,25 +311,40 @@ typedef struct __GLXapiImportsRec {
/*****************************************************************************/
-/*!
- * Vendor libraries must export a function called __glx_Main() with the
- * following prototype. This function also performs a handshake based on the ABI
- * version number. This function receives a pointer to an exports table whose
- * lifetime is only guaranteed to be at a minimum that of the call to
- * __glx_Main(), in addition to the version number and a string identifying the
- * vendor. If there is an ABI version mismatch or some other error occurs, this
- * function returns NULL; otherwise this returns a pointer to a filled-in
- * dispatch table.
- */
#define __GLX_MAIN_PROTO_NAME "__glx_Main"
#define __GLX_MAIN_PROTO(version, exports, vendorName) \
const __GLXapiImports *__glx_Main(uint32_t version, \
const __GLXapiExports *exports, \
- const char *vendorName, \
- int vendorID)
+ __GLXvendorInfo *vendor)
typedef const __GLXapiImports *(*__PFNGLXMAINPROC)
- (uint32_t, const __GLXapiExports *, const char *, int);
+ (uint32_t version, const __GLXapiExports *exports, __GLXvendorInfo *vendor);
+
+/*!
+ * Vendor libraries must export a function called __glx_Main() with the
+ * following prototype.
+ *
+ * This function also performs a handshake based on the ABI version number.
+ * Vendor libraries can optionally use the version number to support older
+ * versions of the ABI.
+ *
+ * \param version The ABI version. The upper 16 bits contains the major version
+ * number, and the lower 16 bits contains the minor version number.
+ *
+ * \param exports The table of functions provided by libGLX. This pointer will
+ * remain valid for as long as the vendor is loaded.
+ *
+ * \param vendor The opaque pointer used to identify this vendor library. This
+ * may be used in future versions to provide additional per-vendor information.
+ *
+ * \return A pointer to a __GLXapiImports struct, which must remain valid for
+ * as long as the vendor is loaded. If the vendor library does not support the
+ * requested ABI version, or if some other error occurrs, then it should return
+ * \c NULL.
+ */
+const __GLXapiImports *__glx_Main(uint32_t version,
+ const __GLXapiExports *exports,
+ __GLXvendorInfo *vendor);
/*!
* @}
diff --git a/src/GLX/libglxmapping.c b/src/GLX/libglxmapping.c
index b588efe..5c947d8 100644
--- a/src/GLX/libglxmapping.c
+++ b/src/GLX/libglxmapping.c
@@ -501,18 +501,6 @@ __GLXvendorInfo *__glXLookupVendorByName(const char *vendorName)
vendor->vendorID = __glDispatchNewVendorID();
assert(vendor->vendorID >= 0);
- vendor->glxvc = (*glxMainProc)(GLX_VENDOR_ABI_VERSION,
- &glxExportsTable,
- vendor->name,
- vendor->vendorID);
- if (!vendor->glxvc) {
- goto fail;
- }
-
- if (!LookupVendorEntrypoints(vendor)) {
- goto fail;
- }
-
vendor->glDispatch = (__GLdispatchTable *)
__glDispatchCreateTable(
VendorGetProcAddressCallback,
@@ -525,6 +513,17 @@ __GLXvendorInfo *__glXLookupVendorByName(const char *vendorName)
/* Initialize the dynamic dispatch table */
LKDHASH_INIT(vendor->dynDispatchHash);
+ vendor->glxvc = (*glxMainProc)(GLX_VENDOR_ABI_VERSION,
+ &glxExportsTable,
+ vendor);
+ if (!vendor->glxvc) {
+ goto fail;
+ }
+
+ if (!LookupVendorEntrypoints(vendor)) {
+ goto fail;
+ }
+
HASH_ADD_KEYPTR(hh, _LH(__glXVendorNameHash), vendor->name,
strlen(vendor->name), pEntry);
LKDHASH_UNLOCK(__glXVendorNameHash);
diff --git a/tests/GLX_dummy/GLX_dummy.c b/tests/GLX_dummy/GLX_dummy.c
index 5b864f4..16f4c0c 100644
--- a/tests/GLX_dummy/GLX_dummy.c
+++ b/tests/GLX_dummy/GLX_dummy.c
@@ -42,7 +42,6 @@
#include "compiler.h"
-static char *thisVendorName;
static __GLXapiExports apiExports;
/*
@@ -372,7 +371,11 @@ static void dummy_glMakeCurrentTestResults(GLint req,
break;
case GL_MC_VENDOR_STRING:
{
- *ret = thisVendorName ? strdup(thisVendorName) : NULL;
+ // FIXME: This is used from testglxnscreens to check that the
+ // correct vendor library is loaded from each display. Originally,
+ // it used the vendor name passed to __glx_Main, but libGLX doesn't
+ // provide the vendor name anymore.
+ *ret = NULL;
}
break;
case GL_MC_LAST_REQ:
@@ -686,9 +689,8 @@ static const __GLXapiImports dummyImports =
#endif
};
-PUBLIC __GLX_MAIN_PROTO(version, exports, vendorName)
+PUBLIC __GLX_MAIN_PROTO(version, exports, vendor)
{
- thisVendorName = strdup(vendorName);
if (version <= GLX_VENDOR_ABI_VERSION) {
memcpy(&apiExports, exports, sizeof(*exports));
return &dummyImports;