cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-ui-refactor-code-for-determining-if-an-update-should.patch

5d360b
From 3b0e5204ae4a681ed9f6bedd3cd18ecad877546c Mon Sep 17 00:00:00 2001
5d360b
From: "Daniel P. Berrange" <berrange@redhat.com>
5d360b
Date: Thu, 8 Feb 2018 17:50:35 +0100
5d360b
Subject: [PATCH 21/27] ui: refactor code for determining if an update should
5d360b
 be sent to the client
5d360b
MIME-Version: 1.0
5d360b
Content-Type: text/plain; charset=UTF-8
5d360b
Content-Transfer-Encoding: 8bit
5d360b
5d360b
RH-Author: Daniel P. Berrange <berrange@redhat.com>
5d360b
Message-id: <20180208175041.5634-22-berrange@redhat.com>
5d360b
Patchwork-id: 78954
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 21/27] ui: refactor code for determining if an update should be sent to the client
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: "Daniel P. Berrange" <berrange@redhat.com>
5d360b
5d360b
The logic for determining if it is possible to send an update to the client
5d360b
will become more complicated shortly, so pull it out into a separate method
5d360b
for easier extension later.
5d360b
5d360b
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
5d360b
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
5d360b
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
5d360b
Message-id: 20171218191228.31018-9-berrange@redhat.com
5d360b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5d360b
(cherry picked from commit 0bad834228b9ee63e4239108d02dcb94568254d0)
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 ui/vnc.c | 27 ++++++++++++++++++++-------
5d360b
 1 file changed, 20 insertions(+), 7 deletions(-)
5d360b
5d360b
diff --git a/ui/vnc.c b/ui/vnc.c
5d360b
index 075def1..a7ec8cc 100644
5d360b
--- a/ui/vnc.c
5d360b
+++ b/ui/vnc.c
5d360b
@@ -846,6 +846,25 @@ static int find_and_clear_dirty_height(struct VncState *vs,
5d360b
     return h;
5d360b
 }
5d360b
 
5d360b
+static bool vnc_should_update(VncState *vs)
5d360b
+{
5d360b
+    switch (vs->update) {
5d360b
+    case VNC_STATE_UPDATE_NONE:
5d360b
+        break;
5d360b
+    case VNC_STATE_UPDATE_INCREMENTAL:
5d360b
+        /* Only allow incremental updates if the output buffer
5d360b
+         * is empty, or if audio capture is enabled.
5d360b
+         */
5d360b
+        if (!vs->output.offset || vs->audio_cap) {
5d360b
+            return true;
5d360b
+        }
5d360b
+        break;
5d360b
+    case VNC_STATE_UPDATE_FORCE:
5d360b
+        return true;
5d360b
+    }
5d360b
+    return false;
5d360b
+}
5d360b
+
5d360b
 static int vnc_update_client(VncState *vs, int has_dirty)
5d360b
 {
5d360b
     VncDisplay *vd = vs->vd;
5d360b
@@ -860,13 +879,7 @@ static int vnc_update_client(VncState *vs, int has_dirty)
5d360b
     }
5d360b
 
5d360b
     vs->has_dirty += has_dirty;
5d360b
-    if (vs->update == VNC_STATE_UPDATE_NONE) {
5d360b
-        return 0;
5d360b
-    }
5d360b
-
5d360b
-    if (vs->output.offset && !vs->audio_cap &&
5d360b
-        vs->update != VNC_STATE_UPDATE_FORCE) {
5d360b
-        /* kernel send buffers are full -> drop frames to throttle */
5d360b
+    if (!vnc_should_update(vs)) {
5d360b
         return 0;
5d360b
     }
5d360b
 
5d360b
-- 
5d360b
1.8.3.1
5d360b