yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 45023277a5822c89806eae1cc5f4d5f897e28fcd Mon Sep 17 00:00:00 2001
9ae3a8
From: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Date: Tue, 7 Feb 2017 10:07:49 +0100
9ae3a8
Subject: [PATCH 06/11] cirrus: handle negative pitch in
9ae3a8
 cirrus_invalidate_region()
9ae3a8
9ae3a8
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Message-id: <1486462072-32174-5-git-send-email-kraxel@redhat.com>
9ae3a8
Patchwork-id: 73566
9ae3a8
O-Subject: [RHEL-7.4 qemu-kvm PATCH 4/7] cirrus: handle negative pitch in cirrus_invalidate_region()
9ae3a8
Bugzilla: 1418233
9ae3a8
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
9ae3a8
9ae3a8
cirrus_invalidate_region() calls memory_region_set_dirty()
9ae3a8
on a per-line basis, always ranging from off_begin to
9ae3a8
off_begin+bytesperline. With a negative pitch off_begin
9ae3a8
marks the top most used address and thus we need to do an
9ae3a8
initial shift backwards by a line for negative pitches of
9ae3a8
backward blits, otherwise the first iteration covers the
9ae3a8
line going from the start offset forwards instead of
9ae3a8
backwards.
9ae3a8
Additionally since the start address is inclusive, if we
9ae3a8
shift by a full `bytesperline` we move to the first address
9ae3a8
*not* included in the blit, so we only shift by one less
9ae3a8
than bytesperline.
9ae3a8
9ae3a8
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9ae3a8
Message-id: 1485352137-29367-1-git-send-email-w.bumiller@proxmox.com
9ae3a8
9ae3a8
[ kraxel: codestyle fixes ]
9ae3a8
9ae3a8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
(cherry picked from commit f153b563f8cf121aebf5a2fff5f0110faf58ccb3)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/display/cirrus_vga.c | 5 +++++
9ae3a8
 1 file changed, 5 insertions(+)
9ae3a8
9ae3a8
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
9ae3a8
index c8f2f26..e09076a 100644
9ae3a8
--- a/hw/display/cirrus_vga.c
9ae3a8
+++ b/hw/display/cirrus_vga.c
9ae3a8
@@ -656,9 +656,14 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
9ae3a8
     int off_cur;
9ae3a8
     int off_cur_end;
9ae3a8
 
9ae3a8
+    if (off_pitch < 0) {
9ae3a8
+        off_begin -= bytesperline - 1;
9ae3a8
+    }
9ae3a8
+
9ae3a8
     for (y = 0; y < lines; y++) {
9ae3a8
 	off_cur = off_begin;
9ae3a8
 	off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
9ae3a8
+        assert(off_cur_end >= off_cur);
9ae3a8
         memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
9ae3a8
 	off_begin += off_pitch;
9ae3a8
     }
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8