Blame SOURCES/kvm-ui-remove-redundant-indentation-in-vnc_client_update.patch

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