From patchwork Fri Jan 12 12:58:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 10160755 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5C12C60327 for ; Fri, 12 Jan 2018 13:00:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49AF2289F4 for ; Fri, 12 Jan 2018 13:00:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D4DF289F3; Fri, 12 Jan 2018 13:00:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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 mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2334B289F4 for ; Fri, 12 Jan 2018 13:00:23 +0000 (UTC) Received: from localhost ([::1]:39913 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZywY-0004j5-V3 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 12 Jan 2018 08:00:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZyvD-0003L5-JV for qemu-devel@nongnu.org; Fri, 12 Jan 2018 07:59:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZyvA-0002iP-SM for qemu-devel@nongnu.org; Fri, 12 Jan 2018 07:58:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56729) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eZyvA-0002hU-JZ for qemu-devel@nongnu.org; Fri, 12 Jan 2018 07:58:56 -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 A690840111 for ; Fri, 12 Jan 2018 12:58:55 +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 2260F909E3; Fri, 12 Jan 2018 12:58:55 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 588DF40858; Fri, 12 Jan 2018 13:58:54 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 13:58:44 +0100 Message-Id: <20180112125854.18261-5-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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 12 Jan 2018 12:58:55 +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] [PULL 04/14] ui: remove redundant indentation in vnc_client_update 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Daniel P. Berrange" Now that previous dead / unreachable code has been removed, we can simplify the indentation in the vnc_client_update method. Signed-off-by: Daniel P. Berrange Reviewed-by: Darren Kenny Reviewed-by: Marc-André Lureau Message-id: 20171218191228.31018-4-berrange@redhat.com Signed-off-by: Gerd Hoffmann --- ui/vnc.c | 106 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 54 insertions(+), 52 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 29a7208475..7582111ca6 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -963,74 +963,76 @@ static int find_and_clear_dirty_height(VncState *vs, static int vnc_update_client(VncState *vs, int has_dirty) { + VncDisplay *vd = vs->vd; + VncJob *job; + int y; + int height, width; + int n = 0; + if (vs->disconnecting) { vnc_disconnect_finish(vs); return 0; } vs->has_dirty += has_dirty; - if (vs->need_update) { - VncDisplay *vd = vs->vd; - VncJob *job; - int y; - int height, width; - int n = 0; + if (!vs->need_update) { + return 0; + } - if (vs->output.offset && !vs->audio_cap && !vs->force_update) - /* kernel send buffers are full -> drop frames to throttle */ - return 0; + if (vs->output.offset && !vs->audio_cap && !vs->force_update) { + /* kernel send buffers are full -> drop frames to throttle */ + return 0; + } - if (!vs->has_dirty && !vs->audio_cap && !vs->force_update) - return 0; + if (!vs->has_dirty && !vs->audio_cap && !vs->force_update) { + return 0; + } - /* - * Send screen updates to the vnc client using the server - * surface and server dirty map. guest surface updates - * happening in parallel don't disturb us, the next pass will - * send them to the client. - */ - job = vnc_job_new(vs); + /* + * Send screen updates to the vnc client using the server + * surface and server dirty map. guest surface updates + * happening in parallel don't disturb us, the next pass will + * send them to the client. + */ + job = vnc_job_new(vs); - height = pixman_image_get_height(vd->server); - width = pixman_image_get_width(vd->server); + height = pixman_image_get_height(vd->server); + width = pixman_image_get_width(vd->server); - y = 0; - for (;;) { - int x, h; - unsigned long x2; - unsigned long offset = find_next_bit((unsigned long *) &vs->dirty, - height * VNC_DIRTY_BPL(vs), - y * VNC_DIRTY_BPL(vs)); - if (offset == height * VNC_DIRTY_BPL(vs)) { - /* no more dirty bits */ + y = 0; + for (;;) { + int x, h; + unsigned long x2; + unsigned long offset = find_next_bit((unsigned long *) &vs->dirty, + height * VNC_DIRTY_BPL(vs), + y * VNC_DIRTY_BPL(vs)); + if (offset == height * VNC_DIRTY_BPL(vs)) { + /* no more dirty bits */ + break; + } + y = offset / VNC_DIRTY_BPL(vs); + x = offset % VNC_DIRTY_BPL(vs); + x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y], + VNC_DIRTY_BPL(vs), x); + bitmap_clear(vs->dirty[y], x, x2 - x); + h = find_and_clear_dirty_height(vs, y, x, x2, height); + x2 = MIN(x2, width / VNC_DIRTY_PIXELS_PER_BIT); + if (x2 > x) { + n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y, + (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h); + } + if (!x && x2 == width / VNC_DIRTY_PIXELS_PER_BIT) { + y += h; + if (y == height) { break; } - y = offset / VNC_DIRTY_BPL(vs); - x = offset % VNC_DIRTY_BPL(vs); - x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y], - VNC_DIRTY_BPL(vs), x); - bitmap_clear(vs->dirty[y], x, x2 - x); - h = find_and_clear_dirty_height(vs, y, x, x2, height); - x2 = MIN(x2, width / VNC_DIRTY_PIXELS_PER_BIT); - if (x2 > x) { - n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y, - (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h); - } - if (!x && x2 == width / VNC_DIRTY_PIXELS_PER_BIT) { - y += h; - if (y == height) { - break; - } - } } - - vnc_job_push(job); - vs->force_update = 0; - vs->has_dirty = 0; - return n; } - return 0; + vnc_job_push(job); + vs->force_update = 0; + vs->has_dirty = 0; + return n; } /* audio */