yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
5d360b
From cf12dd3eb8a9c18fbccbe01cfcf8290d483becee Mon Sep 17 00:00:00 2001
5d360b
From: "Daniel P. Berrange" <berrange@redhat.com>
5d360b
Date: Thu, 8 Feb 2018 17:50:25 +0100
5d360b
Subject: [PATCH 11/27] vnc: factor out vnc_update_server_surface
5d360b
5d360b
RH-Author: Daniel P. Berrange <berrange@redhat.com>
5d360b
Message-id: <20180208175041.5634-12-berrange@redhat.com>
5d360b
Patchwork-id: 78952
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 11/27] vnc: factor out vnc_update_server_surface
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-13-git-send-email-kraxel@redhat.com
5d360b
(cherry picked from commit 453f842bc4cab49f10c267cff9ad3cf657265d49)
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 ui/vnc.c | 21 +++++++++++++++------
5d360b
 1 file changed, 15 insertions(+), 6 deletions(-)
5d360b
5d360b
diff --git a/ui/vnc.c b/ui/vnc.c
5d360b
index c3f29df..38e0f1a 100644
5d360b
--- a/ui/vnc.c
5d360b
+++ b/ui/vnc.c
5d360b
@@ -613,6 +613,17 @@ void *vnc_server_fb_ptr(VncDisplay *vd, int x, int y)
5d360b
     return ptr;
5d360b
 }
5d360b
 
5d360b
+static void vnc_update_server_surface(VncDisplay *vd)
5d360b
+{
5d360b
+    qemu_pixman_image_unref(vd->server);
5d360b
+    vd->server = NULL;
5d360b
+
5d360b
+    vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
5d360b
+                                          vnc_width(vd),
5d360b
+                                          vnc_height(vd),
5d360b
+                                          NULL, 0);
5d360b
+}
5d360b
+
5d360b
 static void vnc_dpy_switch(DisplayChangeListener *dcl,
5d360b
                            DisplaySurface *surface)
5d360b
 {
5d360b
@@ -621,19 +632,17 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
5d360b
     int width, height;
5d360b
 
5d360b
     vnc_abort_display_jobs(vd);
5d360b
+    vd->ds = surface;
5d360b
 
5d360b
     /* server surface */
5d360b
-    qemu_pixman_image_unref(vd->server);
5d360b
-    vd->ds = surface;
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
+    vnc_update_server_surface(vd);
5d360b
 
5d360b
     /* guest surface */
5d360b
     qemu_pixman_image_unref(vd->guest.fb);
5d360b
     vd->guest.fb = pixman_image_ref(surface->image);
5d360b
     vd->guest.format = surface->format;
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
                        width, height);
5d360b
-- 
5d360b
1.8.3.1
5d360b