From cf5d8fc310dbf59a61e4859b79219b3ac3b223ac Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 26 Jun 2013 15:15:57 -0700 Subject: dri: Allow config options to be passed to the loader through extensions. Turns out already we have this nice mechanism for providing optional things from the driver to the loader, and I was going to have to rename the public global symbol to avoid conflicts when doing megadrivers. While the former __driConfigOptions is technically loader interface, this is the only loader that made use of that symbol. Continue paying attention to it if we can't find the new option, to retain compatibility with old drivers. Reviewed-by: Matt Turner Reviewed-by: Chad Versace Reviewed-by: Emil Velikov --- src/glx/dri_glx.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/glx/dri_glx.c') diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c index faed9d0d16..a1475b02ba 100644 --- a/src/glx/dri_glx.c +++ b/src/glx/dri_glx.c @@ -184,10 +184,21 @@ _X_EXPORT const char * glXGetDriverConfig(const char *driverName) { void *handle = driOpenDriver(driverName); - if (handle) - return dlsym(handle, "__driConfigOptions"); - else + const __DRIextension **extensions; + + if (!handle) return NULL; + + extensions = driGetDriverExtensions(handle); + if (extensions) { + for (int i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_CONFIG_OPTIONS) == 0) + return ((__DRIconfigOptionsExtension *)extensions[i])->xml; + } + } + + /* Fall back to the old method */ + return dlsym(handle, "__driConfigOptions"); } #ifdef XDAMAGE_1_1_INTERFACE -- cgit v1.2.3