From 67517d9d08977cf80a2528502b9de5351c17c990 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 8 Feb 2018 17:50:17 +0100 Subject: [PATCH 03/27] vnc update fix RH-Author: Daniel P. Berrange Message-id: <20180208175041.5634-4-berrange@redhat.com> Patchwork-id: 78942 O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 03/27] vnc update fix Bugzilla: 1527405 RH-Acked-by: Laszlo Ersek RH-Acked-by: Gerd Hoffmann RH-Acked-by: Miroslav Rezanina From: Gerd Hoffmann We need to remember has_updates for each vnc client. Otherwise it might happen that vnc_update_client(has_dirty=1) takes the first exit due to output buffers not being flushed yet and subsequent calls with has_dirty=0 take the second exit, wrongly assuming there is nothing to do because the work defered in the first call is ignored. Signed-off-by: Gerd Hoffmann Reviewed-by: Peter Lieven (cherry picked from commit 6365828003c8e88bff67d351af4b66c406568a26) Signed-off-by: Miroslav Rezanina --- ui/vnc.c | 4 +++- ui/vnc.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/vnc.c b/ui/vnc.c index 5226295..42070b4 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -794,6 +794,7 @@ static int find_and_clear_dirty_height(struct VncState *vs, static int vnc_update_client(VncState *vs, int has_dirty) { + vs->has_dirty += has_dirty; if (vs->need_update && vs->csock != -1) { VncDisplay *vd = vs->vd; VncJob *job; @@ -805,7 +806,7 @@ static int vnc_update_client(VncState *vs, int has_dirty) /* kernel send buffers are full -> drop frames to throttle */ return 0; - if (!has_dirty && !vs->audio_cap && !vs->force_update) + if (!vs->has_dirty && !vs->audio_cap && !vs->force_update) return 0; /* @@ -845,6 +846,7 @@ static int vnc_update_client(VncState *vs, int has_dirty) vnc_job_push(job); vs->force_update = 0; + vs->has_dirty = 0; return n; } diff --git a/ui/vnc.h b/ui/vnc.h index 8d534b6..d1badbb 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -263,6 +263,7 @@ struct VncState VncDisplay *vd; int need_update; int force_update; + int has_dirty; uint32_t features; int absolute; int last_x; -- 1.8.3.1