yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
5d360b
From 2f0eb4848baaa020132d5848a5d05e9db55fb15c Mon Sep 17 00:00:00 2001
5d360b
From: "Daniel P. Berrange" <berrange@redhat.com>
5d360b
Date: Thu, 8 Feb 2018 17:50:24 +0100
5d360b
Subject: [PATCH 10/27] vnc: add vnc_width+vnc_height helpers
5d360b
5d360b
RH-Author: Daniel P. Berrange <berrange@redhat.com>
5d360b
Message-id: <20180208175041.5634-11-berrange@redhat.com>
5d360b
Patchwork-id: 78943
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 10/27] vnc: add vnc_width+vnc_height helpers
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
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-12-git-send-email-kraxel@redhat.com
5d360b
(cherry picked from commit d05959c2e111858bb83c40ae5d8b8c10964b7bb0)
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 ui/vnc.c | 16 +++++++++++++---
5d360b
 1 file changed, 13 insertions(+), 3 deletions(-)
5d360b
5d360b
diff --git a/ui/vnc.c b/ui/vnc.c
5d360b
index 9923d24..c3f29df 100644
5d360b
--- a/ui/vnc.c
5d360b
+++ b/ui/vnc.c
5d360b
@@ -426,6 +426,17 @@ static void framebuffer_update_request(VncState *vs, int incremental,
5d360b
 static void vnc_refresh(DisplayChangeListener *dcl);
5d360b
 static int vnc_refresh_server_surface(VncDisplay *vd);
5d360b
 
5d360b
+static int vnc_width(VncDisplay *vd)
5d360b
+{
5d360b
+    return MIN(VNC_MAX_WIDTH, ROUND_UP(surface_width(vd->ds),
5d360b
+                                       VNC_DIRTY_PIXELS_PER_BIT));
5d360b
+}
5d360b
+
5d360b
+static int vnc_height(VncDisplay *vd)
5d360b
+{
5d360b
+    return MIN(VNC_MAX_HEIGHT, surface_height(vd->ds));
5d360b
+}
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
@@ -614,9 +625,8 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
5d360b
     /* server surface */
5d360b
     qemu_pixman_image_unref(vd->server);
5d360b
     vd->ds = surface;
5d360b
-    width = MIN(VNC_MAX_WIDTH, ROUND_UP(surface_width(vd->ds),
5d360b
-                                        VNC_DIRTY_PIXELS_PER_BIT));
5d360b
-    height = MIN(VNC_MAX_HEIGHT, surface_height(vd->ds));
5d360b
+    width = vnc_width(vd);
5d360b
+    height = vnc_height(vd);
5d360b
     vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
5d360b
                                           width, height, NULL, 0);
5d360b
 
5d360b
-- 
5d360b
1.8.3.1
5d360b