glx: Convert undocumented LIBGL_DIAGNOSTIC to LIBGL_DEBUG=verbose
authorAdam Jackson <ajax@redhat.com>
Tue, 20 Apr 2021 02:59:56 +0000 (22:59 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 22 Apr 2021 18:11:52 +0000 (18:11 +0000)
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10381>

src/glx/apple/apple_glx_context.c
src/glx/apple/apple_glx_log.c
src/glx/apple/apple_glx_pbuffer.c
src/glx/glxext.c

index ff66ed4..d80385b 100644 (file)
@@ -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;
    }
index ea39d30..3602a8c 100644 (file)
 #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) {
index 8c94d20..bab4d3f 100644 (file)
@@ -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;
       }
 
index 7370d85..d02480f 100644 (file)
@@ -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;
       }
    }