yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
4f5da8
From fdb1ec384fe65b7ca2ab7303b56c2731e5999058 Mon Sep 17 00:00:00 2001
4f5da8
From: Gerd Hoffmann <kraxel@redhat.com>
4f5da8
Date: Tue, 7 Feb 2017 10:07:51 +0100
4f5da8
Subject: [PATCH 7/8] cirrus: fix blit address mask handling
4f5da8
4f5da8
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
4f5da8
Message-id: <1486462072-32174-7-git-send-email-kraxel@redhat.com>
4f5da8
Patchwork-id: 73570
4f5da8
O-Subject: [RHEL-7.4 qemu-kvm PATCH 6/7] cirrus: fix blit address mask handling
4f5da8
Bugzilla: 1418232
4f5da8
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
4f5da8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
4f5da8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
4f5da8
4f5da8
Apply the cirrus_addr_mask to cirrus_blt_dstaddr and cirrus_blt_srcaddr
4f5da8
right after assigning them, in cirrus_bitblt_start(), instead of having
4f5da8
this all over the place in the cirrus code, and missing a few places.
4f5da8
4f5da8
Reported-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4f5da8
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
4f5da8
Message-id: 1485338996-17095-1-git-send-email-kraxel@redhat.com
4f5da8
(cherry picked from commit 60cd23e85151525ab26591394c4e7e06fa07d216)
4f5da8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
4f5da8
---
4f5da8
 hw/display/cirrus_vga.c | 25 ++++++++++++-------------
4f5da8
 1 file changed, 12 insertions(+), 13 deletions(-)
4f5da8
4f5da8
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
4f5da8
index b040ab1..6aa29a3 100644
4f5da8
--- a/hw/display/cirrus_vga.c
4f5da8
+++ b/hw/display/cirrus_vga.c
4f5da8
@@ -304,7 +304,7 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
4f5da8
     }
4f5da8
 
4f5da8
     if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
4f5da8
-                              s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
4f5da8
+                              s->cirrus_blt_dstaddr)) {
4f5da8
         return true;
4f5da8
     }
4f5da8
     if (dst_only) {
4f5da8
@@ -317,7 +317,7 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only,
4f5da8
     }
4f5da8
 
4f5da8
     if (blit_region_is_unsafe(s, check_pitch,
4f5da8
-                              s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
4f5da8
+                              s->cirrus_blt_srcaddr)) {
4f5da8
         return true;
4f5da8
     }
4f5da8
 
4f5da8
@@ -684,7 +684,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState * s,
4f5da8
 {
4f5da8
     uint8_t *dst;
4f5da8
 
4f5da8
-    dst = s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask);
4f5da8
+    dst = s->vga.vram_ptr + s->cirrus_blt_dstaddr;
4f5da8
 
4f5da8
     if (blit_is_unsafe(s, false, true)) {
4f5da8
         return 0;
4f5da8
@@ -709,7 +709,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
4f5da8
         return 0;
4f5da8
     }
4f5da8
     rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
4f5da8
-    rop_func(s, s->vga.vram_ptr + (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
4f5da8
+    rop_func(s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
4f5da8
              s->cirrus_blt_dstpitch,
4f5da8
              s->cirrus_blt_width, s->cirrus_blt_height);
4f5da8
     cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
4f5da8
@@ -727,9 +727,8 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
4f5da8
 
4f5da8
 static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
4f5da8
 {
4f5da8
-    return cirrus_bitblt_common_patterncopy(s,
4f5da8
-					    s->vga.vram_ptr + ((s->cirrus_blt_srcaddr & ~7) &
4f5da8
-                                            s->cirrus_addr_mask));
4f5da8
+    return cirrus_bitblt_common_patterncopy(s, s->vga.vram_ptr +
4f5da8
+                                            (s->cirrus_blt_srcaddr & ~7));
4f5da8
 }
4f5da8
 
4f5da8
 static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
4f5da8
@@ -783,10 +782,8 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
4f5da8
     if (notify)
4f5da8
         graphic_hw_update(s->vga.con);
4f5da8
 
4f5da8
-    (*s->cirrus_rop) (s, s->vga.vram_ptr +
4f5da8
-		      (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
4f5da8
-		      s->vga.vram_ptr +
4f5da8
-		      (s->cirrus_blt_srcaddr & s->cirrus_addr_mask),
4f5da8
+    (*s->cirrus_rop) (s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
4f5da8
+                      s->vga.vram_ptr + s->cirrus_blt_srcaddr,
4f5da8
 		      s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
4f5da8
 		      s->cirrus_blt_width, s->cirrus_blt_height);
4f5da8
 
4f5da8
@@ -837,8 +834,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
4f5da8
         } else {
4f5da8
             /* at least one scan line */
4f5da8
             do {
4f5da8
-                (*s->cirrus_rop)(s, s->vga.vram_ptr +
4f5da8
-                                 (s->cirrus_blt_dstaddr & s->cirrus_addr_mask),
4f5da8
+                (*s->cirrus_rop)(s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
4f5da8
                                   s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1);
4f5da8
                 cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
4f5da8
                                          s->cirrus_blt_width, 1);
4f5da8
@@ -957,6 +953,9 @@ static void cirrus_bitblt_start(CirrusVGAState * s)
4f5da8
     s->cirrus_blt_modeext = s->vga.gr[0x33];
4f5da8
     blt_rop = s->vga.gr[0x32];
4f5da8
 
4f5da8
+    s->cirrus_blt_dstaddr &= s->cirrus_addr_mask;
4f5da8
+    s->cirrus_blt_srcaddr &= s->cirrus_addr_mask;
4f5da8
+
4f5da8
 #ifdef DEBUG_BITBLT
4f5da8
     printf("rop=0x%02x mode=0x%02x modeext=0x%02x w=%d h=%d dpitch=%d spitch=%d daddr=0x%08x saddr=0x%08x writemask=0x%02x\n",
4f5da8
            blt_rop,
4f5da8
-- 
4f5da8
1.8.3.1
4f5da8