diff options
author | Carl Worth <[email protected]> | 2012-02-03 16:17:29 -0800 |
---|---|---|
committer | Carl Worth <[email protected]> | 2012-02-08 17:07:53 -0800 |
commit | 92bef0bfa121e0e58112ffae352c8ad9e5da6307 (patch) | |
tree | 2b1133a16e64ee2090850c7e4b86d577599f19bb /src/glx/dri_common.c | |
parent | c09504c343d904dc8c135c9b7241e8315c134d0f (diff) |
dri: Add a CriticalErrorMessageF macro.
Sometimes an error is so sever that we want to print it even when the
user hasn't specifically requested debugging by setting LIBGL_DEBUG.
Add a CriticalErrorMessageF macro to be used for this case. (The error
message can still be slienced with the existing LIBGL_DEBUG=quiet).
For critical error messages we also direct the user to set the
LIBGL_DEBUG environment variable for more details.
Reviewed-by: Eugeni Dodonov <[email protected]>
Diffstat (limited to 'src/glx/dri_common.c')
-rw-r--r-- | src/glx/dri_common.c | 24 |
1 files changed, 24 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" |