[Mesa-dev] [PATCH 01/16] dri: define a version 2 of the DRI_ConfigOptions extension

Nicolai Hähnle nhaehnle at gmail.com
Fri Jun 30 12:45:42 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

The new function is defined to return a malloc'ed pointer. In the
following patches, this helps avoid leaking library handles when pipe
drivers are linked dynamically.

It also allows us to generate the XML string on the fly in the future.
---
 include/GL/internal/dri_interface.h | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 6992da1..197e0a6 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1609,27 +1609,43 @@ struct __DRI2configQueryExtensionRec {
 typedef struct __DRIrobustnessExtensionRec __DRIrobustnessExtension;
 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.
+ *
+ * v2:
+ * - Add the getXml getter function which allows the driver more flexibility in
+ *   how the XML is provided.
+ * - Deprecate the direct xml pointer. It is only provided as a fallback for
+ *   older versions of libGL and must not be used by clients that are aware of
+ *   the newer version. Future driver versions may set it to NULL.
  */
 #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
-#define __DRI_CONFIG_OPTIONS_VERSION 1
+#define __DRI_CONFIG_OPTIONS_VERSION 2
 
 typedef struct __DRIconfigOptionsExtensionRec {
    __DRIextension base;
-   const char *xml;
+   const char *xml; /**< deprecated since v2, use getXml instead */
+
+   /**
+    * Get an XML string that describes available driver options for use by a
+    * config application.
+    *
+    * The returned string must be heap-allocated. The caller is responsible for
+    * freeing it.
+    */
+   char *(*getXml)(const char *driver_name);
 } __DRIconfigOptionsExtension;
 
 /**
  * This extension provides a driver vtable to a set of common driver helper
  * functions (driCoreExtension, driDRI2Extension) within the driver
  * implementation, as opposed to having to pass them through a global
  * variable.
  *
  * It is not intended to be public API to the actual loader, and the vtable
  * layout may change at any time.
-- 
2.9.3



More information about the mesa-dev mailing list