[Mesa-dev] [PATCH 7/7] dri: Reuse dri_message to implement our other message handlers.

Kristian Høgsberg krh at bitplanet.net
Sun Jan 26 16:04:13 PST 2014


On Thu, Jan 23, 2014 at 3:12 PM, Eric Anholt <eric at anholt.net> wrote:

Entire series

Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>

The only thing that came to mind was that we should move the code to
open with O_CLOEXEC to its own wrapper function.  Of course there's
really no reason that needs to be part of this series.

> ---
>  src/glx/dri_common.c | 60 ----------------------------------------------------
>  src/glx/dri_common.h |  7 +++---
>  2 files changed, 4 insertions(+), 63 deletions(-)
>
> diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
> index 93c45ea..0dd8982 100644
> --- a/src/glx/dri_common.c
> +++ b/src/glx/dri_common.c
> @@ -73,66 +73,6 @@ dri_message(int level, const char *f, ...)
>     }
>  }
>
> -/**
> - * Print informational message to stderr if LIBGL_DEBUG is set to
> - * "verbose".
> - */
> -_X_HIDDEN void
> -InfoMessageF(const char *f, ...)
> -{
> -   va_list args;
> -   const char *env;
> -
> -   if ((env = getenv("LIBGL_DEBUG")) && strstr(env, "verbose")) {
> -      fprintf(stderr, "libGL: ");
> -      va_start(args, f);
> -      vfprintf(stderr, f, args);
> -      va_end(args);
> -   }
> -}
> -
> -/**
> - * Print error message to stderr if LIBGL_DEBUG is set to anything but
> - * "quiet", (do nothing if LIBGL_DEBUG is unset).
> - */
> -_X_HIDDEN void
> -ErrorMessageF(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);
> -   }
> -}
> -
> -/**
> - * 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 425d89f..6234fd8 100644
> --- a/src/glx/dri_common.h
> +++ b/src/glx/dri_common.h
> @@ -38,6 +38,7 @@
>
>  #include <GL/internal/dri_interface.h>
>  #include <stdbool.h>
> +#include "loader.h"
>
>  #if (__GNUC__ >= 3)
>  #define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a)))
> @@ -69,9 +70,9 @@ extern const __DRIsystemTimeExtension systemTimeExtension;
>
>  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, ...);
> +#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 void *driOpenDriver(const char *driverName);
>
> --
> 1.8.5.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list