qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ui: fixes for dbus clipboard hanling
@ 2024-07-17 17:15 marcandre.lureau
  2024-07-17 17:15 ` [PATCH 1/4] ui: add more tracing for dbus marcandre.lureau
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: marcandre.lureau @ 2024-07-17 17:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Akihiko Odaki, Gerd Hoffmann,
	Philippe Mathieu-Daudé, Peter Maydell,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Hi,

-display dbus clipboard is broken after a client reconnection. The two main
issues are capabilities not renegotiated (and thus guest agent not fully
functional), and qemu clipboard serial not correctly reset.

Marc-André Lureau (4):
  ui: add more tracing for dbus
  ui/vdagent: improve vdagent_fe_open() trace
  ui/vdagent: notify clipboard peers of serial reset
  ui/vdagent: send caps on fe_open

 audio/dbusaudio.c   |  2 +-
 ui/clipboard.c      |  2 ++
 ui/dbus-clipboard.c |  4 ++++
 ui/vdagent.c        | 11 ++++++++---
 audio/trace-events  |  2 +-
 ui/trace-events     |  5 ++++-
 6 files changed, 20 insertions(+), 6 deletions(-)

-- 
2.45.2.827.g557ae147e6



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] ui: add more tracing for dbus
  2024-07-17 17:15 [PATCH 0/4] ui: fixes for dbus clipboard hanling marcandre.lureau
@ 2024-07-17 17:15 ` marcandre.lureau
  2024-07-17 17:15 ` [PATCH 2/4] ui/vdagent: improve vdagent_fe_open() trace marcandre.lureau
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marcandre.lureau @ 2024-07-17 17:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Akihiko Odaki, Gerd Hoffmann,
	Philippe Mathieu-Daudé, Peter Maydell,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 audio/dbusaudio.c   | 2 +-
 ui/dbus-clipboard.c | 4 ++++
 audio/trace-events  | 2 +-
 ui/trace-events     | 2 ++
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/audio/dbusaudio.c b/audio/dbusaudio.c
index 60fcf643ec..095e739382 100644
--- a/audio/dbusaudio.c
+++ b/audio/dbusaudio.c
@@ -105,7 +105,7 @@ static size_t dbus_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size)
     assert(buf == vo->buf + vo->buf_pos && vo->buf_pos + size <= vo->buf_size);
     vo->buf_pos += size;
 
-    trace_dbus_audio_put_buffer_out(size);
+    trace_dbus_audio_put_buffer_out(vo->buf_pos, vo->buf_size);
 
     if (vo->buf_pos < vo->buf_size) {
         return size;
diff --git a/ui/dbus-clipboard.c b/ui/dbus-clipboard.c
index fe7fcdecb6..fbb043abca 100644
--- a/ui/dbus-clipboard.c
+++ b/ui/dbus-clipboard.c
@@ -141,6 +141,8 @@ dbus_clipboard_qemu_request(QemuClipboardInfo *info,
     const char *mimes[] = { MIME_TEXT_PLAIN_UTF8, NULL };
     size_t n;
 
+    trace_dbus_clipboard_qemu_request(type);
+
     if (type != QEMU_CLIPBOARD_TYPE_TEXT) {
         /* unsupported atm */
         return;
@@ -305,6 +307,8 @@ dbus_clipboard_grab(
         return DBUS_METHOD_INVOCATION_HANDLED;
     }
 
+    trace_dbus_clipboard_grab(arg_selection, arg_serial);
+
     if (s >= QEMU_CLIPBOARD_SELECTION__COUNT) {
         g_dbus_method_invocation_return_error(
             invocation,
diff --git a/audio/trace-events b/audio/trace-events
index ab04f020ce..7e3f1593c8 100644
--- a/audio/trace-events
+++ b/audio/trace-events
@@ -15,7 +15,7 @@ oss_version(int version) "OSS version = 0x%x"
 
 # dbusaudio.c
 dbus_audio_register(const char *s, const char *dir) "sender = %s, dir = %s"
-dbus_audio_put_buffer_out(size_t len) "len = %zu"
+dbus_audio_put_buffer_out(size_t pos, size_t size) "buf_pos = %zu, buf_size = %zu"
 dbus_audio_read(size_t len) "len = %zu"
 
 # pwaudio.c
diff --git a/ui/trace-events b/ui/trace-events
index 69ff22955d..07eb494246 100644
--- a/ui/trace-events
+++ b/ui/trace-events
@@ -157,7 +157,9 @@ dbus_mouse_rel_motion(int dx, int dy) "dx=%d, dy=%d"
 dbus_touch_send_event(unsigned int kind, uint32_t num_slot, uint32_t x, uint32_t y) "kind=%u, num_slot=%u, x=%d, y=%d"
 dbus_update(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d"
 dbus_update_gl(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d"
+dbus_clipboard_grab(int selection, unsigned int serial) "selection=%d serial=%u"
 dbus_clipboard_grab_failed(void) ""
+dbus_clipboard_qemu_request(int type) "type=%d"
 dbus_clipboard_register(const char *bus_name) "peer %s"
 dbus_clipboard_unregister(const char *bus_name) "peer %s"
 dbus_scanout_texture(uint32_t tex_id, bool backing_y_0_top, uint32_t backing_width, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w, uint32_t h) "tex_id:%u y0top:%d back:%ux%u %u+%u-%ux%u"
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] ui/vdagent: improve vdagent_fe_open() trace
  2024-07-17 17:15 [PATCH 0/4] ui: fixes for dbus clipboard hanling marcandre.lureau
  2024-07-17 17:15 ` [PATCH 1/4] ui: add more tracing for dbus marcandre.lureau
