From patchwork Fri Feb 4 08:06:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 81822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6FD0BB710F for ; Fri, 4 Feb 2011 19:31:21 +1100 (EST) Received: from localhost ([127.0.0.1]:56884 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PlH1a-00038t-Qm for incoming@patchwork.ozlabs.org; Fri, 04 Feb 2011 03:28:15 -0500 Received: from [140.186.70.92] (port=49526 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PlGfR-0003td-CI for qemu-devel@nongnu.org; Fri, 04 Feb 2011 03:05:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PlGfQ-0001np-9x for qemu-devel@nongnu.org; Fri, 04 Feb 2011 03:05:21 -0500 Received: from smtp5-g21.free.fr ([212.27.42.5]:52368) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PlGfP-0001nj-LR for qemu-devel@nongnu.org; Fri, 04 Feb 2011 03:05:20 -0500 Received: from localhost.localdomain (unknown [82.241.209.44]) by smtp5-g21.free.fr (Postfix) with ESMTP id 55289D48259; Fri, 4 Feb 2011 09:05:14 +0100 (CET) From: Corentin Chary To: Anthony Liguori Date: Fri, 4 Feb 2011 09:06:03 +0100 Message-Id: <1296806768-27787-12-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1296806768-27787-1-git-send-email-corentincj@iksaif.net> References: <1296806768-27787-1-git-send-email-corentincj@iksaif.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 212.27.42.5 Cc: Corentin Chary , Andre Przywara , Qemu-development List , Alexander Graf Subject: [Qemu-devel] [PATCH v3 11/16] vnc: fix lossy rect refreshing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The for loop in send_lossy_rect was totally wrong, and we can't call vnc_set_bits() because it does not really do what it should. Use vnc_set_bit() directly instead. Signed-off-by: Corentin Chary --- ui/vnc.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 9920c0e..8c7cb0d 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2297,8 +2297,8 @@ void vnc_sent_lossy_rect(VncState *vs, int x, int y, int w, int h) x /= VNC_STAT_RECT; y /= VNC_STAT_RECT; - for (j = y; j <= y + h; j++) { - for (i = x; i <= x + w; i++) { + for (j = y; j <= h; j++) { + for (i = x; i <= w; i++) { vs->lossy_rect[j][i] = 1; } } @@ -2315,7 +2315,7 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y) x = x / VNC_STAT_RECT * VNC_STAT_RECT; QTAILQ_FOREACH(vs, &vd->clients, next) { - int j; + int j, i; /* kernel send buffers are full -> refresh later */ if (vs->output.offset) { @@ -2325,12 +2325,16 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y) if (!vs->lossy_rect[sty][stx]) { continue; } + vs->lossy_rect[sty][stx] = 0; for (j = 0; j < VNC_STAT_RECT; ++j) { - vnc_set_bits(vs->dirty[y + j], x / 16, VNC_STAT_RECT / 16); + for (i = x / 16; i < VNC_STAT_RECT / 16 + x / 16; ++i) { + vnc_set_bit(vs->dirty[y + j], i); + } } has_dirty++; } + return has_dirty; }