aboutsummaryrefslogtreecommitdiff
path: root/hw/cirrus_vga.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-16 14:59:35 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-16 14:59:35 +0000
commitd85d0d3883f5a567fa2969a0396e42e0a662b3fa (patch)
tree642fbb335405225c7c7c3fb2888eab04f72f17af /hw/cirrus_vga.c
parent753b4053311ff1437d99726970b1e7e6bf38249b (diff)
downloadqemu-d85d0d3883f5a567fa2969a0396e42e0a662b3fa.zip
qemu-d85d0d3883f5a567fa2969a0396e42e0a662b3fa.tar.gz
qemu-d85d0d3883f5a567fa2969a0396e42e0a662b3fa.tar.bz2
Fix hardware accelerated video to video copy on Cirrus VGA (Brian Kress)
cirrus_do_copy() in hw/cirrus_vga.c seems to make some incorrect assumptions about video memory layout. It tries to convert addresses to coordinates assuming that one row of data is (width * depth) bytes long. The correct way seems to be to use the pitch fields in the CirrusVGAState structure instead. Without this patch, I get lots of screen corruption when I try to drag a window under X as it's passing the wrong coordinates to the display surface for the copy. With this patch I can drag a window with no screen corruption. Signed-off-by: Brian Kress <kressb@moose.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6622 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/cirrus_vga.c')
-rw-r--r--hw/cirrus_vga.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index d261e40..0d1ea3a 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -730,10 +730,10 @@ static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
s->get_resolution((VGAState *)s, &width, &height);
/* extra x, y */
- sx = (src % (width * depth)) / depth;
- sy = (src / (width * depth));
- dx = (dst % (width *depth)) / depth;
- dy = (dst / (width * depth));
+ sx = (src % ABS(s->cirrus_blt_srcpitch)) / depth;
+ sy = (src / ABS(s->cirrus_blt_srcpitch));
+ dx = (dst % ABS(s->cirrus_blt_dstpitch)) / depth;
+ dy = (dst / ABS(s->cirrus_blt_dstpitch));
/* normalize width */
w /= depth;