|
|
9ae3a8 |
From 2f49f56062f802fd47bc1c1c81d811aa6c9e9cff Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 8 Feb 2018 17:50:30 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 16/27] ui: remove redundant indentation in vnc_client_update
|
|
|
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-17-berrange@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 78936
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 16/27] ui: remove redundant indentation in vnc_client_update
|
|
|
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 |
Now that previous dead / unreachable code has been removed, we can simplify
|
|
|
9ae3a8 |
the indentation in the vnc_client_update method.
|
|
|
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-4-berrange@redhat.com
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit b939eb89b6f320544a9328fa908d881d0024c1ee)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
ui/vnc.c - context difference due to vs->csock no longer
|
|
|
9ae3a8 |
existing and some other optimizations in
|
|
|
9ae3a8 |
determining dirty rectangles.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
ui/vnc.c | 104 ++++++++++++++++++++++++++++++++-------------------------------
|
|
|
9ae3a8 |
1 file changed, 53 insertions(+), 51 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/ui/vnc.c b/ui/vnc.c
|
|
|
9ae3a8 |
index 874900c..aebaa37 100644
|
|
|
9ae3a8 |
--- a/ui/vnc.c
|
|
|
9ae3a8 |
+++ b/ui/vnc.c
|
|
|
9ae3a8 |
@@ -848,68 +848,70 @@ static int find_and_clear_dirty_height(struct VncState *vs,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static int vnc_update_client(VncState *vs, int has_dirty)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
+ VncDisplay *vd = vs->vd;
|
|
|
9ae3a8 |
+ VncJob *job;
|
|
|
9ae3a8 |
+ int y;
|
|
|
9ae3a8 |
+ int height, width;
|
|
|
9ae3a8 |
+ int n = 0;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
if (vs->csock == -1) {
|
|
|
9ae3a8 |
vnc_disconnect_finish(vs);
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
vs->has_dirty += has_dirty;
|
|
|
9ae3a8 |
- if (vs->need_update) {
|
|
|
9ae3a8 |
- VncDisplay *vd = vs->vd;
|
|
|
9ae3a8 |
- VncJob *job;
|
|
|
9ae3a8 |
- int y;
|
|
|
9ae3a8 |
- int height, width;
|
|
|
9ae3a8 |
- int n = 0;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- if (vs->output.offset && !vs->audio_cap && !vs->force_update)
|
|
|
9ae3a8 |
- /* kernel send buffers are full -> drop frames to throttle */
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
+ if (!vs->need_update) {
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- if (!vs->has_dirty && !vs->audio_cap && !vs->force_update)
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
+ if (vs->output.offset && !vs->audio_cap && !vs->force_update) {
|
|
|
9ae3a8 |
+ /* kernel send buffers are full -> drop frames to throttle */
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- /*
|
|
|
9ae3a8 |
- * Send screen updates to the vnc client using the server
|
|
|
9ae3a8 |
- * surface and server dirty map. guest surface updates
|
|
|
9ae3a8 |
- * happening in parallel don't disturb us, the next pass will
|
|
|
9ae3a8 |
- * send them to the client.
|
|
|
9ae3a8 |
- */
|
|
|
9ae3a8 |
- job = vnc_job_new(vs);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- height = pixman_image_get_height(vd->server);
|
|
|
9ae3a8 |
- width = pixman_image_get_width(vd->server);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- y = 0;
|
|
|
9ae3a8 |
- for (;;) {
|
|
|
9ae3a8 |
- int x, h;
|
|
|
9ae3a8 |
- unsigned long x2;
|
|
|
9ae3a8 |
- unsigned long offset = find_next_bit((unsigned long *) &vs->dirty,
|
|
|
9ae3a8 |
- height * VNC_DIRTY_BPL(vs),
|
|
|
9ae3a8 |
- y * VNC_DIRTY_BPL(vs));
|
|
|
9ae3a8 |
- if (offset == height * VNC_DIRTY_BPL(vs)) {
|
|
|
9ae3a8 |
- /* no more dirty bits */
|
|
|
9ae3a8 |
- break;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- y = offset / VNC_DIRTY_BPL(vs);
|
|
|
9ae3a8 |
- x = offset % VNC_DIRTY_BPL(vs);
|
|
|
9ae3a8 |
- x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y],
|
|
|
9ae3a8 |
- VNC_DIRTY_BPL(vs), x);
|
|
|
9ae3a8 |
- bitmap_clear(vs->dirty[y], x, x2 - x);
|
|
|
9ae3a8 |
- h = find_and_clear_dirty_height(vs, y, x, x2, height);
|
|
|
9ae3a8 |
- x2 = MIN(x2, width / VNC_DIRTY_PIXELS_PER_BIT);
|
|
|
9ae3a8 |
- if (x2 > x) {
|
|
|
9ae3a8 |
- n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y,
|
|
|
9ae3a8 |
- (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h);
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
+ if (!vs->has_dirty && !vs->audio_cap && !vs->force_update) {
|
|
|
9ae3a8 |
+ return 0;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ /*
|
|
|
9ae3a8 |
+ * Send screen updates to the vnc client using the server
|
|
|
9ae3a8 |
+ * surface and server dirty map. guest surface updates
|
|
|
9ae3a8 |
+ * happening in parallel don't disturb us, the next pass will
|
|
|
9ae3a8 |
+ * send them to the client.
|
|
|
9ae3a8 |
+ */
|
|
|
9ae3a8 |
+ job = vnc_job_new(vs);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ height = pixman_image_get_height(vd->server);
|
|
|
9ae3a8 |
+ width = pixman_image_get_width(vd->server);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- vnc_job_push(job);
|
|
|
9ae3a8 |
- vs->force_update = 0;
|
|
|
9ae3a8 |
- vs->has_dirty = 0;
|
|
|
9ae3a8 |
- return n;
|
|
|
9ae3a8 |
+ y = 0;
|
|
|
9ae3a8 |
+ for (;;) {
|
|
|
9ae3a8 |
+ int x, h;
|
|
|
9ae3a8 |
+ unsigned long x2;
|
|
|
9ae3a8 |
+ unsigned long offset = find_next_bit((unsigned long *) &vs->dirty,
|
|
|
9ae3a8 |
+ height * VNC_DIRTY_BPL(vs),
|
|
|
9ae3a8 |
+ y * VNC_DIRTY_BPL(vs));
|
|
|
9ae3a8 |
+ if (offset == height * VNC_DIRTY_BPL(vs)) {
|
|
|
9ae3a8 |
+ /* no more dirty bits */
|
|
|
9ae3a8 |
+ break;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ y = offset / VNC_DIRTY_BPL(vs);
|
|
|
9ae3a8 |
+ x = offset % VNC_DIRTY_BPL(vs);
|
|
|
9ae3a8 |
+ x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y],
|
|
|
9ae3a8 |
+ VNC_DIRTY_BPL(vs), x);
|
|
|
9ae3a8 |
+ bitmap_clear(vs->dirty[y], x, x2 - x);
|
|
|
9ae3a8 |
+ h = find_and_clear_dirty_height(vs, y, x, x2, height);
|
|
|
9ae3a8 |
+ x2 = MIN(x2, width / VNC_DIRTY_PIXELS_PER_BIT);
|
|
|
9ae3a8 |
+ if (x2 > x) {
|
|
|
9ae3a8 |
+ n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y,
|
|
|
9ae3a8 |
+ (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- return 0;
|
|
|
9ae3a8 |
+ vnc_job_push(job);
|
|
|
9ae3a8 |
+ vs->force_update = 0;
|
|
|
9ae3a8 |
+ vs->has_dirty = 0;
|
|
|
9ae3a8 |
+ return n;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
/* audio */
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|