[PATCH] desktop_layout: ignore unconnected video devices

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

 



Currently, the Windows agent does not function properly if it detects a
non-QXL video adapter connected to the guest.  See:

  https://gitlab.freedesktop.org/spice/win32/vd_agent/-/issues/15
  https://gitlab.freedesktop.org/spice/win32/vd_agent/-/issues/13

This is true even when the non-QXL adapter does not have any displays
attached, such as when a physical GPU is passed through to the guest for
AI/ML workloads.

With this patch, the agent ignores the presence of unconnected video
outputs and the mouse works as expected.  If a display is connected to
a non-QXL adapter, the behavior is unchanged.  (Tested on Windows 10 Pro
x64.)

---
 vdagent/desktop_layout.cpp | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index 07074da..8b538a1 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -48,6 +48,16 @@ DesktopLayout::~DesktopLayout()
     delete _display_config;
 }

+static BOOL
+dev_has_monitor(DISPLAY_DEVICE &dev_info)
+{
+    DISPLAY_DEVICE mon_info;
+
+    ZeroMemory(&mon_info, sizeof(mon_info));
+    mon_info.cb = sizeof(mon_info);
+    return EnumDisplayDevices(dev_info.DeviceName, 0, &mon_info, 0);
+}
+
 static bool
 get_next_display(DWORD &dev_id, DISPLAY_DEVICE &dev_info)
 {
@@ -64,6 +74,9 @@ get_next_display(DWORD &dev_id, DISPLAY_DEVICE &dev_info)
         if (wcsstr(dev_info.DeviceString, L"Citrix Indirect Display")) {
             continue;
         }
+        if (!dev_has_monitor(dev_info)) {
+            continue;
+        }
         return true;
     }
     return false;
--
2.26.2

--
========================================================================
                 In Soviet Russia, Google searches you!
========================================================================

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



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