[Spice-devel] [PATCH qxl-wddm-dod 03/26] Add printer class to dump debug print statements to kernel debugger output
Sameeh Jubran
sameeh at daynix.com
Tue Aug 9 15:28:35 UTC 2016
From: Sandy Stutsman <sstutsma at redhat.com>
Allows the usage of Kd_IHVVIDEO_Mask to control print level while debugging
Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
---
qxldod/driver.cpp | 24 +++++++++++++++++++++++-
qxldod/driver.h | 20 ++++++++++++++++----
2 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/qxldod/driver.cpp b/qxldod/driver.cpp
index 4d1913c..d9946aa 100755
--- a/qxldod/driver.cpp
+++ b/qxldod/driver.cpp
@@ -667,7 +667,29 @@ void DebugPrintFunc(const char *format, ...)
va_start(list, format);
vDbgPrintEx(DPFLTR_DEFAULT_ID, 9 | DPFLTR_MASK, format, list);
}
+
+kd_debug_printer::kd_debug_printer(ULONG level)
+{
+ static const ULONG xlate[] = { 0, 0, 1, 2, 3 };
+ if (!level || level > 5) {
+ _level = 0xffffffff;
+
+ }
+ else {
+ _level = xlate[level - 1];
+ }
+}
+
+void kd_debug_printer::print(const char * fmt, ...)
+{
+ if (_level == 0xffffffff) {
+ return;
+ }
+ va_list list;
+ va_start(list, fmt);
+ vDbgPrintEx(DPFLTR_IHVVIDEO_ID, _level, 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..752f8e4 100755
--- a/qxldod/driver.h
+++ b/qxldod/driver.h
@@ -208,15 +208,27 @@ DodSystemDisplayWrite(
_In_ UINT PositionY);
#if DBG
+class kd_debug_printer
+{
+public:
+ kd_debug_printer(ULONG level);
+ void print(const char * fmt, ...);
+private:
+ ULONG _level;
+ };
extern int nDebugLevel;
void DebugPrintFuncSerial(const char *format, ...);
-void DebugPrintFunc(const char *format, ...);
+void DebugPrintFunc(const char *format, ...);
+
+#define DbgPrint(level, line) \
+ if (level > nDebugLevel) {} \
+ else { \
+ DebugPrintFuncSerial line; \
+ } \
+ kd_debug_printer(level).print line
-#define DbgPrint(level, line) \
- if (level > nDebugLevel) {} \
- else DebugPrintFuncSerial line
#else
#define DbgPrint(level, line)
#endif
--
2.7.0.windows.1
More information about the Spice-devel
mailing list