yeahuh / rpms / qemu-kvm

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