@ 2024-07-17 17:15 ` marcandre.lureau
  2024-07-17 17:15 ` [PATCH 3/4] ui/vdagent: notify clipboard peers of serial reset marcandre.lureau
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marcandre.lureau @ 2024-07-17 17:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Akihiko Odaki, Gerd Hoffmann,
	Philippe Mathieu-Daudé, Peter Maydell,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Place the trace when the function enters, with arg value.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/vdagent.c    | 3 ++-
 ui/trace-events | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/ui/vdagent.c b/ui/vdagent.c
index 64d7ab245a..cb74739bc4 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -872,6 +872,8 @@ static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open)
 {
     VDAgentChardev *vd = QEMU_VDAGENT_CHARDEV(chr);
 
+    trace_vdagent_fe_open(fe_open);
+
     if (!fe_open) {
         trace_vdagent_close();
         vdagent_disconnect(vd);
@@ -881,7 +883,6 @@ static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open)
         return;
     }
 
-    trace_vdagent_open();
 }
 
 static void vdagent_chr_parse(QemuOpts *opts, ChardevBackend *backend,
diff --git a/ui/trace-events b/ui/trace-events
index 07eb494246..f5faa149d2 100644
--- a/ui/trace-events
+++ b/ui/trace-events
@@ -132,7 +132,7 @@ xkeymap_keymap(const char *name) "keymap '%s'"
 clipboard_check_serial(int cur, int recv, bool ok) "cur:%d recv:%d %d"
 
 # vdagent.c
-vdagent_open(void) ""
+vdagent_fe_open(bool fe_open) "fe_open=%d"
 vdagent_close(void) ""
 vdagent_disconnect(void) ""
 vdagent_send(const char *name) "msg %s"
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] ui/vdagent: notify clipboard peers of serial reset
  2024-07-17 17:15 [PATCH 0/4] ui: fixes for dbus clipboard hanling marcandre.lureau
  2024-07-17 17:15 ` [PATCH 1/4] ui: add more tracing for dbus marcandre.lureau
  2024-07-17 17:15 ` [PATCH 2/4] ui/vdagent: improve vdagent_fe_open() trace marcandre.lureau
@ 2024-07-17 17:15 ` marcandre.lureau
  2024-07-17 17:15 ` [PATCH 4/4] ui/vdagent: send caps on fe_open marcandre.lureau
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marcandre.lureau @ 2024-07-17 17:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Akihiko Odaki, Gerd Hoffmann,
	Philippe Mathieu-Daudé, Peter Maydell,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Since we reset the serial counters, peers should also be reset to be sync.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/clipboard.c  | 2 ++
 ui/vdagent.c    | 2 ++
 ui/trace-events | 1 +
 3 files changed, 5 insertions(+)

