pdp->base.destroyDisplay = dri3_destroy_display;
pdp->base.createScreen = dri3_create_screen;
- loader_set_logger(ErrorMessageF);
+ loader_set_logger(dri_message);
i = 0;
pdp->loader_extensions[i++] = &imageLoaderExtension.base;
#include <stdarg.h>
#include "glxclient.h"
#include "dri_common.h"
+#include "loader.h"
#ifndef RTLD_NOW
#define RTLD_NOW 0
#define RTLD_GLOBAL 0
#endif
+_X_HIDDEN void
+dri_message(int level, const char *f, ...)
+{
+ va_list args;
+ int threshold = _LOADER_WARNING;
+ const char *libgl_debug;
+
+ libgl_debug = getenv("LIBGL_DEBUG");
+ if (libgl_debug) {
+ if (strstr(libgl_debug, "quiet"))
+ threshold = _LOADER_FATAL;
+ else if (strstr(libgl_debug, "verbose"))
+ threshold = _LOADER_DEBUG;
+ }
+
+ /* Note that the _LOADER_* levels are lower numbers for more severe. */
+ if (level <= threshold) {
+ fprintf(stderr, "libGL%s: ", level <= _LOADER_WARNING ? " error" : "");
+ va_start(args, f);
+ vfprintf(stderr, f, args);
+ va_end(args);
+ }
+}
+
/**
* Print informational message to stderr if LIBGL_DEBUG is set to
* "verbose".
#include <GL/internal/dri_interface.h>
#include <stdbool.h>
+#if (__GNUC__ >= 3)
+#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
+#else
+#define PRINTFLIKE(f, a)
+#endif
+
typedef struct __GLXDRIconfigPrivateRec __GLXDRIconfigPrivate;
struct __GLXDRIconfigPrivateRec
extern const __DRIsystemTimeExtension systemTimeExtension;
-extern void InfoMessageF(const char *f, ...);
+extern void dri_message(int level, const char *f, ...) PRINTFLIKE(2, 3);
+extern void InfoMessageF(const char *f, ...);
extern void ErrorMessageF(const char *f, ...);
-
extern void CriticalErrorMessageF(const char *f, ...);
extern void *driOpenDriver(const char *driverName);