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

4a2fec
From aefded16955d95827bab7b8145388b6de872da38 Mon Sep 17 00:00:00 2001
4a2fec
From: "Daniel P. Berrange" <berrange@redhat.com>
4a2fec
Date: Mon, 5 Feb 2018 11:10:00 +0100
4a2fec
Subject: [PATCH 06/20] ui: remove redundant indentation in vnc_client_update
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-6-berrange@redhat.com>
4a2fec
Patchwork-id: 78876
4a2fec
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH v2 05/17] ui: remove redundant indentation in vnc_client_update
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
Now that previous dead / unreachable code has been removed, we can simplify
4a2fec
the indentation in the vnc_client_update method.
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-4-berrange@redhat.com
4a2fec
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4a2fec
(cherry picked from commit b939eb89b6f320544a9328fa908d881d0024c1ee)
4a2fec
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4a2fec
---
4a2fec
 ui/vnc.c | 112 ++++++++++++++++++++++++++++++++-------------------------------
4a2fec
 1 file changed, 57 insertions(+), 55 deletions(-)
4a2fec
4a2fec
diff --git a/ui/vnc.c b/ui/vnc.c
4a2fec
index 1d2b3a8..2a2e47c 100644
4a2fec
--- a/ui/vnc.c
4a2fec
+++ b/ui/vnc.c
4a2fec
@@ -963,74 +963,76 @@ static int find_and_clear_dirty_height(VncState *vs,
4a2fec
 
4a2fec
 static int vnc_update_client(VncState *vs, int has_dirty)
4a2fec
 {
4a2fec
+    VncDisplay *vd = vs->vd;
4a2fec
+    VncJob *job;
4a2fec
+    int y;
4a2fec
+    int height, width;
4a2fec
+    int n = 0;
4a2fec
+
4a2fec
     if (vs->disconnecting) {
4a2fec
         vnc_disconnect_finish(vs);
4a2fec
         return 0;
4a2fec
     }
4a2fec
 
4a2fec
     vs->has_dirty += has_dirty;
4a2fec
-    if (vs->need_update) {
4a2fec
-        VncDisplay *vd = vs->vd;
4a2fec
-        VncJob *job;
4a2fec
-        int y;
4a2fec
-        int height, width;
4a2fec
-        int n = 0;
4a2fec
-
4a2fec
-        if (vs->output.offset && !vs->audio_cap && !vs->force_update)
4a2fec
-            /* kernel send buffers are full -> drop frames to throttle */
4a2fec
-            return 0;
4a2fec
+    if (!vs->need_update) {
4a2fec
+        return 0;
4a2fec
+    }
4a2fec
 
4a2fec
-        if (!vs->has_dirty && !vs->audio_cap && !vs->force_update)
4a2fec
-            return 0;
4a2fec
+    if (vs->output.offset && !vs->audio_cap && !vs->force_update) {
4a2fec
+        /* kernel send buffers are full -> drop frames to throttle */
4a2fec
+        return 0;
4a2fec
+    }
4a2fec
 
4a2fec
-        /*
4a2fec
-         * Send screen updates to the vnc client using the server
4a2fec
-         * surface and server dirty map.  guest surface updates
4a2fec
-         * happening in parallel don't disturb us, the next pass will
4a2fec
-         * send them to the client.
4a2fec
-         */
4a2fec
-        job = vnc_job_new(vs);
4a2fec
-
4a2fec
-        height = pixman_image_get_height(vd->server);
4a2fec
-        width = pixman_image_get_width(vd->server);
4a2fec
-
4a2fec
-        y = 0;
4a2fec
-        for (;;) {
4a2fec
-            int x, h;
4a2fec
-            unsigned long x2;
4a2fec
-            unsigned long offset = find_next_bit((unsigned long *) &vs->dirty,
4a2fec
-                                                 height * VNC_DIRTY_BPL(vs),
4a2fec
-                                                 y * VNC_DIRTY_BPL(vs));
4a2fec
-            if (offset == height * VNC_DIRTY_BPL(vs)) {
4a2fec
-                /* no more dirty bits */
4a2fec
+    if (!vs->has_dirty && !vs->audio_cap && !vs->force_update) {
4a2fec
+        return 0;
4a2fec
+    }
4a2fec
+
4a2fec
+    /*
4a2fec
+     * Send screen updates to the vnc client using the server
4a2fec
+     * surface and server dirty map.  guest surface updates
4a2fec
+     * happening in parallel don't disturb us, the next pass will
4a2fec
+     * send them to the client.
4a2fec
+     */
4a2fec
+    job = vnc_job_new(vs);
4a2fec
+
4a2fec
+    height = pixman_image_get_height(vd->server);
4a2fec
+    width = pixman_image_get_width(vd->server);
4a2fec
+
4a2fec
+    y = 0;
4a2fec
+    for (;;) {
4a2fec
+        int x, h;
4a2fec
+        unsigned long x2;
4a2fec
+        unsigned long offset = find_next_bit((unsigned long *) &vs->dirty,
4a2fec
+                                             height * VNC_DIRTY_BPL(vs),
4a2fec
+                                             y * VNC_DIRTY_BPL(vs));
4a2fec
+        if (offset == height * VNC_DIRTY_BPL(vs)) {
4a2fec
+            /* no more dirty bits */
4a2fec
+            break;
4a2fec
+        }
4a2fec
+        y = offset / VNC_DIRTY_BPL(vs);
4a2fec
+        x = offset % VNC_DIRTY_BPL(vs);
4a2fec
+        x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y],
4a2fec
+                                VNC_DIRTY_BPL(vs), x);
4a2fec
+        bitmap_clear(vs->dirty[y], x, x2 - x);
4a2fec
+        h = find_and_clear_dirty_height(vs, y, x, x2, height);
4a2fec
+        x2 = MIN(x2, width / VNC_DIRTY_PIXELS_PER_BIT);
4a2fec
+        if (x2 > x) {
4a2fec
+            n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y,
4a2fec
+                                  (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h);
4a2fec
+        }
4a2fec
+        if (!x && x2 == width / VNC_DIRTY_PIXELS_PER_BIT) {
4a2fec
+            y += h;
4a2fec
+            if (y == height) {
4a2fec
                 break;
4a2fec
             }
4a2fec
-            y = offset / VNC_DIRTY_BPL(vs);
4a2fec
-            x = offset % VNC_DIRTY_BPL(vs);
4a2fec
-            x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y],
4a2fec
-                                    VNC_DIRTY_BPL(vs), x);
4a2fec
-            bitmap_clear(vs->dirty[y], x, x2 - x);
4a2fec
-            h = find_and_clear_dirty_height(vs, y, x, x2, height);
4a2fec
-            x2 = MIN(x2, width / VNC_DIRTY_PIXELS_PER_BIT);
4a2fec
-            if (x2 > x) {
4a2fec
-                n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y,
4a2fec
-                                      (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h);
4a2fec
-            }
4a2fec
-            if (!x && x2 == width / VNC_DIRTY_PIXELS_PER_BIT) {
4a2fec
-                y += h;
4a2fec
-                if (y == height) {
4a2fec
-                    break;
4a2fec
-                }
4a2fec
-            }
4a2fec
         }
4a2fec
-
4a2fec
-        vnc_job_push(job);
4a2fec
-        vs->force_update = 0;
4a2fec
-        vs->has_dirty = 0;
4a2fec
-        return n;
4a2fec
     }
4a2fec
 
4a2fec
-    return 0;
4a2fec
+    vnc_job_push(job);
4a2fec
+    vs->force_update = 0;
4a2fec
+    vs->has_dirty = 0;
4a2fec
+    return n;
4a2fec
 }
4a2fec
 
4a2fec
 /* audio */
4a2fec
-- 
4a2fec
1.8.3.1
4a2fec