[PATCH qxl-wddm-dod v2 03/25] Add debug print macro to dump debug print statements to kernel debugger output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sameeh Jubran <sameeh@xxxxxxxxxx>
---
 qxldod/driver.cpp | 14 +++++++++++++-
 qxldod/driver.h   | 12 ++++++++----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/qxldod/driver.cpp b/qxldod/driver.cpp
index 4d1913c..10a24f4 100755
--- a/qxldod/driver.cpp
+++ b/qxldod/driver.cpp
@@ -667,7 +667,19 @@ void DebugPrintFunc(const char *format, ...)
     va_start(list, format);
     vDbgPrintEx(DPFLTR_DEFAULT_ID, 9 | DPFLTR_MASK, format, list);
 }
+
+void DebugPrint(int level, const char *fmt, ...)
+{
+    static const ULONG xlate[] = { 0, 0, 1, 2, 3 };
+    if (level <= 0 || level > 5)
+        return;
+
+    va_list list;
+    va_start(list, fmt);
+    vDbgPrintEx(DPFLTR_IHVVIDEO_ID, xlate[level - 1], fmt, list);
+    va_end(list);
+}
+
 #endif
 
 #pragma code_seg(pop) // End Non-Paged Code
-
diff --git a/qxldod/driver.h b/qxldod/driver.h
index e64c098..08197b4 100755
--- a/qxldod/driver.h
+++ b/qxldod/driver.h
@@ -211,12 +211,16 @@ DodSystemDisplayWrite(
 
 extern int nDebugLevel;
 void DebugPrintFuncSerial(const char *format, ...);
+void DebugPrintFunc(const char *format, ...);
+void DebugPrint(int level, const char *fmt, ...);
 
-void DebugPrintFunc(const char *format, ...);
+#define DbgExpandArguments(...) __VA_ARGS__
+
+#define DbgPrint(level, line) do { \
+    if (level <= nDebugLevel) DebugPrintFuncSerial line; \
+    DebugPrint(level, DbgExpandArguments line); \
+} while(0)
 
-#define DbgPrint(level, line) \
-    if (level > nDebugLevel) {} \
-    else DebugPrintFuncSerial line
 #else
 #define DbgPrint(level, line) 
 #endif
-- 
2.7.0.windows.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]