all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu] pick fix for regression with VNC clipboard breaking mouse pointer in Windows guests
Date: Mon, 17 Nov 2025 12:43:03 +0100	[thread overview]
Message-ID: <20251117114324.113404-1-f.ebner@proxmox.com> (raw)

As reported in the community forum [0], when enabling the VNC
clipboard, the mouse pointer would get stuck with Windows guests.
Pick up the relevant fix from qemu-devel.

[0]: https://forum.proxmox.com/threads/175837/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 ...vdagent-fix-windows-agent-regression.patch | 105 ++++++++++++++++++
 debian/patches/series                         |   1 +
 2 files changed, 106 insertions(+)
 create mode 100644 debian/patches/extra/0008-ui-vdagent-fix-windows-agent-regression.patch

diff --git a/debian/patches/extra/0008-ui-vdagent-fix-windows-agent-regression.patch b/debian/patches/extra/0008-ui-vdagent-fix-windows-agent-regression.patch
new file mode 100644
index 0000000..fe7e3fa
--- /dev/null
+++ b/debian/patches/extra/0008-ui-vdagent-fix-windows-agent-regression.patch
@@ -0,0 +1,105 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
+Date: Mon, 27 Oct 2025 17:07:44 +0400
+Subject: [PATCH] ui/vdagent: fix windows agent regression
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Since commit f626116f ("ui/vdagent: factor out clipboard peer
+registration"), the QEMU clipboard serial is reset whenever the vdagent
+chardev receives the guest caps. This triggers a CHR_EVENT_CLOSED which
+is handled by virtio_serial_close() to notify the guest.
+
+The "reconnection logic" is there to reset the agent when a
+client (dbus, spice etc) reconnects, or the agent is restarted.
+It is required to sync the clipboard serials and to prevent races or
+loops due to clipboard managers on both ends (but this is not
+implemented by windows vdagent).
+
+The Unix agent has been reconnecting without resending caps, thus
+working with this approach.
+
+However, the Windows agent does not seem to have a way to handle
+VIRTIO_CONSOLE_PORT_OPEN=0 event and do not receive further data...
+
+Let's not trigger this disconnection/reset logic if the agent does not
+support VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL.
+
+Fixes: f626116f ("ui/vdagent: factor out clipboard peer registration")
+Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
+Reported-by: Lucas Kornicki <lucas.kornicki@nutanix.com>
+Tested-by: Lucas Kornicki <lucas.kornicki@nutanix.com>
+Link: https://lore.proxmox.com/20251027130744.2714610-1-marcandre.lureau@redhat.com
+[FE: picked from qemu-devel]
+Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
+---
+ ui/vdagent.c | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/ui/vdagent.c b/ui/vdagent.c
+index c0746fe5b1..a7c959e8ab 100644
+--- a/ui/vdagent.c
++++ b/ui/vdagent.c
+@@ -316,6 +316,15 @@ static bool have_selection(VDAgentChardev *vd)
+     return vd->caps & (1 << VD_AGENT_CAP_CLIPBOARD_SELECTION);
+ }
+ 
++static bool have_clipboard_serial(VDAgentChardev *vd)
++{
++#if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 1)
++    return vd->caps & (1 << VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL);
++#else
++    return false;
++#endif
++}
++
+ static uint32_t type_qemu_to_vdagent(enum QemuClipboardType type)
+ {
+     switch (type) {
+@@ -345,8 +354,7 @@ static void vdagent_send_clipboard_grab(VDAgentChardev *vd,
+         return;
+     }
+ 
+-#if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 1)
+-    if (vd->caps & (1 << VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) {
++    if (have_clipboard_serial(vd)) {
+         if (!info->has_serial) {
+             /* client should win */
+             info->serial = vd->last_serial[info->selection]++;
+@@ -356,7 +364,6 @@ static void vdagent_send_clipboard_grab(VDAgentChardev *vd,
+         data++;
+         msg->size += sizeof(uint32_t);
+     }
+-#endif
+ 
+     for (q = 0; q < QEMU_CLIPBOARD_TYPE__COUNT; q++) {
+         type = type_qemu_to_vdagent(q);
+@@ -464,6 +471,9 @@ static void vdagent_clipboard_reset_serial(VDAgentChardev *vd)
+ {
+     Chardev *chr = CHARDEV(vd);
+ 
++    if (!have_clipboard_serial(vd)) {
++        return;
++    }
+     /* reopen the agent connection to reset the serial state */
+     qemu_chr_be_event(chr, CHR_EVENT_CLOSED);
+     /* OPENED again after the guest disconnected, see set_fe_open */
+@@ -518,8 +528,7 @@ static void vdagent_clipboard_recv_grab(VDAgentChardev *vd, uint8_t s, uint32_t
+ 
+     trace_vdagent_cb_grab_selection(GET_NAME(sel_name, s));
+     info = qemu_clipboard_info_new(&vd->cbpeer, s);
+-#if CHECK_SPICE_PROTOCOL_VERSION(0, 14, 1)
+-    if (vd->caps & (1 << VD_AGENT_CAP_CLIPBOARD_GRAB_SERIAL)) {
++    if (have_clipboard_serial(vd)) {
+         if (size < sizeof(uint32_t)) {
+             /* this shouldn't happen! */
+             return;
+@@ -537,7 +546,6 @@ static void vdagent_clipboard_recv_grab(VDAgentChardev *vd, uint8_t s, uint32_t
+         data += sizeof(uint32_t);
+         size -= sizeof(uint32_t);
+     }
+-#endif
+     if (size > sizeof(uint32_t) * 10) {
+         /*
+          * spice has 6 types as of 2021. Limiting to 10 entries
diff --git a/debian/patches/series b/debian/patches/series
index 900310a..0bd9ea8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,6 +5,7 @@ extra/0004-vfio-igd-Enable-quirks-when-IGD-is-not-the-primary-d.patch
 extra/0005-hw-scsi-avoid-deadlock-upon-TMF-request-cancelling-w.patch
 extra/0006-vfio-rename-field-to-num_initial_regions.patch
 extra/0007-vfio-only-check-region-info-cache-for-initial-region.patch
+extra/0008-ui-vdagent-fix-windows-agent-regression.patch
 bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
 bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
 bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

             reply	other threads:[~2025-11-17 11:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 11:43 Fiona Ebner [this message]
2025-11-17 16:00 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251117114324.113404-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal