[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/19] vnc: only alloc server surface with clients c
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 14/19] vnc: only alloc server surface with clients connected |
Date: |
Fri, 30 Oct 2015 12:10:09 +0100 |
Signed-off-by: Gerd Hoffmann <address@hidden>
---
ui/vnc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ui/vnc.c b/ui/vnc.c
index 8ee1266..c5bef47 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -721,6 +721,10 @@ static void vnc_update_server_surface(VncDisplay *vd)
qemu_pixman_image_unref(vd->server);
vd->server = NULL;
+ if (QTAILQ_EMPTY(&vd->clients)) {
+ return;
+ }
+
vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
vnc_width(vd),
vnc_height(vd),
@@ -1231,6 +1235,10 @@ void vnc_disconnect_finish(VncState *vs)
if (vs->initialized) {
QTAILQ_REMOVE(&vs->vd->clients, vs, next);
qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier);
+ if (QTAILQ_EMPTY(&vs->vd->clients)) {
+ /* last client gone */
+ vnc_update_server_surface(vs->vd);
+ }
}
if (vs->vd->lock_key_sync)
@@ -3069,6 +3077,7 @@ void vnc_init_state(VncState *vs)
{
vs->initialized = true;
VncDisplay *vd = vs->vd;
+ bool first_client = QTAILQ_EMPTY(&vd->clients);
vs->last_x = -1;
vs->last_y = -1;
@@ -3082,6 +3091,9 @@ void vnc_init_state(VncState *vs)
vs->bh = qemu_bh_new(vnc_jobs_bh, vs);
QTAILQ_INSERT_TAIL(&vd->clients, vs, next);
+ if (first_client) {
+ vnc_update_server_surface(vd);
+ }
graphic_hw_update(vd->dcl.con);
--
1.8.3.1
- [Qemu-devel] [PATCH 13/19] vnc: use vnc_{width, height} in vnc_set_area_dirty, (continued)
- [Qemu-devel] [PATCH 13/19] vnc: use vnc_{width, height} in vnc_set_area_dirty, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 18/19] buffer: factor out buffer_adj_size, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 17/19] buffer: factor out buffer_req_size, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 07/19] vnc: attach names to buffers, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 02/19] buffer: add buffer_init, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 14/19] vnc: only alloc server surface with clients connected,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 16/19] vnc: recycle empty vs->output buffer, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 12/19] vnc: factor out vnc_update_server_surface, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 01/19] buffer: make the Buffer capacity increase in powers of two, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 11/19] vnc: add vnc_width+vnc_height helpers, Gerd Hoffmann, 2015/10/30
- [Qemu-devel] [PATCH 15/19] vnc: fix local state init, Gerd Hoffmann, 2015/10/30