From nobody Tue Oct 28 20:59:22 2025 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513625241087847.5448286852327; Mon, 18 Dec 2017 11:27:21 -0800 (PST) Received: from localhost ([::1]:33196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR149-00020x-TD for importer@patchew.org; Mon, 18 Dec 2017 14:27:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eR0qS-0006Pr-Uw for qemu-devel@nongnu.org; Mon, 18 Dec 2017 14:13:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eR0qK-000570-VQ for qemu-devel@nongnu.org; Mon, 18 Dec 2017 14:13:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54862) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eR0qK-00055P-Ji for qemu-devel@nongnu.org; Mon, 18 Dec 2017 14:12:52 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A604581226 for ; Mon, 18 Dec 2017 19:12:51 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9041484D17; Mon, 18 Dec 2017 19:12:50 +0000 (UTC) From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Mon, 18 Dec 2017 19:12:21 +0000 Message-Id: <20171218191228.31018-7-berrange@redhat.com> In-Reply-To: <20171218191228.31018-1-berrange@redhat.com> References: <20171218191228.31018-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 18 Dec 2017 19:12:51 +0000 (UTC) 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] [PATCH v1 06/13] 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , P J P Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- ui/vnc.c | 21 +++++++++++---------- ui/vnc.h | 9 +++++++-- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index f53eddb8e5..d3b04f1166 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) 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; --=20 2.14.3