From nobody Sun Sep 28 08:02:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547633532814608.0103123670448; Wed, 16 Jan 2019 02:12:12 -0800 (PST) Received: from localhost ([127.0.0.1]:43252 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjiAx-0004Nd-SH for importer@patchew.org; Wed, 16 Jan 2019 05:11:59 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjiA1-00044s-85 for qemu-devel@nongnu.org; Wed, 16 Jan 2019 05:11:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gji9y-0001lH-0u for qemu-devel@nongnu.org; Wed, 16 Jan 2019 05:10:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gji9u-0001fD-61 for qemu-devel@nongnu.org; Wed, 16 Jan 2019 05:10:56 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E062BC000661 for ; Wed, 16 Jan 2019 10:10:52 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-186.ams2.redhat.com [10.36.117.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52FC219751; Wed, 16 Jan 2019 10:10:50 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7056759E4; Wed, 16 Jan 2019 11:10:49 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 16 Jan 2019 11:10:49 +0100 Message-Id: <20190116101049.8929-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 16 Jan 2019 10:10:52 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] vnc: detect and optimize pageflips 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When size and format of the display surface stays the same we can just tag the guest display as dirty and be done with it. There is no need need to resize the vnc server display or to touch the vnc client dirty bits. On the next refresh cycle vnc_refresh_server_surface() will check for actual display content changes and update the client dirty bits as needed. The desktop resize and framebuffer format notifications to the vnc client will be skipped too. Signed-off-by: Gerd Hoffmann Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/vnc.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 9e4b2beb71..6002d09407 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -742,6 +742,17 @@ static void vnc_update_server_surface(VncDisplay *vd) width, height); } =20 +static bool vnc_check_pageflip(DisplaySurface *s1, + DisplaySurface *s2) +{ + return (s1 !=3D NULL && + s2 !=3D NULL && + surface_width(s1) =3D=3D surface_width(s2) && + surface_height(s1) =3D=3D surface_height(s2) && + surface_format(s1) =3D=3D surface_format(s2)); + +} + static void vnc_dpy_switch(DisplayChangeListener *dcl, DisplaySurface *surface) { @@ -749,6 +760,7 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, "Display output is not active."; static DisplaySurface *placeholder; VncDisplay *vd =3D container_of(dcl, VncDisplay, dcl); + bool pageflip =3D vnc_check_pageflip(vd->ds, surface); VncState *vs; =20 if (surface =3D=3D NULL) { @@ -761,14 +773,21 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl, vnc_abort_display_jobs(vd); vd->ds =3D surface; =20 - /* server surface */ - vnc_update_server_surface(vd); - /* guest surface */ qemu_pixman_image_unref(vd->guest.fb); vd->guest.fb =3D pixman_image_ref(surface->image); vd->guest.format =3D surface->format; =20 + if (pageflip) { + vnc_set_area_dirty(vd->guest.dirty, vd, 0, 0, + surface_width(surface), + surface_height(surface)); + return; + } + + /* server surface */ + vnc_update_server_surface(vd); + QTAILQ_FOREACH(vs, &vd->clients, next) { vnc_colordepth(vs); vnc_desktop_resize(vs); --=20 2.9.3