Mesa (master): mapi: Respect MESA_DEBUG=silent for no-op debug output.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 19 21:21:07 UTC 2021
Module: Mesa
Branch: master
Commit: c1352205ab8cf0c1c5e2ad979ca9dda1b3edb089
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1352205ab8cf0c1c5e2ad979ca9dda1b3edb089
Author: Eric Anholt <eric at anholt.net>
Date: Wed Apr 14 11:28:54 2021 -0700
mapi: Respect MESA_DEBUG=silent for no-op debug output.
We set this in deqp-runner runs to disable Mesa debug/debugoptimized
builds printing to stderr for expected GL test behavior, and with the
addition of dEQP-EGL mapi got very verbose. Move it to a call_once() too
to avoid data races.
Acked-by: Eric Engestrom <eric at engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10240>
---
src/mapi/table.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/mapi/table.c b/src/mapi/table.c
index 748750197c6..b0dd51f8622 100644
--- a/src/mapi/table.c
+++ b/src/mapi/table.c
@@ -25,9 +25,12 @@
* Chia-I Wu <olv at lunarg.com>
*/
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
+#include "c11/threads.h"
#include "table.h"
static nop_handler_proc nop_handler = NULL;
@@ -38,6 +41,17 @@ table_set_noop_handler(nop_handler_proc func)
nop_handler = func;
}
+static bool log_noop;
+
+static void check_debug_env(void)
+{
+ const char *debug = getenv("MESA_DEBUG");
+ if (!debug)
+ debug = getenv("LIBGL_DEBUG");
+ if (debug && strcmp(debug, "silent") != 0)
+ log_noop = true;
+}
+
static void
noop_warn(const char *name)
{
@@ -45,12 +59,10 @@ noop_warn(const char *name)
nop_handler(name);
}
else {
- static int debug = -1;
-
- if (debug < 0)
- debug = (getenv("MESA_DEBUG") || getenv("LIBGL_DEBUG"));
+ static once_flag flag = ONCE_FLAG_INIT;
+ call_once(&flag, check_debug_env);
- if (debug)
+ if (log_noop)
fprintf(stderr, "%s is no-op\n", name);
}
}
More information about the mesa-commit
mailing list