summaryrefslogtreecommitdiffstats
path: root/src/glx/dri_common.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-09-23 14:44:10 -0700
committerEric Anholt <[email protected]>2013-10-24 14:04:20 -0700
commitfcb57a8210e819cc14a39c79f23530eb22296da0 (patch)
tree306eca1c0435a67820adffbc553737868e07d911 /src/glx/dri_common.c
parent6868923702d5cdb93d06627ea4f40abe99cda75a (diff)
glx: Add an optional function call for getting the DRI driver interface.
The previous interface relied on a static struct, which meant that the driver didn't get a chance to edit the struct before the struct got used. For megadrivers, I want struct specific to the driver being loaded. v2: Fix the prototype in the docs (caught by Marek). Since the driver name was in the function, we didn't need to also pass it in. v3: Fix asprintf error checking (caught by Matt's gcc). Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/glx/dri_common.c')
-rw-r--r--src/glx/dri_common.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index f1d1164571e..22ba248cfb0 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -188,9 +188,24 @@ driOpenDriver(const char *driverName)
}
_X_HIDDEN const __DRIextension **
-driGetDriverExtensions(void *handle)
+driGetDriverExtensions(void *handle, const char *driver_name)
{
const __DRIextension **extensions = NULL;
+ const __DRIextension **(*get_extensions)(void);
+ char *get_extensions_name;
+
+ if (asprintf(&get_extensions_name, "%s_%s",
+ __DRI_DRIVER_GET_EXTENSIONS, driver_name) != -1) {
+ get_extensions = dlsym(handle, get_extensions_name);
+ if (get_extensions) {
+ free(get_extensions_name);
+ return get_extensions();
+ } else {
+ InfoMessageF("driver does not expose %s(): %s\n",
+ get_extensions_name, dlerror());
+ free(get_extensions_name);
+ }
+ }
extensions = dlsym(handle, __DRI_DRIVER_EXTENSIONS);
if (extensions == NULL) {