This adds trace points for desktop size and audio related messages.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
ui/trace-events | 9 +++++++++
ui/vnc.c | 21 +++++++++++++++++++--
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/ui/trace-events b/ui/trace-events
index 0ffcdb4408..bd8f8a9d18 100644
--- a/ui/trace-events
+++ b/ui/trace-events
@@ -37,6 +37,15 @@ vnc_key_event_ext(bool down, int sym, int keycode, const char *name) "down %d, s
vnc_key_event_map(bool down, int sym, int keycode, const char *name) "down %d, sym 0x%x -> keycode 0x%x [%s]"
vnc_key_sync_numlock(bool on) "%d"
vnc_key_sync_capslock(bool on) "%d"
+vnc_msg_server_audio_begin(void *state, void *ioc) "VNC server msg audio begin state=%p ioc=%p"
+vnc_msg_server_audio_end(void *state, void *ioc) "VNC server msg audio end state=%p ioc=%p"
+vnc_msg_server_audio_data(void *state, void *ioc, const void *buf, size_t len) "VNC server msg audio data state=%p ioc=%p buf=%p len=%zd"
+vnc_msg_server_desktop_resize(void *state, void *ioc, int width, int height) "VNC server msg ext resize state=%p ioc=%p size=%dx%d"
+vnc_msg_server_ext_desktop_resize(void *state, void *ioc, int width, int height, int reason) "VNC server msg ext resize state=%p ioc=%p size=%dx%d reason=%d"
+vnc_msg_client_audio_enable(void *state, void *ioc) "VNC client msg audio enable state=%p ioc=%p"
+vnc_msg_client_audio_disable(void *state, void *ioc) "VNC client msg audio disable state=%p ioc=%p"
+vnc_msg_client_audio_format(void *state, void *ioc, int fmt, int channels, int freq) "VNC client msg audio format state=%p ioc=%p fmt=%d channels=%d freq=%d"
+vnc_msg_client_set_desktop_size(void *state, void *ioc, int width, int height, int screens) "VNC client msg set desktop size state=%p ioc=%p size=%dx%d screens=%d"
vnc_client_eof(void *state, void *ioc) "VNC client EOF state=%p ioc=%p"
vnc_client_io_error(void *state, void *ioc, const char *msg) "VNC client I/O error state=%p ioc=%p errmsg=%s"
vnc_client_connect(void *state, void *ioc) "VNC client connect state=%p ioc=%p"
diff --git a/ui/vnc.c b/ui/vnc.c
index e8e3426a65..7291429c04 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -659,6 +659,9 @@ void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
static void vnc_desktop_resize_ext(VncState *vs, int reject_reason)
{
+ trace_vnc_msg_server_ext_desktop_resize(
+ vs, vs->ioc, vs->client_width, vs->client_height, reject_reason);
+
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
vnc_write_u8(vs, 0);
@@ -705,6 +708,9 @@ static void vnc_desktop_resize(VncState *vs)
return;
}
+ trace_vnc_msg_server_desktop_resize(
+ vs, vs->ioc, vs->client_width, vs->client_height);
+
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
vnc_write_u8(vs, 0);
@@ -1182,6 +1188,7 @@ static void audio_capture_notify(void *opaque, audcnotification_e cmd)
assert(vs->magic == VNC_MAGIC);
switch (cmd) {
case AUD_CNOTIFY_DISABLE:
+ trace_vnc_msg_server_audio_end(vs, vs->ioc);
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_QEMU);
vnc_write_u8(vs, VNC_MSG_SERVER_QEMU_AUDIO);
@@ -1191,6 +1198,7 @@ static void audio_capture_notify(void *opaque, audcnotification_e cmd)
break;
case AUD_CNOTIFY_ENABLE:
+ trace_vnc_msg_server_audio_begin(vs, vs->ioc);
vnc_lock_output(vs);
vnc_write_u8(vs, VNC_MSG_SERVER_QEMU);
vnc_write_u8(vs, VNC_MSG_SERVER_QEMU_AUDIO);
@@ -1210,6 +1218,7 @@ static void audio_capture(void *opaque, const void *buf, int size)
VncState *vs = opaque;
assert(vs->magic == VNC_MAGIC);
+ trace_vnc_msg_server_audio_data(vs, vs->ioc, buf, size);
vnc_lock_output(vs);
if (vs->output.offset < vs->throttle_output_offset) {
vnc_write_u8(vs, VNC_MSG_SERVER_QEMU);
@@ -2454,9 +2463,11 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
switch (read_u16 (data, 2)) {
case VNC_MSG_CLIENT_QEMU_AUDIO_ENABLE:
+ trace_vnc_msg_client_audio_enable(vs, vs->ioc);
audio_add(vs);
break;
case VNC_MSG_CLIENT_QEMU_AUDIO_DISABLE:
+ trace_vnc_msg_client_audio_disable(vs, vs->ioc);
audio_del(vs);
break;
case VNC_MSG_CLIENT_QEMU_AUDIO_SET_FORMAT:
@@ -2492,6 +2503,8 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
break;
}
vs->as.freq = freq;
+ trace_vnc_msg_client_audio_format(
+ vs, vs->ioc, vs->as.fmt, vs->as.nchannels, vs->as.freq);
break;
default:
VNC_DEBUG("Invalid audio message %d\n", read_u8(data, 4));
@@ -2510,6 +2523,7 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
{
size_t size;
uint8_t screens;
+ int w, h;
if (len < 8) {
return 8;
@@ -2520,12 +2534,15 @@ static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
if (len < size) {
return size;
}
+ w = read_u16(data, 2);
+ h = read_u16(data, 4);
+ trace_vnc_msg_client_set_desktop_size(vs, vs->ioc, w, h, screens);
if (dpy_ui_info_supported(vs->vd->dcl.con)) {
QemuUIInfo info;
memset(&info, 0, sizeof(info));
- info.width = read_u16(data, 2);
- info.height = read_u16(data, 4);
+ info.width = w;
+ info.height = h;
dpy_set_ui_info(vs->vd->dcl.con, &info);
vnc_desktop_resize_ext(vs, 4 /* Request forwarded */);
} else {
--
2.29.2
On Thu, Mar 11, 2021 at 10:43 PM Daniel P. Berrangé <berrange@redhat.com>
wrote:
> This adds trace points for desktop size and audio related messages.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
> ui/trace-events | 9 +++++++++
> ui/vnc.c | 21 +++++++++++++++++++--
> 2 files changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/ui/trace-events b/ui/trace-events
> index 0ffcdb4408..bd8f8a9d18 100644
> --- a/ui/trace-events
> +++ b/ui/trace-events
> @@ -37,6 +37,15 @@ vnc_key_event_ext(bool down, int sym, int keycode,
> const char *name) "down %d, s
> vnc_key_event_map(bool down, int sym, int keycode, const char *name)
> "down %d, sym 0x%x -> keycode 0x%x [%s]"
> vnc_key_sync_numlock(bool on) "%d"
> vnc_key_sync_capslock(bool on) "%d"
> +vnc_msg_server_audio_begin(void *state, void *ioc) "VNC server msg audio
> begin state=%p ioc=%p"
> +vnc_msg_server_audio_end(void *state, void *ioc) "VNC server msg audio
> end state=%p ioc=%p"
> +vnc_msg_server_audio_data(void *state, void *ioc, const void *buf, size_t
> len) "VNC server msg audio data state=%p ioc=%p buf=%p len=%zd"
> +vnc_msg_server_desktop_resize(void *state, void *ioc, int width, int
> height) "VNC server msg ext resize state=%p ioc=%p size=%dx%d"
> +vnc_msg_server_ext_desktop_resize(void *state, void *ioc, int width, int
> height, int reason) "VNC server msg ext resize state=%p ioc=%p size=%dx%d
> reason=%d"
> +vnc_msg_client_audio_enable(void *state, void *ioc) "VNC client msg audio
> enable state=%p ioc=%p"
> +vnc_msg_client_audio_disable(void *state, void *ioc) "VNC client msg
> audio disable state=%p ioc=%p"
> +vnc_msg_client_audio_format(void *state, void *ioc, int fmt, int
> channels, int freq) "VNC client msg audio format state=%p ioc=%p fmt=%d
> channels=%d freq=%d"
> +vnc_msg_client_set_desktop_size(void *state, void *ioc, int width, int
> height, int screens) "VNC client msg set desktop size state=%p ioc=%p
> size=%dx%d screens=%d"
> vnc_client_eof(void *state, void *ioc) "VNC client EOF state=%p ioc=%p"
> vnc_client_io_error(void *state, void *ioc, const char *msg) "VNC client
> I/O error state=%p ioc=%p errmsg=%s"
> vnc_client_connect(void *state, void *ioc) "VNC client connect state=%p
> ioc=%p"
> diff --git a/ui/vnc.c b/ui/vnc.c
> index e8e3426a65..7291429c04 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -659,6 +659,9 @@ void vnc_framebuffer_update(VncState *vs, int x, int
> y, int w, int h,
>
> static void vnc_desktop_resize_ext(VncState *vs, int reject_reason)
> {
> + trace_vnc_msg_server_ext_desktop_resize(
> + vs, vs->ioc, vs->client_width, vs->client_height, reject_reason);
> +
> vnc_lock_output(vs);
> vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
> vnc_write_u8(vs, 0);
> @@ -705,6 +708,9 @@ static void vnc_desktop_resize(VncState *vs)
> return;
> }
>
> + trace_vnc_msg_server_desktop_resize(
> + vs, vs->ioc, vs->client_width, vs->client_height);
> +
> vnc_lock_output(vs);
> vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);
> vnc_write_u8(vs, 0);
> @@ -1182,6 +1188,7 @@ static void audio_capture_notify(void *opaque,
> audcnotification_e cmd)
> assert(vs->magic == VNC_MAGIC);
> switch (cmd) {
> case AUD_CNOTIFY_DISABLE:
> + trace_vnc_msg_server_audio_end(vs, vs->ioc);
> vnc_lock_output(vs);
> vnc_write_u8(vs, VNC_MSG_SERVER_QEMU);
> vnc_write_u8(vs, VNC_MSG_SERVER_QEMU_AUDIO);
> @@ -1191,6 +1198,7 @@ static void audio_capture_notify(void *opaque,
> audcnotification_e cmd)
> break;
>
> case AUD_CNOTIFY_ENABLE:
> + trace_vnc_msg_server_audio_begin(vs, vs->ioc);
> vnc_lock_output(vs);
> vnc_write_u8(vs, VNC_MSG_SERVER_QEMU);
> vnc_write_u8(vs, VNC_MSG_SERVER_QEMU_AUDIO);
> @@ -1210,6 +1218,7 @@ static void audio_capture(void *opaque, const void
> *buf, int size)
> VncState *vs = opaque;
>
> assert(vs->magic == VNC_MAGIC);
> + trace_vnc_msg_server_audio_data(vs, vs->ioc, buf, size);
> vnc_lock_output(vs);
> if (vs->output.offset < vs->throttle_output_offset) {
> vnc_write_u8(vs, VNC_MSG_SERVER_QEMU);
> @@ -2454,9 +2463,11 @@ static int protocol_client_msg(VncState *vs,
> uint8_t *data, size_t len)
>
> switch (read_u16 (data, 2)) {
> case VNC_MSG_CLIENT_QEMU_AUDIO_ENABLE:
> + trace_vnc_msg_client_audio_enable(vs, vs->ioc);
> audio_add(vs);
> break;
> case VNC_MSG_CLIENT_QEMU_AUDIO_DISABLE:
> + trace_vnc_msg_client_audio_disable(vs, vs->ioc);
> audio_del(vs);
> break;
> case VNC_MSG_CLIENT_QEMU_AUDIO_SET_FORMAT:
> @@ -2492,6 +2503,8 @@ static int protocol_client_msg(VncState *vs, uint8_t
> *data, size_t len)
> break;
> }
> vs->as.freq = freq;
> + trace_vnc_msg_client_audio_format(
> + vs, vs->ioc, vs->as.fmt, vs->as.nchannels,
> vs->as.freq);
> break;
> default:
> VNC_DEBUG("Invalid audio message %d\n", read_u8(data, 4));
> @@ -2510,6 +2523,7 @@ static int protocol_client_msg(VncState *vs, uint8_t
> *data, size_t len)
> {
> size_t size;
> uint8_t screens;
> + int w, h;
>
> if (len < 8) {
> return 8;
> @@ -2520,12 +2534,15 @@ static int protocol_client_msg(VncState *vs,
> uint8_t *data, size_t len)
> if (len < size) {
> return size;
> }
> + w = read_u16(data, 2);
> + h = read_u16(data, 4);
>
> + trace_vnc_msg_client_set_desktop_size(vs, vs->ioc, w, h, screens);
> if (dpy_ui_info_supported(vs->vd->dcl.con)) {
> QemuUIInfo info;
> memset(&info, 0, sizeof(info));
> - info.width = read_u16(data, 2);
> - info.height = read_u16(data, 4);
> + info.width = w;
> + info.height = h;
> dpy_set_ui_info(vs->vd->dcl.con, &info);
> vnc_desktop_resize_ext(vs, 4 /* Request forwarded */);
> } else {
> --
> 2.29.2
>
>
>
--
Marc-André Lureau
© 2016 - 2026 Red Hat, Inc.