diff --git a/ui/clipboard.c b/ui/clipboard.c
index 4264884a6c..132086eb13 100644
--- a/ui/clipboard.c
+++ b/ui/clipboard.c
@@ -155,6 +155,8 @@ void qemu_clipboard_reset_serial(void)
     QemuClipboardNotify notify = { .type = QEMU_CLIPBOARD_RESET_SERIAL };
     int i;
 
+    trace_clipboard_reset_serial();
+
     for (i = 0; i < QEMU_CLIPBOARD_SELECTION__COUNT; i++) {
         QemuClipboardInfo *info = qemu_clipboard_info(i);
         if (info) {
diff --git a/ui/vdagent.c b/ui/vdagent.c
index cb74739bc4..2a4b3574b1 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -720,6 +720,8 @@ static void vdagent_chr_recv_caps(VDAgentChardev *vd, VDAgentMessage *msg)
     memset(vd->last_serial, 0, sizeof(vd->last_serial));
 
     if (have_clipboard(vd) && vd->cbpeer.notifier.notify == NULL) {
+        qemu_clipboard_reset_serial();
+
         vd->cbpeer.name = "vdagent";
         vd->cbpeer.notifier.notify = vdagent_clipboard_notify;
         vd->cbpeer.request = vdagent_clipboard_request;
diff --git a/ui/trace-events b/ui/trace-events
index f5faa149d2..fb253c1666 100644
--- a/ui/trace-events
+++ b/ui/trace-events
@@ -130,6 +130,7 @@ xkeymap_keymap(const char *name) "keymap '%s'"
 
 # clipboard.c
 clipboard_check_serial(int cur, int recv, bool ok) "cur:%d recv:%d %d"
+clipboard_reset_serial(void) ""
 
 # vdagent.c
 vdagent_fe_open(bool fe_open) "fe_open=%d"
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] ui/vdagent: send caps on fe_open
  2024-07-17 17:15 [PATCH 0/4] ui: fixes for dbus clipboard hanling marcandre.lureau
                   ` (2 preceding siblings ...)
  2024-07-17 17:15 ` [PATCH 3/4] ui/vdagent: notify clipboard peers of serial reset marcandre.lureau
@ 2024-07-17 17:15 ` marcandre.lureau
  2024-07-18  8:06 ` [PATCH 0/4] ui: fixes for dbus clipboard hanling Philippe Mathieu-Daudé
  2024-07-23 10:14 ` Akihiko Odaki
  5 siblings, 0 replies; 7+ messages in thread
From: marcandre.lureau @ 2024-07-17 17:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S. Tsirkin, Akihiko Odaki, Gerd Hoffmann,
	Philippe Mathieu-Daudé, Peter Maydell,
	Marc-André Lureau

From: Marc-André Lureau <marcandre.lureau@redhat.com>

The spice-vdagentd doesn't send capabilities again on host/client
disconnect (but when the session agent connects and sends a
GUEST_XORG_RESOLUTION message)

When the dbus client disconnects, vdagent_disconnect() is called to
reset the agent state. Capabilities must be negotiated again on
reconnection.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 ui/vdagent.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ui/vdagent.c b/ui/vdagent.c
index 2a4b3574b1..724eff972f 100644
--- a/ui/vdagent.c
+++ b/ui/vdagent.c
@@ -185,7 +185,7 @@ static void vdagent_send_msg(VDAgentChardev *vd, VDAgentMessage *msg)
     vdagent_send_buf(vd);
 }
 
-static void vdagent_send_caps(VDAgentChardev *vd)
+static void vdagent_send_caps(VDAgentChardev *vd, bool request)
 {
     g_autofree VDAgentMessage *msg = g_malloc0(sizeof(VDAgentMessage) +
                                                sizeof(VDAgentAnnounceCapabilities) +
@@ -205,6 +205,7 @@ static void vdagent_send_caps(VDAgentChardev *vd)
 #endif
     }
 
+    caps->request = request;
     vdagent_send_msg(vd, msg);
 }
 
@@ -711,7 +712,7 @@ static void vdagent_chr_recv_caps(VDAgentChardev *vd, VDAgentMessage *msg)
 
     vd->caps = caps->caps[0];
     if (caps->request) {
-        vdagent_send_caps(vd);
+        vdagent_send_caps(vd, false);
     }
     if (have_mouse(vd) && vd->mouse_hs) {
         qemu_input_handler_activate(vd->mouse_hs);
@@ -885,6 +886,7 @@ static void vdagent_chr_set_fe_open(struct Chardev *chr, int fe_open)
         return;
     }
 
+    vdagent_send_caps(vd, true);
 }
 
 static void vdagent_chr_parse(QemuOpts *opts, ChardevBackend *backend,
-- 
2.45.2.827.g557ae147e6



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] ui: fixes for dbus clipboard hanling
  2024-07-17 17:15 [PATCH 0/4] ui: fixes for dbus clipboard hanling marcandre.lureau
                   ` (3 preceding siblings ...)
  2024-07-17 17:15 ` [PATCH 4/4] ui/vdagent: send caps on fe_open marcandre.lureau
@ 2024-07-18  8:06 ` Philippe Mathieu-Daudé
  2024-07-23 10:14 ` Akihiko Odaki
  5 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-18  8:06 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel
  Cc: Michael S. Tsirkin, Akihiko Odaki, Gerd Hoffmann, Peter Maydell

On 17/7/24 19:15, marcandre.lureau@redhat.com wrote:

> Marc-André Lureau (4):
>    ui: add more tracing for dbus
>    ui/vdagent: improve vdagent_fe_open() trace
>    ui/vdagent: notify clipboard peers of serial reset
>    ui/vdagent: send caps on fe_open

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] ui: fixes for dbus clipboard hanling
  2024-07-17 17:15 [PATCH 0/4] ui: fixes for dbus clipboard hanling marcandre.lureau
                   ` (4 preceding siblings ...)
  2024-07-18  8:06 ` [PATCH 0/4] ui: fixes for dbus clipboard hanling Philippe Mathieu-Daudé
@ 2024-07-23 10:14 ` Akihiko Odaki
  5 siblings, 0 replies; 7+ messages in thread
From: Akihiko Odaki @ 2024-07-23 10:14 UTC (permalink / raw)
  To: marcandre.lureau, qemu-devel
  Cc: Michael S. Tsirkin, Gerd Hoffmann, Philippe Mathieu-Daudé,
	Peter Maydell

On 2024/07/18 2:15, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Hi,
> 
> -display dbus clipboard is broken after a client reconnection. The two main
> issues are capabilities not renegotiated (and thus guest agent not fully
> functional), and qemu clipboard serial not correctly reset.
> 
> Marc-André Lureau (4):
>    ui: add more tracing for dbus
>    ui/vdagent: improve vdagent_fe_open() trace
>    ui/vdagent: notify clipboard peers of serial reset
>    ui/vdagent: send caps on fe_open
> 
>   audio/dbusaudio.c   |  2 +-
>   ui/clipboard.c      |  2 ++
>   ui/dbus-clipboard.c |  4 ++++
>   ui/vdagent.c        | 11 ++++++++---
>   audio/trace-events  |  2 +-
>   ui/trace-events     |  5 ++++-
>   6 files changed, 20 insertions(+), 6 deletions(-)
> 

Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-07-23 10:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-17 17:15 [PATCH 0/4] ui: fixes for dbus clipboard hanling marcandre.lureau
2024-07-17 17:15 ` [PATCH 1/4] ui: add more tracing for dbus marcandre.lureau
2024-07-17 17:15 ` [PATCH 2/4] ui/vdagent: improve vdagent_fe_open() trace marcandre.lureau
2024-07-17 17:15 ` [PATCH 3/4] ui/vdagent: notify clipboard peers of serial reset marcandre.lureau
2024-07-17 17:15 ` [PATCH 4/4] ui/vdagent: send caps on fe_open marcandre.lureau
2024-07-18  8:06 ` [PATCH 0/4] ui: fixes for dbus clipboard hanling Philippe Mathieu-Daudé
2024-07-23 10:14 ` Akihiko Odaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).