Mesa (master): glx: Convert undocumented LIBGL_DIAGNOSTIC to LIBGL_DEBUG=verbose
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 22 18:42:45 UTC 2021
Module: Mesa
Branch: master
Commit: 70f66bb5ea0d703b1da7673eba320ccaa21fe921
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=70f66bb5ea0d703b1da7673eba320ccaa21fe921
Author: Adam Jackson <ajax at redhat.com>
Date: Mon Apr 19 22:59:56 2021 -0400
glx: Convert undocumented LIBGL_DIAGNOSTIC to LIBGL_DEBUG=verbose
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10381>
---
src/glx/apple/apple_glx_context.c | 3 +--
src/glx/apple/apple_glx_log.c | 16 ++--------------
src/glx/apple/apple_glx_pbuffer.c | 16 ++++++----------
src/glx/glxext.c | 14 +++++---------
4 files changed, 14 insertions(+), 35 deletions(-)
diff --git a/src/glx/apple/apple_glx_context.c b/src/glx/apple/apple_glx_context.c
index ff66ed499bf..d80385b2aaf 100644
--- a/src/glx/apple/apple_glx_context.c
+++ b/src/glx/apple/apple_glx_context.c
@@ -183,8 +183,7 @@ apple_glx_create_context(void **ptr, Display * dpy, int screen,
*x11errorptr = false;
}
- if (env_var_as_boolean("LIBGL_DIAGNOSTIC", false))
- fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
+ DebugMessageF("error: %s\n", apple_cgl.error_string(error));
return true;
}
diff --git a/src/glx/apple/apple_glx_log.c b/src/glx/apple/apple_glx_log.c
index ea39d30954e..3602a8c6248 100644
--- a/src/glx/apple/apple_glx_log.c
+++ b/src/glx/apple/apple_glx_log.c
@@ -38,14 +38,9 @@
#include "apple_glx_log.h"
#include "util/debug.h"
-static bool diagnostic = false;
static aslclient aslc;
void apple_glx_log_init(void) {
- if (env_var_as_boolean("LIBGL_DIAGNOSTIC", false)) {
- diagnostic = true;
- }
-
aslc = asl_open(NULL, NULL, 0);
}
@@ -90,15 +85,8 @@ void _apple_glx_vlog(int level, const char *file, const char *function,
#endif
}
- if (diagnostic) {
- va_list args2;
- va_copy(args2, args);
-
- fprintf(stderr, "%-9s %24s:%-4d %s(%"PRIu64"): ",
- _asl_level_string(level), file, line, function, thread);
- vfprintf(stderr, fmt, args2);
- va_end(args2);
- }
+ DebugMessageF("%-9s %24s:%-4d %s(%"PRIu64"): ",
+ _asl_level_string(level), file, line, function, thread);
msg = asl_new(ASL_TYPE_MSG);
if (msg) {
diff --git a/src/glx/apple/apple_glx_pbuffer.c b/src/glx/apple/apple_glx_pbuffer.c
index 8c94d2010f4..bab4d3ff45b 100644
--- a/src/glx/apple/apple_glx_pbuffer.c
+++ b/src/glx/apple/apple_glx_pbuffer.c
@@ -210,10 +210,8 @@ get_max_size(int *widthresult, int *heightresult)
err = apple_cgl.choose_pixel_format(attr, &pfobj, &vsref);
if (kCGLNoError != err) {
- if (env_var_as_boolean("LIBGL_DIAGNOSTIC", false)) {
- printf("choose_pixel_format error in %s: %s\n", __func__,
- apple_cgl.error_string(err));
- }
+ DebugMessageF("choose_pixel_format error in %s: %s\n", __func__,
+ apple_cgl.error_string(err));
return true;
}
@@ -222,10 +220,8 @@ get_max_size(int *widthresult, int *heightresult)
err = apple_cgl.create_context(pfobj, NULL, &newcontext);
if (kCGLNoError != err) {
- if (env_var_as_boolean("LIBGL_DIAGNOSTIC", false)) {
- printf("create_context error in %s: %s\n", __func__,
- apple_cgl.error_string(err));
- }
+ DebugMessageF("create_context error in %s: %s\n", __func__,
+ apple_cgl.error_string(err));
apple_cgl.destroy_pixel_format(pfobj);
@@ -235,8 +231,8 @@ get_max_size(int *widthresult, int *heightresult)
err = apple_cgl.set_current_context(newcontext);
if (kCGLNoError != err) {
- printf("set_current_context error in %s: %s\n", __func__,
- apple_cgl.error_string(err));
+ DebugMessageF("set_current_context error in %s: %s\n", __func__,
+ apple_cgl.error_string(err));
return true;
}
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 7370d8596ff..d02480f27d2 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -621,16 +621,12 @@ __glXInitializeVisualConfigFromTags(struct glx_config * config, int count,
case None:
i = count;
break;
- default:
- if(env_var_as_boolean("LIBGL_DIAGNOSTIC", false)) {
- long int tagvalue = *bp++;
- fprintf(stderr, "WARNING: unknown GLX tag from server: "
- "tag 0x%lx value 0x%lx\n", tag, tagvalue);
- } else {
- /* Ignore the unrecognized tag's value */
- bp++;
+ default: {
+ long int tagvalue = *bp++;
+ DebugMessageF("WARNING: unknown GLX tag from server: "
+ "tag 0x%lx value 0x%lx\n", tag, tagvalue);
+ break;
}
- break;
}
}
More information about the mesa-commit
mailing list