cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
619821
From 9730b328cc524281334344466a01fb861b271b82 Mon Sep 17 00:00:00 2001
619821
From: Gerd Hoffmann <kraxel@redhat.com>
619821
Date: Wed, 22 Feb 2017 12:36:22 +0100
619821
Subject: [PATCH 04/24] ui/vnc: optimize setting in vnc_dpy_update()
619821
MIME-Version: 1.0
619821
Content-Type: text/plain; charset=UTF-8
619821
Content-Transfer-Encoding: 8bit
619821
619821
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
619821
Message-id: <1487766986-6329-5-git-send-email-kraxel@redhat.com>
619821
Patchwork-id: 73974
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH 4/8] ui/vnc: optimize setting in vnc_dpy_update()
619821
Bugzilla: 1377977
619821
RH-Acked-by: Thomas Huth <thuth@redhat.com>
619821
RH-Acked-by: Marc-André Lureau <mlureau@redhat.com>
619821
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
619821
619821
From: Peter Lieven <pl@kamp.de>
619821
619821
Signed-off-by: Peter Lieven <pl@kamp.de>
619821
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
619821
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
619821
(cherry picked from commit 919372251cbfa9e43b0264fec475dd1eca23784f)
619821
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
619821
---
619821
 ui/vnc.c | 16 +++++-----------
619821
 1 file changed, 5 insertions(+), 11 deletions(-)
619821
619821
diff --git a/ui/vnc.c b/ui/vnc.c
619821
index 54530a2..2540261 100644
619821
--- a/ui/vnc.c
619821
+++ b/ui/vnc.c
619821
@@ -430,30 +430,24 @@ static int vnc_refresh_server_surface(VncDisplay *vd);
619821
 static void vnc_dpy_update(DisplayChangeListener *dcl,
619821
                            int x, int y, int w, int h)
619821
 {
619821
-    int i;
619821
     VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
619821
     struct VncSurface *s = &vd->guest;
619821
     int width = surface_width(vd->ds);
619821
     int height = surface_height(vd->ds);
619821
 
619821
-    h += y;
619821
-
619821
-    /* round x down to ensure the loop only spans one 16-pixel block per,
619821
-       iteration.  otherwise, if (x % 16) != 0, the last iteration may span
619821
-       two 16-pixel blocks but we only mark the first as dirty
619821
-    */
619821
+    /* this is needed this to ensure we updated all affected
619821
+     * blocks if x % VNC_DIRTY_PIXELS_PER_BIT != 0 */
619821
     w += (x % VNC_DIRTY_PIXELS_PER_BIT);
619821
     x -= (x % VNC_DIRTY_PIXELS_PER_BIT);
619821
 
619821
     x = MIN(x, width);
619821
     y = MIN(y, height);
619821
     w = MIN(x + w, width) - x;
619821
-    h = MIN(h, height);
619821
+    h = MIN(y + h, height);
619821
 
619821
     for (; y < h; y++) {
619821
-        for (i = 0; i < w; i += VNC_DIRTY_PIXELS_PER_BIT) {
619821
-            set_bit((x + i) / VNC_DIRTY_PIXELS_PER_BIT, s->dirty[y]);
619821
-        }
619821
+        bitmap_set(s->dirty[y], x / VNC_DIRTY_PIXELS_PER_BIT,
619821
+                   DIV_ROUND_UP(w, VNC_DIRTY_PIXELS_PER_BIT));
619821
     }
619821
 }
619821
 
619821
-- 
619821
1.8.3.1
619821