diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 8d2590a8fee..dcf1070a287 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -51,30 +51,6 @@ #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); - } -} - #ifndef GL_LIB_NAME #define GL_LIB_NAME "libGL.so.1" #endif @@ -230,7 +206,7 @@ driConfigEqual(const __DRIcoreExtension *core, if (config->visualRating == GLX_NONE) { static int warned; if (!warned) { - dri_message(_LOADER_DEBUG, + glx_message(_LOADER_DEBUG, "Not downgrading visual rating\n"); warned = 1; } @@ -244,7 +220,7 @@ driConfigEqual(const __DRIcoreExtension *core, if (!scalarEqual(config, attrib, value)) { static int warned; if (!warned) { - dri_message(_LOADER_DEBUG, + glx_message(_LOADER_DEBUG, "Disabling server's aux buffer support\n"); warned = 1; } @@ -256,7 +232,7 @@ driConfigEqual(const __DRIcoreExtension *core, if (!scalarEqual(config, attrib, value)) { static int warned; if (!warned) { - dri_message(_LOADER_DEBUG, + glx_message(_LOADER_DEBUG, "Disabling server's tfp mipmap support\n"); warned = 1; } @@ -268,7 +244,7 @@ driConfigEqual(const __DRIcoreExtension *core, if (!scalarEqual(config, attrib, value)) { static int warned; if (!warned) { - dri_message(_LOADER_DEBUG, + glx_message(_LOADER_DEBUG, "Disabling server's sRGB support\n"); warned = 1; } diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h index 364ca3faa29..5a5ab0e626f 100644 --- a/src/glx/dri_common.h +++ b/src/glx/dri_common.h @@ -63,12 +63,6 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable); extern void driReleaseDrawables(struct glx_context *gc); -extern void dri_message(int level, const char *f, ...) PRINTFLIKE(2, 3); - -#define InfoMessageF(...) dri_message(_LOADER_INFO, __VA_ARGS__) -#define ErrorMessageF(...) dri_message(_LOADER_WARNING, __VA_ARGS__) -#define CriticalErrorMessageF(...) dri_message(_LOADER_FATAL, __VA_ARGS__) - extern const __DRIextension **driOpenDriver(const char *driverName, void **out_driver_handle); diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 77e07adb0cb..3e3fbd0ea83 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -53,7 +53,7 @@ #include "glxconfig.h" #include "glxhash.h" #include "util/macros.h" - +#include "loader.h" #include "glxextensions.h" #if defined(USE_LIBGLVND) @@ -66,6 +66,12 @@ extern "C" { #endif +extern void glx_message(int level, const char *f, ...) PRINTFLIKE(2, 3); + +#define InfoMessageF(...) glx_message(_LOADER_INFO, __VA_ARGS__) +#define ErrorMessageF(...) glx_message(_LOADER_WARNING, __VA_ARGS__) +#define CriticalErrorMessageF(...) glx_message(_LOADER_FATAL, __VA_ARGS__) + #define GLX_MAJOR_VERSION 1 /* current version numbers */ #define GLX_MINOR_VERSION 4 diff --git a/src/glx/glxext.c b/src/glx/glxext.c index 903a5441dd1..7370d8596ff 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -39,6 +39,7 @@ #include #include +#include #include "glxclient.h" #include @@ -75,6 +76,30 @@ void __glXDumpDrawBuffer(struct glx_context * ctx); #endif +_X_HIDDEN void +glx_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); + } +} + /* ** You can set this cell to 1 to force the gl drawing stuff to be ** one command per packet @@ -914,7 +939,7 @@ __glXInitialize(Display * dpy) #ifndef GLX_USE_APPLEGL /* Set the logger before the *CreateDisplay functions. */ - loader_set_logger(dri_message); + loader_set_logger(glx_message); #endif /* diff --git a/src/glx/tests/meson.build b/src/glx/tests/meson.build index 83f04e47b2a..0f37543b926 100644 --- a/src/glx/tests/meson.build +++ b/src/glx/tests/meson.build @@ -43,9 +43,9 @@ if with_shared_glapi executable( 'glx-test', [files_glx_test, glx_indirect_size_h, main_dispatch_h], - link_with : [libglx, libglapi], + link_with : [libglx, libglapi, libloader], include_directories : [ - inc_src, inc_include, inc_mesa, inc_mapi, inc_glx, + inc_src, inc_include, inc_mesa, inc_mapi, inc_glx, inc_loader, ], dependencies : [dep_libdrm, dep_glproto, dep_thread, idep_gtest] ),