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