Mesa (master): dri: Allow config options to be passed to the loader through extensions.

Eric Anholt anholt at kemper.freedesktop.org
Thu Oct 24 21:48:09 UTC 2013


Module: Mesa
Branch: master
Commit: cf5d8fc310dbf59a61e4859b79219b3ac3b223ac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf5d8fc310dbf59a61e4859b79219b3ac3b223ac

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jun 26 15:15:57 2013 -0700

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 <mattst88 at gmail.com>
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>

---

 include/GL/internal/dri_interface.h |   20 ++++++++++++++------
 src/glx/dri_glx.c                   |   17 ++++++++++++++---
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 33b41ea..3e54d60 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -330,12 +330,6 @@ struct __DRI2throttleExtensionRec {
 		    enum __DRI2throttleReason reason);
 };
 
-/**
- * XML document describing the configuration options supported by the
- * driver.
- */
-extern const char __driConfigOptions[];
-
 /*@}*/
 
 /**
@@ -1226,4 +1220,18 @@ struct __DRIrobustnessExtensionRec {
    __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
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index faed9d0..a1475b0 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




More information about the mesa-commit mailing list