|
|
4a2fec |
From c13d50cb093c4409dd2db6023fc0f6adfe4927d8 Mon Sep 17 00:00:00 2001
|
|
|
4a2fec |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
4a2fec |
Date: Mon, 5 Feb 2018 11:10:05 +0100
|
|
|
4a2fec |
Subject: [PATCH 11/20] ui: refactor code for determining if an update should
|
|
|
4a2fec |
be sent to the client
|
|
|
4a2fec |
MIME-Version: 1.0
|
|
|
4a2fec |
Content-Type: text/plain; charset=UTF-8
|
|
|
4a2fec |
Content-Transfer-Encoding: 8bit
|
|
|
4a2fec |
|
|
|
4a2fec |
RH-Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
4a2fec |
Message-id: <20180205111012.6210-11-berrange@redhat.com>
|
|
|
4a2fec |
Patchwork-id: 78887
|
|
|
4a2fec |
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH v2 10/17] ui: refactor code for determining if an update should be sent to the client
|
|
|
4a2fec |
Bugzilla: 1527404
|
|
|
4a2fec |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
4a2fec |
|
|
|
4a2fec |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
4a2fec |
|
|
|
4a2fec |
The logic for determining if it is possible to send an update to the client
|
|
|
4a2fec |
will become more complicated shortly, so pull it out into a separate method
|
|
|
4a2fec |
for easier extension later.
|
|
|
4a2fec |
|
|
|
4a2fec |
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
|
|
4a2fec |
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
|
|
4a2fec |
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
4a2fec |
Message-id: 20171218191228.31018-9-berrange@redhat.com
|
|
|
4a2fec |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
4a2fec |
(cherry picked from commit 0bad834228b9ee63e4239108d02dcb94568254d0)
|
|
|
4a2fec |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
4a2fec |
---
|
|
|
4a2fec |
ui/vnc.c | 27 ++++++++++++++++++++-------
|
|
|
4a2fec |
1 file changed, 20 insertions(+), 7 deletions(-)
|
|
|
4a2fec |
|
|
|
4a2fec |
diff --git a/ui/vnc.c b/ui/vnc.c
|
|
|
4a2fec |
index 3707b87..2b04050 100644
|
|
|
4a2fec |
--- a/ui/vnc.c
|
|
|
4a2fec |
+++ b/ui/vnc.c
|
|
|
4a2fec |
@@ -961,6 +961,25 @@ static int find_and_clear_dirty_height(VncState *vs,
|
|
|
4a2fec |
return h;
|
|
|
4a2fec |
}
|
|
|
4a2fec |
|
|
|
4a2fec |
+static bool vnc_should_update(VncState *vs)
|
|
|
4a2fec |
+{
|
|
|
4a2fec |
+ switch (vs->update) {
|
|
|
4a2fec |
+ case VNC_STATE_UPDATE_NONE:
|
|
|
4a2fec |
+ break;
|
|
|
4a2fec |
+ case VNC_STATE_UPDATE_INCREMENTAL:
|
|
|
4a2fec |
+ /* Only allow incremental updates if the output buffer
|
|
|
4a2fec |
+ * is empty, or if audio capture is enabled.
|
|
|
4a2fec |
+ */
|
|
|
4a2fec |
+ if (!vs->output.offset || vs->audio_cap) {
|
|
|
4a2fec |
+ return true;
|
|
|
4a2fec |
+ }
|
|
|
4a2fec |
+ break;
|
|
|
4a2fec |
+ case VNC_STATE_UPDATE_FORCE:
|
|
|
4a2fec |
+ return true;
|
|
|
4a2fec |
+ }
|
|
|
4a2fec |
+ return false;
|
|
|
4a2fec |
+}
|
|
|
4a2fec |
+
|
|
|
4a2fec |
static int vnc_update_client(VncState *vs, int has_dirty)
|
|
|
4a2fec |
{
|
|
|
4a2fec |
VncDisplay *vd = vs->vd;
|
|
|
4a2fec |
@@ -975,13 +994,7 @@ static int vnc_update_client(VncState *vs, int has_dirty)
|
|
|
4a2fec |
}
|
|
|
4a2fec |
|
|
|
4a2fec |
vs->has_dirty += has_dirty;
|
|
|
4a2fec |
- if (vs->update == VNC_STATE_UPDATE_NONE) {
|
|
|
4a2fec |
- return 0;
|
|
|
4a2fec |
- }
|
|
|
4a2fec |
-
|
|
|
4a2fec |
- if (vs->output.offset && !vs->audio_cap &&
|
|
|
4a2fec |
- vs->update != VNC_STATE_UPDATE_FORCE) {
|
|
|
4a2fec |
- /* kernel send buffers are full -> drop frames to throttle */
|
|
|
4a2fec |
+ if (!vnc_should_update(vs)) {
|
|
|
4a2fec |
return 0;
|
|
|
4a2fec |
}
|
|
|
4a2fec |
|
|
|
4a2fec |
--
|
|
|
4a2fec |
1.8.3.1
|
|
|
4a2fec |
|