5d360b
From 38debd5362a680a90db572263f7b49ecbde24ac1 Mon Sep 17 00:00:00 2001
5d360b
From: "Daniel P. Berrange" <berrange@redhat.com>
5d360b
Date: Thu, 8 Feb 2018 17:50:26 +0100
5d360b
Subject: [PATCH 12/27] vnc: use vnc_{width, height} in vnc_set_area_dirty
5d360b
5d360b
RH-Author: Daniel P. Berrange <berrange@redhat.com>
5d360b
Message-id: <20180208175041.5634-13-berrange@redhat.com>
5d360b
Patchwork-id: 78945
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 12/27] vnc: use vnc_{width, height} in vnc_set_area_dirty
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: Gerd Hoffmann <kraxel@redhat.com>
5d360b
5d360b
vnc: use vnc_{width,height} in vnc_set_area_dirty
5d360b
5d360b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
5d360b
Reviewed-by: Peter Lieven <pl@kamp.de>
5d360b
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
5d360b
Message-id: 1446203414-4013-14-git-send-email-kraxel@redhat.com
5d360b
(cherry picked from commit f7b3d68c95bc4f8915a3d084360aa07c7f4e4717)
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 ui/vnc.c | 21 ++++++++++-----------
5d360b
 1 file changed, 10 insertions(+), 11 deletions(-)
5d360b
5d360b
diff --git a/ui/vnc.c b/ui/vnc.c
5d360b
index 38e0f1a..df081a5 100644
5d360b
--- a/ui/vnc.c
5d360b
+++ b/ui/vnc.c
5d360b
@@ -439,8 +439,12 @@ static int vnc_height(VncDisplay *vd)
5d360b
 
5d360b
 static void vnc_set_area_dirty(DECLARE_BITMAP(dirty[VNC_MAX_HEIGHT],
5d360b
                                VNC_MAX_WIDTH / VNC_DIRTY_PIXELS_PER_BIT),
5d360b
-                               int width, int height,
5d360b
-                               int x, int y, int w, int h) {
5d360b
+                               VncDisplay *vd,
5d360b
+                               int x, int y, int w, int h)
5d360b
+{
5d360b
+    int width = vnc_width(vd);
5d360b
+    int height = vnc_height(vd);
5d360b
+
5d360b
     /* this is needed this to ensure we updated all affected
5d360b
      * blocks if x % VNC_DIRTY_PIXELS_PER_BIT != 0 */
5d360b
     w += (x % VNC_DIRTY_PIXELS_PER_BIT);
5d360b
@@ -462,10 +466,8 @@ static void vnc_dpy_update(DisplayChangeListener *dcl,
5d360b
 {
5d360b
     VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
5d360b
     struct VncSurface *s = &vd->guest;
5d360b
-    int width = pixman_image_get_width(vd->server);
5d360b
-    int height = pixman_image_get_height(vd->server);
5d360b
 
5d360b
-    vnc_set_area_dirty(s->dirty, width, height, x, y, w, h);
5d360b
+    vnc_set_area_dirty(s->dirty, vd, x, y, w, h);
5d360b
 }
5d360b
 
5d360b
 void vnc_framebuffer_update(VncState *vs, int x, int y, int w, int h,
5d360b
@@ -644,7 +646,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
5d360b
     width = vnc_width(vd);
5d360b
     height = vnc_height(vd);
5d360b
     memset(vd->guest.dirty, 0x00, sizeof(vd->guest.dirty));
5d360b
-    vnc_set_area_dirty(vd->guest.dirty, width, height, 0, 0,
5d360b
+    vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0,
5d360b
                        width, height);
5d360b
 
5d360b
     QTAILQ_FOREACH(vs, &vd->clients, next) {
5d360b
@@ -654,7 +656,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
5d360b
             vnc_cursor_define(vs);
5d360b
         }
5d360b
         memset(vs->dirty, 0x00, sizeof(vs->dirty));
5d360b
-        vnc_set_area_dirty(vs->dirty, width, height, 0, 0,
5d360b
+        vnc_set_area_dirty(vs->dirty, vd, 0, 0,
5d360b
                            width, height);
5d360b
     }
5d360b
 }
5d360b
@@ -1816,9 +1818,6 @@ static void ext_key_event(VncState *vs, int down,
5d360b
 static void framebuffer_update_request(VncState *vs, int incremental,
5d360b
                                        int x, int y, int w, int h)
5d360b
 {
5d360b
-    int width = pixman_image_get_width(vs->vd->server);
5d360b
-    int height = pixman_image_get_height(vs->vd->server);
5d360b
-
5d360b
     vs->need_update = 1;
5d360b
 
5d360b
     if (incremental) {
5d360b
@@ -1826,7 +1825,7 @@ static void framebuffer_update_request(VncState *vs, int incremental,
5d360b
     }
5d360b
 
5d360b
     vs->force_update = 1;
5d360b
-    vnc_set_area_dirty(vs->dirty, width, height, x, y, w, h);
5d360b
+    vnc_set_area_dirty(vs->dirty, vs->vd, x, y, w, h);
5d360b
 }
5d360b
 
5d360b
 static void send_ext_key_event_ack(VncState *vs)
5d360b
-- 
5d360b
1.8.3.1
5d360b