[Mesa-dev] [PATCH] mesa: load custom drirc only when specified in env variable
Edmondo Tommasina
edmondo.tommasina at gmail.com
Mon Jan 9 18:16:48 UTC 2017
Define a new MESA_CUSTOM_DRIRC environment variable to load
a drirc custom file, instead of blindly using the hardcoded
${HOME}/.drirc file created the driconf tool.
Some more discussion about the driconf issues can be found
in reading following mesa-dev thread:
https://lists.freedesktop.org/archives/mesa-dev/2017-January/139864.html
Users can now specify which custom driconf file they want
to use (for example the ${HOME}/.drirc created with the
tool).
Example:
$ glxgears
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
359 frames in 5.0 seconds = 71.579 FPS
300 frames in 5.0 seconds = 60.000 FPS
$ cat noblank.drirc
<driconf>
<device>
<application name="Default">
<option name="vblank_mode" value="0" />
</application>
</device>
</driconf>
$ MESA_CUSTOM_DRIRC=/home/edmondo/noblank.drirc glxgears
27332 frames in 5.0 seconds = 5466.378 FPS
29730 frames in 5.0 seconds = 5945.912 FPS
---
docs/application-issues.html | 4 ++--
docs/envvars.html | 1 +
docs/postprocess.html | 4 ++--
src/mesa/drivers/dri/common/xmlconfig.c | 16 +---------------
4 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/docs/application-issues.html b/docs/application-issues.html
index 6db0865..10e1957 100644
--- a/docs/application-issues.html
+++ b/docs/application-issues.html
@@ -33,8 +33,8 @@ without a depth buffer.
<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
+or use a custom drirc file (MESA_CUSTOM_DRIRC).
Then, all GLX visuals will be created with a depth buffer.
</p>
diff --git a/docs/envvars.html b/docs/envvars.html
index 9eee8db..e168a38 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -116,6 +116,7 @@ glGetString(GL_SHADING_LANGUAGE_VERSION). Valid values are integers, such as
if it's higher than what's normally reported. (for developers only)
<li>MESA_GLSL - <a href="shading.html#envvars">shading language compiler options</a>
<li>MESA_NO_MINMAX_CACHE - when set, the minmax index cache is globally disabled.
+<li>MESA_CUSTOM_DRIRC - load custom drirc file.
</ul>
diff --git a/docs/postprocess.html b/docs/postprocess.html
index db4abec..7efa99d 100644
--- a/docs/postprocess.html
+++ b/docs/postprocess.html
@@ -24,8 +24,8 @@ 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 toggled via corresponding environment variables
+or a custom drirc file (MESA_CUSTOM_DRIRC).
</p>
<p>
diff --git a/src/mesa/drivers/dri/common/xmlconfig.c b/src/mesa/drivers/dri/common/xmlconfig.c
index a8f7c9b..c36b78a 100644
--- a/src/mesa/drivers/dri/common/xmlconfig.c
+++ b/src/mesa/drivers/dri/common/xmlconfig.c
@@ -944,8 +944,7 @@ static void parseOneConfigFile (XML_Parser p) {
void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
int screenNum, const char *driverName) {
- char *filenames[2] = { SYSCONFDIR "/drirc", NULL};
- char *home;
+ char *filenames[2] = { SYSCONFDIR "/drirc", getenv("MESA_CUSTOM_DRIRC") };
uint32_t i;
struct OptConfData userData;
@@ -956,17 +955,6 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
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)
@@ -987,8 +975,6 @@ void driParseConfigFiles (driOptionCache *cache, const driOptionCache *info,
parseOneConfigFile (p);
XML_ParserFree (p);
}
-
- free(filenames[1]);
}
void driDestroyOptionInfo (driOptionCache *info) {
--
2.10.0
More information about the mesa-dev
mailing list