vl: Add some basic debug output for XvMC.

Set the XVMC_DEBUG env var to:
	0 for no extra output
	1 for error output
	2 for warning output
	3 for tracing output
diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
index 6e1b863..96fe7a9 100644
--- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
+++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
@@ -30,6 +30,7 @@
 
 #include <X11/Xlib.h>
 #include <X11/extensions/XvMClib.h>
+#include <util/u_debug.h>
 
 #define BLOCK_SIZE_SAMPLES 64
 #define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2)
@@ -63,4 +64,26 @@
 	XvMCContext *context;
 } XvMCSubPicturePrivate;
 
+#define XVMC_OUT   0
+#define XVMC_ERR   1
+#define XVMC_WARN  2
+#define XVMC_TRACE 3
+static INLINE void XVMC_MSG(unsigned int level, const char *fmt, ...)
+{
+   static boolean check_dbg_level = TRUE;
+   static unsigned int debug_level;
+
+   if (check_dbg_level) {
+      debug_level = debug_get_num_option("XVMC_DEBUG", 0);
+      check_dbg_level = FALSE;
+   }
+
+   if (level <= debug_level) {
+      va_list ap;
+      va_start(ap, fmt);
+      _debug_vprintf(fmt, ap);
+      va_end(ap);
+   }
+}
+
 #endif /* xvmc_private_h */