[Spice-devel] [PATCH 1/2] qxl-wddm-dod: fix behavior on v5 device

Yuri Benditovich yuri.benditovich at daynix.com
Sun Jul 12 08:01:06 UTC 2020


https://bugzilla.redhat.com/show_bug.cgi?id=1851845
v5 device requires explicit reset to switch to VGA mode.

Signed-off-by: Yuri Benditovich <yuri.benditovich at daynix.com>
---
 qxldod/QxlDod.cpp | 4 +++-
 qxldod/QxlDod.h   | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 7f03ee1..341518e 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -134,6 +134,7 @@ NTSTATUS QxlDod::CheckHardware()
         Header.DeviceID == 0x0100 &&
         Header.RevisionID >= 4)
     {
+        m_Revision = Header.RevisionID;
         Status = STATUS_SUCCESS;
     }
 
@@ -4795,7 +4796,8 @@ NTSTATUS QxlDevice::HWClose(void)
 {
     PAGED_CODE();
     QxlClose();
-    if (m_bUefiMode)
+    /* QXL device rev 5+ requires explicit reset to switch to VGA mode */
+    if (m_bUefiMode || m_pQxlDod->Revision() > 4)
     {
         DbgPrint(TRACE_LEVEL_INFORMATION, ("%s: Resetting the device\n", __FUNCTION__));
         WRITE_PORT_UCHAR((PUCHAR)(m_IoBase + QXL_IO_RESET), 0);
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index 016b1aa..24cbd39 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -720,6 +720,7 @@ private:
     KTIMER m_VsyncTimer;
     KDPC   m_VsyncTimerDpc;
     BOOLEAN m_bVsyncEnabled;
+    UCHAR m_Revision = 0;
     LONG m_VsyncFiredCounter;
 public:
     QxlDod(_In_ DEVICE_OBJECT* pPhysicalDeviceObject);
@@ -819,6 +820,7 @@ public:
         return m_DxgkInterface.DxgkCbAcquirePostDisplayOwnership(m_DxgkInterface.DeviceHandle, &DispInfo);
     }
     VOID EnableVsync(BOOLEAN bEnable);
+    UCHAR Revision() const { return m_Revision; }
 private:
     VOID CleanUp(VOID);
     NTSTATUS CheckHardware();
-- 
2.22.0.windows.1



More information about the Spice-devel mailing list