From patchwork Tue Sep 20 17:05:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 672378 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sdqHD42Y3z9rxm for ; Wed, 21 Sep 2016 03:19:04 +1000 (AEST) Received: from localhost ([::1]:36867 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmOhC-0001EZ-4r for incoming@patchwork.ozlabs.org; Tue, 20 Sep 2016 13:19:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmOUt-0007Sd-IK for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmOUp-0007Vt-9N for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:06:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmOUo-0007Um-Ut for qemu-devel@nongnu.org; Tue, 20 Sep 2016 13:06:15 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8KH3L8Q107663 for ; Tue, 20 Sep 2016 13:06:14 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 25k0w3vtbe-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 20 Sep 2016 13:06:14 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Sep 2016 11:06:13 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 20 Sep 2016 11:06:11 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 18EDA3E4003E; Tue, 20 Sep 2016 11:06:11 -0600 (MDT) Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u8KH6AUO10944774; Tue, 20 Sep 2016 10:06:11 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF6026E038; Tue, 20 Sep 2016 11:06:10 -0600 (MDT) Received: from localhost (unknown [9.53.92.191]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id B9B7A6E03A; Tue, 20 Sep 2016 11:06:10 -0600 (MDT) From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 20 Sep 2016 12:05:18 -0500 X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474391141-16623-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1474391141-16623-1-git-send-email-mdroth@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092017-8235-0000-0000-0000093E513C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005792; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000185; SDB=6.00759545; UDB=6.00361078; IPR=6.00533875; BA=6.00004739; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012728; XFM=3.00000011; UTC=2016-09-20 17:06:12 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092017-8236-0000-0000-00003500E904 Message-Id: <1474391141-16623-3-git-send-email-mdroth@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-20_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609020000 definitions=main-1609200216 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 02/25] ui: fix refresh of VNC server surface X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Daniel P. Berrange" In previous commit commit c7628bff4138ce906a3620d12e0820c1cf6c140d Author: Gerd Hoffmann Date: Fri Oct 30 12:10:09 2015 +0100 vnc: only alloc server surface with clients connected the VNC server was changed so that the 'vd->server' pixman image was only allocated when a client is connected. Since then if a client disconnects and then reconnects to the VNC server all they will see is a black screen until they do something that triggers a refresh. On a graphical desktop this is not often noticed since there's many things going on which cause a refresh. On a plain text console it is really obvious since nothing refreshes frequently. The problem is that the VNC server didn't update the guest dirty bitmap, so still believes its server image is in sync with the guest contents. To fix this we must explicitly mark the entire guest desktop as dirty after re-creating the server surface. Move this logic into vnc_update_server_surface() so it is guaranteed to be call in all code paths that re-create the surface instead of only in vnc_dpy_switch() Signed-off-by: Daniel P. Berrange Reviewed-by: Peter Lieven Tested-by: Peter Lieven Message-id: 1471365032-18096-1-git-send-email-berrange@redhat.com Signed-off-by: Peter Maydell (cherry picked from commit b69a553b4af9bc87a8b2e0a7b7a7de4cc7f0557e) Signed-off-by: Michael Roth --- ui/vnc.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 3e89dad..78a586f 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -687,6 +687,8 @@ void *vnc_server_fb_ptr(VncDisplay *vd, int x, int y) static void vnc_update_server_surface(VncDisplay *vd) { + int width, height; + qemu_pixman_image_unref(vd->server); vd->server = NULL; @@ -694,10 +696,15 @@ static void vnc_update_server_surface(VncDisplay *vd) return; } + width = vnc_width(vd); + height = vnc_height(vd); vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT, - vnc_width(vd), - vnc_height(vd), + width, height, NULL, 0); + + memset(vd->guest.dirty, 0x00, sizeof(vd->guest.dirty)); + vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0, + width, height); } static void vnc_dpy_switch(DisplayChangeListener *dcl, @@ -705,7 +712,6 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, { VncDisplay *vd = container_of(dcl, VncDisplay, dcl); VncState *vs; - int width, height; vnc_abort_display_jobs(vd); vd->ds = surface; @@ -717,11 +723,6 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb = pixman_image_ref(surface->image); vd->guest.format = surface->format; - width = vnc_width(vd); - height = vnc_height(vd); - memset(vd->guest.dirty, 0x00, sizeof(vd->guest.dirty)); - vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0, - width, height); QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); @@ -731,7 +732,8 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, } memset(vs->dirty, 0x00, sizeof(vs->dirty)); vnc_set_area_dirty(vs->dirty, vd, 0, 0, - width, height); + vnc_width(vd), + vnc_height(vd)); } }