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 <mattst88@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
enum __DRI2throttleReason reason);
};
-/**
- * XML document describing the configuration options supported by the
- * driver.
- */
-extern const char __driConfigOptions[];
-
/*@}*/
/**
__DRIextension base;
};
+/**
+ * DRI config options extension.
+ *
+ * This extension provides the XML string containing driver options for use by
+ * the loader in supporting the driconf application.
+ */
+#define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
+#define __DRI_CONFIG_OPTIONS_VERSION 1
+
+typedef struct __DRIconfigOptionsExtensionRec {
+ __DRIextension base;
+ const char *xml;
+} __DRIconfigOptionsExtension;
+
#endif
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