From nobody Tue Feb 10 17:08:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1515762065346445.3603093456031; Fri, 12 Jan 2018 05:01:05 -0800 (PST) Received: from localhost ([::1]:39914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZyxE-0004ni-AA for importer@patchew.org; Fri, 12 Jan 2018 08:01:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZyvG-0003N4-FF for qemu-devel@nongnu.org; Fri, 12 Jan 2018 07:59:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZyvF-0002op-CB for qemu-devel@nongnu.org; Fri, 12 Jan 2018 07:59:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51434) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eZyvF-0002nv-4A for qemu-devel@nongnu.org; Fri, 12 Jan 2018 07:59:01 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32DDA7653E for ; Fri, 12 Jan 2018 12:59:00 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-239.ams2.redhat.com [10.36.116.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54D5C7B8E3; Fri, 12 Jan 2018 12:58:57 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 74394409D2; Fri, 12 Jan 2018 13:58:54 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 13:58:47 +0100 Message-Id: <20180112125854.18261-8-kraxel@redhat.com> In-Reply-To: <20180112125854.18261-1-kraxel@redhat.com> References: <20180112125854.18261-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 12 Jan 2018 12:59:00 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/14] ui: introduce enum to track VNC client framebuffer update request state 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" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" Currently the VNC servers tracks whether a client has requested an incremen= tal or forced update with two boolean flags. There are only really 3 distinct states to track, so create an enum to more accurately reflect permitted sta= tes. Signed-off-by: Daniel P. Berrange Reviewed-by: Darren Kenny Reviewed-by: Marc-Andr=C3=A9 Lureau Message-id: 20171218191228.31018-7-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc.h | 9 +++++++-- ui/vnc.c | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ui/vnc.h b/ui/vnc.h index 694cf32ca9..b9d310e640 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -252,6 +252,12 @@ struct VncJob QTAILQ_ENTRY(VncJob) next; }; =20 +typedef enum { + VNC_STATE_UPDATE_NONE, + VNC_STATE_UPDATE_INCREMENTAL, + VNC_STATE_UPDATE_FORCE, +} VncStateUpdate; + struct VncState { QIOChannelSocket *sioc; /* The underlying socket */ @@ -264,8 +270,7 @@ struct VncState * vnc-jobs-async.c */ =20 VncDisplay *vd; - int need_update; - int force_update; + VncStateUpdate update; /* Most recent pending request from client */ int has_dirty; uint32_t features; int absolute; diff --git a/ui/vnc.c b/ui/vnc.c index a79848f083..30e2feeae3 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -975,16 +975,17 @@ static int vnc_update_client(VncState *vs, int has_di= rty) } =20 vs->has_dirty +=3D has_dirty; - if (!vs->need_update) { + if (vs->update =3D=3D VNC_STATE_UPDATE_NONE) { return 0; } =20 - if (vs->output.offset && !vs->audio_cap && !vs->force_update) { + if (vs->output.offset && !vs->audio_cap && + vs->update !=3D VNC_STATE_UPDATE_FORCE) { /* kernel send buffers are full -> drop frames to throttle */ return 0; } =20 - if (!vs->has_dirty && !vs->force_update) { + if (!vs->has_dirty && vs->update !=3D VNC_STATE_UPDATE_FORCE) { return 0; } =20 @@ -1030,7 +1031,7 @@ static int vnc_update_client(VncState *vs, int has_di= rty) } =20 vnc_job_push(job); - vs->force_update =3D 0; + vs->update =3D VNC_STATE_UPDATE_INCREMENTAL; vs->has_dirty =3D 0; return n; } @@ -1869,14 +1870,14 @@ static void ext_key_event(VncState *vs, int down, static void framebuffer_update_request(VncState *vs, int incremental, int x, int y, int w, int h) { - vs->need_update =3D 1; - if (incremental) { - return; + if (vs->update !=3D VNC_STATE_UPDATE_FORCE) { + vs->update =3D VNC_STATE_UPDATE_INCREMENTAL; + } + } else { + vs->update =3D VNC_STATE_UPDATE_FORCE; + vnc_set_area_dirty(vs->dirty, vs->vd, x, y, w, h); } - - vs->force_update =3D 1; - vnc_set_area_dirty(vs->dirty, vs->vd, x, y, w, h); } =20 static void send_ext_key_event_ack(VncState *vs) --=20 2.9.3