From patchwork Wed Aug 11 05:49:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 61455 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 4E96FB6F14 for ; Wed, 11 Aug 2010 16:28:14 +1000 (EST) Received: from localhost ([127.0.0.1]:35930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oj4Zc-0008Ch-MU for incoming@patchwork.ozlabs.org; Wed, 11 Aug 2010 02:14:00 -0400 Received: from [140.186.70.92] (port=37958 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oj4D9-000615-Ux for qemu-devel@nongnu.org; Wed, 11 Aug 2010 01:50:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oj4D8-0007UO-SH for qemu-devel@nongnu.org; Wed, 11 Aug 2010 01:50:47 -0400 Received: from relay1-v.mail.gandi.net ([217.70.178.75]:51385 helo=mrelay1-v.mgt.gandi.net) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oj4D8-0007UJ-KO for qemu-devel@nongnu.org; Wed, 11 Aug 2010 01:50:46 -0400 X-Originating-IP: 217.70.178.40 Received: from mfilter6-d.gandi.net (mfilter6-d.gandi.net [217.70.178.40]) by mrelay1-v.mgt.gandi.net (Postfix) with ESMTP id 32303362B8; Wed, 11 Aug 2010 07:50:46 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter6-v Received: from mrelay1-v.mgt.gandi.net ([217.70.178.75]) by mfilter6-d.gandi.net (mfilter6-d.gandi.net [217.70.178.40]) (amavisd-new, port 10024) with ESMTP id dioccJyXTFBu; Wed, 11 Aug 2010 07:50:44 +0200 (CEST) X-Originating-IP: 82.241.209.44 Received: from tartiflon (falgoret.iksaif.net [82.241.209.44]) (Authenticated sender: fake@iksaif.net) by mrelay1-v.mgt.gandi.net (Postfix) with ESMTPSA id 7B310362AA; Wed, 11 Aug 2010 07:50:37 +0200 (CEST) From: Corentin Chary To: Qemu-development List Date: Wed, 11 Aug 2010 07:49:40 +0200 Message-Id: <1281505785-22523-11-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1281505785-22523-1-git-send-email-corentincj@iksaif.net> References: <1281505785-22523-1-git-send-email-corentincj@iksaif.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: Corentin Chary , Anthony Liguori , Alexander Graf , Andre Przywara Subject: [Qemu-devel] [PATCH 10/15] 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 27263dc..5038863 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2292,8 +2292,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; } } @@ -2310,7 +2310,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) @@ -2318,12 +2318,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; }