summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-11-25 20:05:47 -0500
committerMarek Olšák <[email protected]>2019-11-28 14:36:32 -0500
commit5e81fbf44a5bfc23873c8bf67ec7adf450a886bf (patch)
treed83436240795005b9c74c7f3942f3becf445c0db
parentd61a21f439386b12752d498b1b1c85a891c50bc8 (diff)
util/driconfig: print ATTENTION if MESA_DEBUG=silent is not set
unix-bytebenchmark refuses to run if the driver prints ATTENTION to stderr. Acked-by: Eric Engestrom <[email protected]>
-rw-r--r--src/util/xmlconfig.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/util/xmlconfig.c b/src/util/xmlconfig.c
index 27db6c2ec10..b036145269e 100644
--- a/src/util/xmlconfig.c
+++ b/src/util/xmlconfig.c
@@ -52,6 +52,16 @@
#define PATH_MAX 4096
#endif
+static bool
+be_verbose(void)
+{
+ const char *s = getenv("MESA_DEBUG");
+ if (!s)
+ return true;
+
+ return strstr(s, "silent") == NULL;
+}
+
/** \brief Find an option in an option cache with the name as key */
static uint32_t
findOption(const driOptionCache *cache, const char *name)
@@ -548,9 +558,11 @@ parseOptInfoAttr(struct OptInfoData *data, const XML_Char **attr)
defaultVal = getenv (cache->info[opt].name);
if (defaultVal != NULL) {
/* don't use XML_WARNING, we want the user to see this! */
- fprintf (stderr,
- "ATTENTION: default value of option %s overridden by environment.\n",
- cache->info[opt].name);
+ if (be_verbose()) {
+ fprintf(stderr,
+ "ATTENTION: default value of option %s overridden by environment.\n",
+ cache->info[opt].name);
+ }
} else
defaultVal = attrVal[OA_DEFAULT];
if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal))
@@ -831,11 +843,14 @@ parseOptConfAttr(struct OptConfData *data, const XML_Char **attr)
/* don't use XML_WARNING, drirc defines options for all drivers,
* but not all drivers support them */
return;
- else if (getenv (cache->info[opt].name))
+ else if (getenv (cache->info[opt].name)) {
/* don't use XML_WARNING, we want the user to see this! */
- fprintf (stderr, "ATTENTION: option value of option %s ignored.\n",
- cache->info[opt].name);
- else if (!parseValue (&cache->values[opt], cache->info[opt].type, value))
+ if (be_verbose()) {
+ fprintf(stderr,
+ "ATTENTION: option value of option %s ignored.\n",
+ cache->info[opt].name);
+ }
+ } else if (!parseValue (&cache->values[opt], cache->info[opt].type, value))
XML_WARNING ("illegal option value: %s.", value);
}
}