glx: s/dri_message/glx_message/

Move this up to the generic glx code, there's nothing DRI-specific about
this and it'll let us clean up some ad-hockery elsewhere.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10381>
This commit is contained in:
Adam Jackson 2021-04-19 22:43:46 -04:00 committed by Marge Bot
parent 12fd68a0dc
commit 1cb664c15c
5 changed files with 39 additions and 38 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -39,6 +39,7 @@
#include <assert.h>
#include <stdbool.h>
#include <stdarg.h>
#include "glxclient.h"
#include <X11/extensions/Xext.h>
@ -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
/*

View File

@ -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]
),