From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZCfz-0001MU-FI for qemu-devel@nongnu.org; Thu, 02 Feb 2017 03:23:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZCfv-0006dZ-Fy for qemu-devel@nongnu.org; Thu, 02 Feb 2017 03:23:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42890) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZCfv-0006cg-9r for qemu-devel@nongnu.org; Thu, 02 Feb 2017 03:23:27 -0500 From: Gerd Hoffmann Date: Thu, 2 Feb 2017 09:23:06 +0100 Message-Id: <1486023789-28995-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1486023789-28995-1-git-send-email-kraxel@redhat.com> References: <1486023789-28995-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL 1/4] cirrus: handle negative pitch in cirrus_invalidate_region() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Wolfgang Bumiller , Gerd Hoffmann From: Wolfgang Bumiller cirrus_invalidate_region() calls memory_region_set_dirty() on a per-line basis, always ranging from off_begin to off_begin+bytesperline. With a negative pitch off_begin marks the top most used address and thus we need to do an initial shift backwards by a line for negative pitches of backward blits, otherwise the first iteration covers the line going from the start offset forwards instead of backwards. Additionally since the start address is inclusive, if we shift by a full `bytesperline` we move to the first address *not* included in the blit, so we only shift by one less than bytesperline. Signed-off-by: Wolfgang Bumiller Message-id: 1485352137-29367-1-git-send-email-w.bumiller@proxmox.com [ kraxel: codestyle fixes ] Signed-off-by: Gerd Hoffmann --- hw/display/cirrus_vga.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index 379910d..0f05e45 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -661,9 +661,14 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin, int off_cur; int off_cur_end; + if (off_pitch < 0) { + off_begin -= bytesperline - 1; + } + for (y = 0; y < lines; y++) { off_cur = off_begin; off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask; + assert(off_cur_end >= off_cur); memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur); off_begin += off_pitch; } -- 1.8.3.1