From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Li Qiang <liqiang6-s@360.cn>,
Laszlo Ersek <lersek@redhat.com>
Subject: [Qemu-devel] [PATCH] cirrus: handle negative pitch in cirrus_invalidate_region()
Date: Wed, 25 Jan 2017 13:12:33 +0100 [thread overview]
Message-ID: <1485346353-23814-1-git-send-email-w.bumiller@proxmox.com> (raw)
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 bytesperline for negative
pitches of backward blits, otherwise the first iteration
covers the line going from the start offset forwards instead
of backwards.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
I bumped the patch context to 4 lines to get it to include the
memory_region_set_dirty() call which takes an unsigned length (`hwaddr
size`) because I'm also not too happy about the masking going on there
since it means off_cur_end may be less than off_cur, but if the range
checks are finnaly correct I don't think this case could happen
anymore? (A check shouldn't hurt though, or maybe an assert()?)
hw/display/cirrus_vga.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
index b1a0773..af61981 100644
--- a/hw/display/cirrus_vga.c
+++ b/hw/display/cirrus_vga.c
@@ -669,8 +669,12 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
int y;
int off_cur;
int off_cur_end;
+ if (off_pitch < 0) {
+ off_begin -= bytesperline;
+ }
+
for (y = 0; y < lines; y++) {
off_cur = off_begin;
off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask;
memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur);
--
2.1.4
next reply other threads:[~2017-01-25 12:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 12:12 Wolfgang Bumiller [this message]
2017-01-25 12:35 ` [Qemu-devel] [PATCH] cirrus: handle negative pitch in cirrus_invalidate_region() Laszlo Ersek
2017-01-25 13:22 ` Wolfgang Bumiller
2017-01-25 13:39 ` Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485346353-23814-1-git-send-email-w.bumiller@proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=kraxel@redhat.com \
--cc=lersek@redhat.com \
--cc=liqiang6-s@360.cn \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).