|
|
9ae3a8 |
From e7fa743d920c9c201bcf1e42e2c0058249a5c1e5 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 8 Feb 2018 17:50:27 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 13/27] vnc: only alloc server surface with clients connected
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20180208175041.5634-14-berrange@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 78956
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v1 13/27] vnc: only alloc server surface with clients connected
|
|
|
9ae3a8 |
Bugzilla: 1527405
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RHEL-7 note: (a) the "graphic_hw_update(NULL)" call is different in the
|
|
|
9ae3a8 |
upstream context due to commit 1d0d59fe2919 ("vnc: allow binding servers
|
|
|
9ae3a8 |
to qemu consoles", 2015-01-22). That commit talks about "multiseat" and
|
|
|
9ae3a8 |
is part of v2.3.0, so out of scope for this backport. (b) The
|
|
|
9ae3a8 |
QTAILQ_INSERT_HEAD() macro invocation is QTAILQ_INSERT_TAIL() in the
|
|
|
9ae3a8 |
upstream context, due to commit e5f34cdd2da5 ("vnc: track &
|
|
|
9ae3a8 |
limit connections", 2015-01-22), part of v2.3.0. That commit is also
|
|
|
9ae3a8 |
irrelevant for this backport.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Peter Lieven <pl@kamp.de>
|
|
|
9ae3a8 |
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
|
|
|
9ae3a8 |
Message-id: 1446203414-4013-15-git-send-email-kraxel@redhat.com
|
|
|
9ae3a8 |
(cherry picked from commit c7628bff4138ce906a3620d12e0820c1cf6c140d)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Conflicts:
|
|
|
9ae3a8 |
ui/vnc.c - context differences
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
ui/vnc.c | 12 ++++++++++++
|
|
|
9ae3a8 |
1 file changed, 12 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/ui/vnc.c b/ui/vnc.c
|
|
|
9ae3a8 |
index df081a5..dc09089 100644
|
|
|
9ae3a8 |
--- a/ui/vnc.c
|
|
|
9ae3a8 |
+++ b/ui/vnc.c
|
|
|
9ae3a8 |
@@ -620,6 +620,10 @@ static void vnc_update_server_surface(VncDisplay *vd)
|
|
|
9ae3a8 |
qemu_pixman_image_unref(vd->server);
|
|
|
9ae3a8 |
vd->server = NULL;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+ if (QTAILQ_EMPTY(&vd->clients)) {
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
|
|
|
9ae3a8 |
vnc_width(vd),
|
|
|
9ae3a8 |
vnc_height(vd),
|
|
|
9ae3a8 |
@@ -1019,6 +1023,10 @@ void vnc_disconnect_finish(VncState *vs)
|
|
|
9ae3a8 |
if (vs->initialized) {
|
|
|
9ae3a8 |
QTAILQ_REMOVE(&vs->vd->clients, vs, next);
|
|
|
9ae3a8 |
qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
|
|
|
9ae3a8 |
+ if (QTAILQ_EMPTY(&vs->vd->clients)) {
|
|
|
9ae3a8 |
+ /* last client gone */
|
|
|
9ae3a8 |
+ vnc_update_server_surface(vs->vd);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (vs->vd->lock_key_sync)
|
|
|
9ae3a8 |
@@ -2819,6 +2827,7 @@ void vnc_init_state(VncState *vs)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
vs->initialized = true;
|
|
|
9ae3a8 |
VncDisplay *vd = vs->vd;
|
|
|
9ae3a8 |
+ bool first_client = QTAILQ_EMPTY(&vd->clients);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
vs->last_x = -1;
|
|
|
9ae3a8 |
vs->last_y = -1;
|
|
|
9ae3a8 |
@@ -2832,6 +2841,9 @@ void vnc_init_state(VncState *vs)
|
|
|
9ae3a8 |
vs->bh = qemu_bh_new(vnc_jobs_bh, vs);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
QTAILQ_INSERT_HEAD(&vd->clients, vs, next);
|
|
|
9ae3a8 |
+ if (first_client) {
|
|
|
9ae3a8 |
+ vnc_update_server_surface(vd);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
graphic_hw_update(NULL);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|