summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glx/dri_common.c24
-rw-r--r--src/glx/dri_common.h2
2 files changed, 26 insertions, 0 deletions
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 5096c1f587e..0e06d51b4c7 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -84,6 +84,30 @@ ErrorMessageF(const char *f, ...)
}
}
+/**
+ * Print error message unless LIBGL_DEBUG is set to "quiet".
+ *
+ * The distinction between CriticalErrorMessageF and ErrorMessageF is
+ * that critcial errors will be printed by default, (even when
+ * LIBGL_DEBUG is unset).
+ */
+_X_HIDDEN void
+CriticalErrorMessageF(const char *f, ...)
+{
+ va_list args;
+ const char *env;
+
+ if (!(env = getenv("LIBGL_DEBUG")) || !strstr(env, "quiet")) {
+ fprintf(stderr, "libGL error: ");
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+
+ if (!env || !strstr(env, "verbose"))
+ fprintf(stderr, "libGL error: Try again with LIBGL_DEBUG=verbose for more details.\n");
+ }
+}
+
#ifndef DEFAULT_DRIVER_DIR
/* this is normally defined in Mesa/configs/default with DRI_DRIVER_SEARCH_PATH */
#define DEFAULT_DRIVER_DIR "/usr/local/lib/dri"
diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
index 3bcdebcc529..f5c7d456ee1 100644
--- a/src/glx/dri_common.h
+++ b/src/glx/dri_common.h
@@ -65,6 +65,8 @@ extern void InfoMessageF(const char *f, ...);
extern void ErrorMessageF(const char *f, ...);
+extern void CriticalErrorMessageF(const char *f, ...);
+
extern void *driOpenDriver(const char *driverName);
extern bool