From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN04f-0001TF-9j for qemu-devel@nongnu.org; Mon, 10 Mar 2014 09:17:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WN04V-00013K-Jc for qemu-devel@nongnu.org; Mon, 10 Mar 2014 09:16:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15067) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WN04V-00012y-Bu for qemu-devel@nongnu.org; Mon, 10 Mar 2014 09:16:47 -0400 From: Gerd Hoffmann Date: Mon, 10 Mar 2014 14:16:38 +0100 Message-Id: <1394457400-31756-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1394457400-31756-1-git-send-email-kraxel@redhat.com> References: <1394457400-31756-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/3] spice: fix simple display surface handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann , Anthony Liguori Signed-off-by: Gerd Hoffmann --- ui/spice-display.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/spice-display.c b/ui/spice-display.c index 9bb42f1..2a1fbda 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -354,6 +354,7 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, DisplaySurface *surface) { SimpleSpiceUpdate *update; + bool need_destroy; dprint(1, "%s/%d:\n", __func__, ssd->qxl.id); @@ -366,14 +367,19 @@ void qemu_spice_display_switch(SimpleSpiceDisplay *ssd, } qemu_mutex_lock(&ssd->lock); + need_destroy = (ssd->ds != NULL); ssd->ds = surface; while ((update = QTAILQ_FIRST(&ssd->updates)) != NULL) { QTAILQ_REMOVE(&ssd->updates, update, next); qemu_spice_destroy_update(ssd, update); } qemu_mutex_unlock(&ssd->lock); - qemu_spice_destroy_host_primary(ssd); - qemu_spice_create_host_primary(ssd); + if (need_destroy) { + qemu_spice_destroy_host_primary(ssd); + } + if (ssd->ds) { + qemu_spice_create_host_primary(ssd); + } memset(&ssd->dirty, 0, sizeof(ssd->dirty)); ssd->notify++; @@ -610,8 +616,6 @@ static void qemu_spice_display_init_one(QemuConsole *con) ssd->dcl.ops = &display_listener_ops; ssd->dcl.con = con; register_displaychangelistener(&ssd->dcl); - - qemu_spice_create_host_primary(ssd); } void qemu_spice_display_init(void) -- 1.8.3.1