[Mesa-dev] [PATCH] dri: don't load .drirc from $HOME

Marek Olšák maraeo at gmail.com
Sat Jan 7 14:46:45 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

~/.drirc is created by the driconf tool (GPL license) and it overrides
system drirc settings and can't be changed by Mesa updates.
This drops support for the tool. It has been a source of major pain
for us and it continues to cause problems.

If people wanna keep this and enjoy the pain, I will make a v2 that
applies it to radeon drivers only.

v2: update comments and docs
---
 docs/application-issues.html            |  3 +-
 docs/postprocess.html                   |  3 +-
 include/GL/internal/dri_interface.h     |  2 +-
 src/mesa/drivers/dri/common/xmlconfig.c | 51 ++++++++++-----------------------
 4 files changed, 18 insertions(+), 41 deletions(-)

diff --git a/docs/application-issues.html b/docs/application-issues.html
index 6db0865..5605f33 100644
--- a/docs/application-issues.html
+++ b/docs/application-issues.html
@@ -26,22 +26,21 @@ This page documents known issues with some OpenGL applications.
 <p>
 <a href="http://www.topogun.com/">Topogun</a> for Linux (version 2, at least)
 creates a GLX visual without requesting a depth buffer.
 This causes bad rendering if the OpenGL driver happens to choose a visual
 without a depth buffer.
 </p>
 
 <p>
 Mesa 9.1.2 and later (will) support a DRI configuration option to work around
 this issue.
-Using the <a href="http://dri.freedesktop.org/wiki/DriConf">driconf</a> tool,
-set the "Create all visuals with a depth buffer" option before running Topogun.
+Set the "always_have_depth_buffer" environment variable before running Topogun.
 Then, all GLX visuals will be created with a depth buffer.
 </p>
 
 
 <h2>Old OpenGL games</h2>
 
 <p>
 Some old OpenGL games (approx. ten years or older) may crash during
 start-up because of an extension string buffer-overflow problem.
 </p>
diff --git a/docs/postprocess.html b/docs/postprocess.html
index db4abec..8108179 100644
--- a/docs/postprocess.html
+++ b/docs/postprocess.html
@@ -17,22 +17,21 @@
 <h1>Gallium Post-processing</h1>
 
 <p>
 The Gallium drivers support user-defined image post-processing.
 At the end of drawing a frame a post-processing filter can be applied to
 the rendered image.
 Example filters include morphological antialiasing and cell shading.
 </p>
 
 <p>
-The filters can be toggled per-app via driconf, or per-session via the
-corresponding environment variables.
+The filters can be via the corresponding environment variables.
 </p>
 
 <p>
 Multiple filters can be used together.
 </p>
 
 
 <h2>PP environment variables</h2>
 
 <ul>
diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
index 8922356..7468cab 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -1515,21 +1515,21 @@ 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.
+ * the loader.
  */
 #define __DRI_CONFIG_OPTIONS "DRI_ConfigOptions"
 #define __DRI_CONFIG_OPTIONS_VERSION 1
 
 typedef struct __DRIconfigOptionsExtensionRec {
    __DRIextension base;
    const char *xml;
 } __DRIconfigOptionsExtension;
 
 /**
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c
index a8f7c9b..3d6cb67 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -937,65 +937,44 @@ static void parseOneConfigFile (XML_Parser p) {
     close (fd);
 #undef BUF_SIZE
 }
 
 #ifndef SYSCONFDIR
 #define SYSCONFDIR "/etc"
 #endif
 
 void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
 			  int screenNum, const char *driverName) {
-    char *filenames[2] = { SYSCONFDIR "/drirc", NULL};
-    char *home;
-    uint32_t i;
     struct OptConfData userData;
+    XML_Parser p;
 
     initOptionCache (cache, info);
 
     userData.cache = cache;
     userData.screenNum = screenNum;
     userData.driverName = driverName;
     userData.execName = GET_PROGRAM_NAME();
 
-    if ((home = getenv ("HOME"))) {
-	uint32_t len = strlen (home);
-	filenames[1] = malloc(len + 7+1);
-	if (filenames[1] == NULL)
-	    __driUtilMessage ("Can't allocate memory for %s/.drirc.", home);
-	else {
-	    memcpy (filenames[1], home, len);
-	    memcpy (filenames[1] + len, "/.drirc", 7+1);
-	}
-    }
-
-    for (i = 0; i < 2; ++i) {
-	XML_Parser p;
-	if (filenames[i] == NULL)
-	    continue;
-
-	p = XML_ParserCreate (NULL); /* use encoding specified by file */
-	XML_SetElementHandler (p, optConfStartElem, optConfEndElem);
-	XML_SetUserData (p, &userData);
-	userData.parser = p;
-	userData.name = filenames[i];
-	userData.ignoringDevice = 0;
-	userData.ignoringApp = 0;
-	userData.inDriConf = 0;
-	userData.inDevice = 0;
-	userData.inApp = 0;
-	userData.inOption = 0;
-
-	parseOneConfigFile (p);
-	XML_ParserFree (p);
-    }
-
-    free(filenames[1]);
+    p = XML_ParserCreate (NULL); /* use encoding specified by file */
+    XML_SetElementHandler (p, optConfStartElem, optConfEndElem);
+    XML_SetUserData (p, &userData);
+    userData.parser = p;
+    userData.name = SYSCONFDIR "/drirc";
+    userData.ignoringDevice = 0;
+    userData.ignoringApp = 0;
+    userData.inDriConf = 0;
+    userData.inDevice = 0;
+    userData.inApp = 0;
+    userData.inOption = 0;
+
+    parseOneConfigFile (p);
+    XML_ParserFree (p);
 }
 
 void driDestroyOptionInfo (driOptionCache *info) {
     driDestroyOptionCache (info);
     if (info->info) {
 	uint32_t i, size = 1 << info->tableSize;
 	for (i = 0; i < size; ++i) {
 	    if (info->info[i].name) {
 		free(info->info[i].name);
 		free(info->info[i].ranges);
-- 
2.7.4



More information about the mesa-dev mailing list