619821
From f0327afe876acff27221cdeead1aca0444364133 Mon Sep 17 00:00:00 2001
976a86
From: Gerd Hoffmann <kraxel@redhat.com>
619821
Date: Mon, 27 Mar 2017 10:01:20 +0200
976a86
Subject: [PATCH 5/7] cirrus: stop passing around dst pointers in the blitter
976a86
976a86
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
619821
Message-id: <1490608882-10242-6-git-send-email-kraxel@redhat.com>
619821
Patchwork-id: 74550
619821
O-Subject: [RHEL-7.4 qemu-kvm PATCH v2 5/7] cirrus: stop passing around dst pointers in the blitter
619821
Bugzilla: 1430060
976a86
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
976a86
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
619821
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
976a86
976a86
Instead pass around the address (aka offset into vga memory).  Calculate
976a86
the pointer in the rop_* functions, after applying the mask to the
976a86
address, to make sure the address stays within the valid range.
976a86
976a86
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
976a86
Message-id: 1489574872-8679-1-git-send-email-kraxel@redhat.com
976a86
(cherry picked from commit 026aeffcb4752054830ba203020ed6eb05bcaba8)
976a86
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
976a86
---
976a86
 hw/display/cirrus_vga.c      |  20 +++---
976a86
 hw/display/cirrus_vga_rop.h  | 161 +++++++++++++++++++++++++------------------
976a86
 hw/display/cirrus_vga_rop2.h |  97 +++++++++++++-------------
976a86
 3 files changed, 153 insertions(+), 125 deletions(-)
976a86
976a86
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
976a86
index aab6e02..003cc4c 100644
976a86
--- a/hw/display/cirrus_vga.c
976a86
+++ b/hw/display/cirrus_vga.c
976a86
@@ -174,11 +174,12 @@
976a86
 
976a86
 struct CirrusVGAState;
976a86
 typedef void (*cirrus_bitblt_rop_t) (struct CirrusVGAState *s,
976a86
-                                     uint8_t * dst, const uint8_t * src,
976a86
+                                     uint32_t dstaddr, const uint8_t *src,
976a86
 				     int dstpitch, int srcpitch,
976a86
 				     int bltwidth, int bltheight);
976a86
 typedef void (*cirrus_fill_t)(struct CirrusVGAState *s,
976a86
-                              uint8_t *dst, int dst_pitch, int width, int height);
976a86
+                              uint32_t dstaddr, int dst_pitch,
976a86
+                              int width, int height);
976a86
 
976a86
 typedef struct CirrusVGAState {
976a86
     VGACommonState vga;
976a86
@@ -315,14 +316,14 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
976a86
 }
976a86
 
976a86
 static void cirrus_bitblt_rop_nop(CirrusVGAState *s,
976a86
-                                  uint8_t *dst,const uint8_t *src,
976a86
+                                  uint32_t dstaddr, const uint8_t *src,
976a86
                                   int dstpitch,int srcpitch,
976a86
                                   int bltwidth,int bltheight)
976a86
 {
976a86
 }
976a86
 
976a86
 static void cirrus_bitblt_fill_nop(CirrusVGAState *s,
976a86
-                                   uint8_t *dst,
976a86
+                                   uint32_t dstaddr,
976a86
                                    int dstpitch, int bltwidth,int bltheight)
976a86
 {
976a86
 }
976a86
@@ -672,11 +673,8 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
976a86
 static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc)
976a86
 {
976a86
     uint32_t patternsize;
976a86
-    uint8_t *dst;
976a86
     uint8_t *src;
976a86
 
976a86
-    dst = s->vga.vram_ptr + s->cirrus_blt_dstaddr;
976a86
-
976a86
     if (videosrc) {
976a86
         switch (s->vga.get_bpp(&s->vga)) {
976a86
         case 8:
976a86
@@ -705,7 +703,7 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc)
976a86
         return 0;
976a86
     }
976a86
 
976a86
-    (*s->cirrus_rop) (s, dst, src,
976a86
+    (*s->cirrus_rop) (s, s->cirrus_blt_dstaddr, src,
976a86
                       s->cirrus_blt_dstpitch, 0,
976a86
                       s->cirrus_blt_width, s->cirrus_blt_height);
976a86
     cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
976a86
@@ -724,7 +722,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
976a86
         return 0;
976a86
     }
976a86
     rop_func = cirrus_fill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1];
976a86
-    rop_func(s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
976a86
+    rop_func(s, s->cirrus_blt_dstaddr,
976a86
              s->cirrus_blt_dstpitch,
976a86
              s->cirrus_blt_width, s->cirrus_blt_height);
976a86
     cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
976a86
@@ -791,7 +789,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
976a86
         }
976a86
     }
976a86
 
976a86
-    (*s->cirrus_rop) (s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
976a86
+    (*s->cirrus_rop) (s, s->cirrus_blt_dstaddr,
976a86
                       s->vga.vram_ptr + s->cirrus_blt_srcaddr,
976a86
 		      s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
976a86
 		      s->cirrus_blt_width, s->cirrus_blt_height);
976a86
@@ -842,7 +840,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
976a86
         } else {
976a86
             /* at least one scan line */
976a86
             do {
976a86
-                (*s->cirrus_rop)(s, s->vga.vram_ptr + s->cirrus_blt_dstaddr,
976a86
+                (*s->cirrus_rop)(s, s->cirrus_blt_dstaddr,
976a86
                                   s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1);
976a86
                 cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
976a86
                                          s->cirrus_blt_width, 1);
976a86
diff --git a/hw/display/cirrus_vga_rop.h b/hw/display/cirrus_vga_rop.h
976a86
index a4f96c6..3b16d70 100644
976a86
--- a/hw/display/cirrus_vga_rop.h
976a86
+++ b/hw/display/cirrus_vga_rop.h
976a86
@@ -22,31 +22,65 @@
976a86
  * THE SOFTWARE.
976a86
  */
976a86
 
976a86
-static inline void glue(rop_8_,ROP_NAME)(uint8_t *dst, uint8_t src)
976a86
+static inline void glue(rop_8_, ROP_NAME)(CirrusVGAState *s,
976a86
+                                          uint32_t dstaddr, uint8_t src)
976a86
 {
976a86
+    uint8_t *dst = &s->vga.vram_ptr[dstaddr & s->cirrus_addr_mask];
976a86
     *dst = ROP_FN(*dst, src);
976a86
 }
976a86
 
976a86
-static inline void glue(rop_16_,ROP_NAME)(uint16_t *dst, uint16_t src)
976a86
+static inline void glue(rop_tr_8_, ROP_NAME)(CirrusVGAState *s,
976a86
+                                             uint32_t dstaddr, uint8_t src,
976a86
+                                             uint8_t transp)
976a86
 {
976a86
+    uint8_t *dst = &s->vga.vram_ptr[dstaddr & s->cirrus_addr_mask];
976a86
+    uint8_t pixel = ROP_FN(*dst, src);
976a86
+    if (pixel != transp) {
976a86
+        *dst = pixel;
976a86
+    }
976a86
+}
976a86
+
976a86
+static inline void glue(rop_16_, ROP_NAME)(CirrusVGAState *s,
976a86
+                                           uint32_t dstaddr, uint16_t src)
976a86
+{
976a86
+    uint16_t *dst = (uint16_t *)
976a86
+        (&s->vga.vram_ptr[dstaddr & s->cirrus_addr_mask & ~1]);
976a86
     *dst = ROP_FN(*dst, src);
976a86
 }
976a86
 
976a86
-static inline void glue(rop_32_,ROP_NAME)(uint32_t *dst, uint32_t src)
976a86
+static inline void glue(rop_tr_16_, ROP_NAME)(CirrusVGAState *s,
976a86
+                                              uint32_t dstaddr, uint16_t src,
976a86
+                                              uint16_t transp)
976a86
+{
976a86
+    uint16_t *dst = (uint16_t *)
976a86
+        (&s->vga.vram_ptr[dstaddr & s->cirrus_addr_mask & ~1]);
976a86
+    uint16_t pixel = ROP_FN(*dst, src);
976a86
+    if (pixel != transp) {
976a86
+        *dst = pixel;
976a86
+    }
976a86
+}
976a86
+
976a86
+static inline void glue(rop_32_, ROP_NAME)(CirrusVGAState *s,
976a86
+                                           uint32_t dstaddr, uint32_t src)
976a86
 {
976a86
+    uint32_t *dst = (uint32_t *)
976a86
+        (&s->vga.vram_ptr[dstaddr & s->cirrus_addr_mask & ~3]);
976a86
     *dst = ROP_FN(*dst, src);
976a86
 }
976a86
 
976a86
-#define ROP_OP(d, s) glue(rop_8_,ROP_NAME)(d, s)
976a86
-#define ROP_OP_16(d, s) glue(rop_16_,ROP_NAME)(d, s)
976a86
-#define ROP_OP_32(d, s) glue(rop_32_,ROP_NAME)(d, s)
976a86
+#define ROP_OP(st, d, s)           glue(rop_8_, ROP_NAME)(st, d, s)
976a86
+#define ROP_OP_TR(st, d, s, t)     glue(rop_tr_8_, ROP_NAME)(st, d, s, t)
976a86
+#define ROP_OP_16(st, d, s)        glue(rop_16_, ROP_NAME)(st, d, s)
976a86
+#define ROP_OP_TR_16(st, d, s, t)  glue(rop_tr_16_, ROP_NAME)(st, d, s, t)
976a86
+#define ROP_OP_32(st, d, s)        glue(rop_32_, ROP_NAME)(st, d, s)
976a86
 #undef ROP_FN
976a86
 
976a86
 static void
976a86
 glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
976a86
-                             uint8_t *dst,const uint8_t *src,
976a86
-                             int dstpitch,int srcpitch,
976a86
-                             int bltwidth,int bltheight)
976a86
+                                       uint32_t dstaddr,
976a86
+                                       const uint8_t *src,
976a86
+                                       int dstpitch, int srcpitch,
976a86
+                                       int bltwidth, int bltheight)
976a86
 {
976a86
     int x,y;
976a86
     dstpitch -= bltwidth;
976a86
@@ -59,43 +93,47 @@ glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
976a86
 
976a86
     for (y = 0; y < bltheight; y++) {
976a86
         for (x = 0; x < bltwidth; x++) {
976a86
-            ROP_OP(dst, *src);
976a86
-            dst++;
976a86
+            ROP_OP(s, dstaddr, *src);
976a86
+            dstaddr++;
976a86
             src++;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
         src += srcpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(cirrus_bitblt_rop_bkwd_, ROP_NAME)(CirrusVGAState *s,
976a86
-                                        uint8_t *dst,const uint8_t *src,
976a86
-                                        int dstpitch,int srcpitch,
976a86
-                                        int bltwidth,int bltheight)
976a86
+                                        uint32_t dstaddr,
976a86
+                                        const uint8_t *src,
976a86
+                                        int dstpitch, int srcpitch,
976a86
+                                        int bltwidth, int bltheight)
976a86
 {
976a86
     int x,y;
976a86
     dstpitch += bltwidth;
976a86
     srcpitch += bltwidth;
976a86
     for (y = 0; y < bltheight; y++) {
976a86
         for (x = 0; x < bltwidth; x++) {
976a86
-            ROP_OP(dst, *src);
976a86
-            dst--;
976a86
+            ROP_OP(s, dstaddr, *src);
976a86
+            dstaddr--;
976a86
             src--;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
         src += srcpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
976a86
-						       uint8_t *dst,const uint8_t *src,
976a86
-						       int dstpitch,int srcpitch,
976a86
-						       int bltwidth,int bltheight)
976a86
+                                                       uint32_t dstaddr,
976a86
+                                                       const uint8_t *src,
976a86
+                                                       int dstpitch,
976a86
+                                                       int srcpitch,
976a86
+                                                       int bltwidth,
976a86
+                                                       int bltheight)
976a86
 {
976a86
     int x,y;
976a86
-    uint8_t p;
976a86
+    uint8_t transp = s->vga.gr[0x34];
976a86
     dstpitch -= bltwidth;
976a86
     srcpitch -= bltwidth;
976a86
 
976a86
@@ -105,48 +143,50 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
976a86
 
976a86
     for (y = 0; y < bltheight; y++) {
976a86
         for (x = 0; x < bltwidth; x++) {
976a86
-	    p = *dst;
976a86
-            ROP_OP(&p, *src);
976a86
-	    if (p != s->vga.gr[0x34]) *dst = p;
976a86
-            dst++;
976a86
+            ROP_OP_TR(s, dstaddr, *src, transp);
976a86
+            dstaddr++;
976a86
             src++;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
         src += srcpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
976a86
-							uint8_t *dst,const uint8_t *src,
976a86
-							int dstpitch,int srcpitch,
976a86
-							int bltwidth,int bltheight)
976a86
+                                                        uint32_t dstaddr,
976a86
+                                                        const uint8_t *src,
976a86
+                                                        int dstpitch,
976a86
+                                                        int srcpitch,
976a86
+                                                        int bltwidth,
976a86
+                                                        int bltheight)
976a86
 {
976a86
     int x,y;
976a86
-    uint8_t p;
976a86
+    uint8_t transp = s->vga.gr[0x34];
976a86
     dstpitch += bltwidth;
976a86
     srcpitch += bltwidth;
976a86
     for (y = 0; y < bltheight; y++) {
976a86
         for (x = 0; x < bltwidth; x++) {
976a86
-	    p = *dst;
976a86
-            ROP_OP(&p, *src);
976a86
-	    if (p != s->vga.gr[0x34]) *dst = p;
976a86
-            dst--;
976a86
+            ROP_OP_TR(s, dstaddr, *src, transp);
976a86
+            dstaddr--;
976a86
             src--;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
         src += srcpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
976a86
-							uint8_t *dst,const uint8_t *src,
976a86
-							int dstpitch,int srcpitch,
976a86
-							int bltwidth,int bltheight)
976a86
+                                                        uint32_t dstaddr,
976a86
+                                                        const uint8_t *src,
976a86
+                                                        int dstpitch,
976a86
+                                                        int srcpitch,
976a86
+                                                        int bltwidth,
976a86
+                                                        int bltheight)
976a86
 {
976a86
     int x,y;
976a86
-    uint8_t p1, p2;
976a86
+    uint16_t transp = s->vga.gr[0x34] | (uint16_t)s->vga.gr[0x35] << 8;
976a86
     dstpitch -= bltwidth;
976a86
     srcpitch -= bltwidth;
976a86
 
976a86
@@ -156,46 +196,35 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
976a86
 
976a86
     for (y = 0; y < bltheight; y++) {
976a86
         for (x = 0; x < bltwidth; x+=2) {
976a86
-	    p1 = *dst;
976a86
-	    p2 = *(dst+1);
976a86
-            ROP_OP(&p1, *src);
976a86
-            ROP_OP(&p2, *(src + 1));
976a86
-	    if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) {
976a86
-		*dst = p1;
976a86
-		*(dst+1) = p2;
976a86
-	    }
976a86
-            dst+=2;
976a86
-            src+=2;
976a86
+            ROP_OP_TR_16(s, dstaddr, *(uint16_t *)src, transp);
976a86
+            dstaddr += 2;
976a86
+            src += 2;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
         src += srcpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
976a86
-							 uint8_t *dst,const uint8_t *src,
976a86
-							 int dstpitch,int srcpitch,
976a86
-							 int bltwidth,int bltheight)
976a86
+                                                         uint32_t dstaddr,
976a86
+                                                         const uint8_t *src,
976a86
+                                                         int dstpitch,
976a86
+                                                         int srcpitch,
976a86
+                                                         int bltwidth,
976a86
+                                                         int bltheight)
976a86
 {
976a86
     int x,y;
976a86
-    uint8_t p1, p2;
976a86
+    uint16_t transp = s->vga.gr[0x34] | (uint16_t)s->vga.gr[0x35] << 8;
976a86
     dstpitch += bltwidth;
976a86
     srcpitch += bltwidth;
976a86
     for (y = 0; y < bltheight; y++) {
976a86
         for (x = 0; x < bltwidth; x+=2) {
976a86
-	    p1 = *(dst-1);
976a86
-	    p2 = *dst;
976a86
-            ROP_OP(&p1, *(src - 1));
976a86
-            ROP_OP(&p2, *src);
976a86
-	    if ((p1 != s->vga.gr[0x34]) || (p2 != s->vga.gr[0x35])) {
976a86
-		*(dst-1) = p1;
976a86
-		*dst = p2;
976a86
-	    }
976a86
-            dst-=2;
976a86
-            src-=2;
976a86
+            ROP_OP_TR_16(s, dstaddr, *(uint16_t *)src, transp);
976a86
+            dstaddr -= 2;
976a86
+            src -= 2;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
         src += srcpitch;
976a86
     }
976a86
 }
976a86
diff --git a/hw/display/cirrus_vga_rop2.h b/hw/display/cirrus_vga_rop2.h
976a86
index d28bcc6..bc92f0e 100644
976a86
--- a/hw/display/cirrus_vga_rop2.h
976a86
+++ b/hw/display/cirrus_vga_rop2.h
976a86
@@ -23,27 +23,29 @@
976a86
  */
976a86
 
976a86
 #if DEPTH == 8
976a86
-#define PUTPIXEL()    ROP_OP(&d[0], col)
976a86
+#define PUTPIXEL(s, a, c)    ROP_OP(s, a, c)
976a86
 #elif DEPTH == 16
976a86
-#define PUTPIXEL()    ROP_OP_16((uint16_t *)&d[0], col)
976a86
+#define PUTPIXEL(s, a, c)    ROP_OP_16(s, a, c)
976a86
 #elif DEPTH == 24
976a86
-#define PUTPIXEL()    ROP_OP(&d[0], col);        \
976a86
-                      ROP_OP(&d[1], (col >> 8)); \
976a86
-                      ROP_OP(&d[2], (col >> 16))
976a86
+#define PUTPIXEL(s, a, c)    do {          \
976a86
+        ROP_OP(s, a,     c);               \
976a86
+        ROP_OP(s, a + 1, (col >> 8));      \
976a86
+        ROP_OP(s, a + 2, (col >> 16));     \
976a86
+    } while (0)
976a86
 #elif DEPTH == 32
976a86
-#define PUTPIXEL()    ROP_OP_32(((uint32_t *)&d[0]), col)
976a86
+#define PUTPIXEL(s, a, c)    ROP_OP_32(s, a, c)
976a86
 #else
976a86
 #error unsupported DEPTH
976a86
 #endif
976a86
 
976a86
 static void
976a86
 glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
976a86
-     (CirrusVGAState * s, uint8_t * dst,
976a86
-      const uint8_t * src,
976a86
+     (CirrusVGAState *s, uint32_t dstaddr,
976a86
+      const uint8_t *src,
976a86
       int dstpitch, int srcpitch,
976a86
       int bltwidth, int bltheight)
976a86
 {
976a86
-    uint8_t *d;
976a86
+    uint32_t addr;
976a86
     int x, y, pattern_y, pattern_pitch, pattern_x;
976a86
     unsigned int col;
976a86
     const uint8_t *src1;
976a86
@@ -63,7 +65,7 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
976a86
     pattern_y = s->cirrus_blt_srcaddr & 7;
976a86
     for(y = 0; y < bltheight; y++) {
976a86
         pattern_x = skipleft;
976a86
-        d = dst + skipleft;
976a86
+        addr = dstaddr + skipleft;
976a86
         src1 = src + pattern_y * pattern_pitch;
976a86
         for (x = skipleft; x < bltwidth; x += (DEPTH / 8)) {
976a86
 #if DEPTH == 8
976a86
@@ -82,23 +84,23 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
976a86
             col = ((uint32_t *)(src1 + pattern_x))[0];
976a86
             pattern_x = (pattern_x + 4) & 31;
976a86
 #endif
976a86
-            PUTPIXEL();
976a86
-            d += (DEPTH / 8);
976a86
+            PUTPIXEL(s, addr, col);
976a86
+            addr += (DEPTH / 8);
976a86
         }
976a86
         pattern_y = (pattern_y + 1) & 7;
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 /* NOTE: srcpitch is ignored */
976a86
 static void
976a86
 glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
976a86
-     (CirrusVGAState * s, uint8_t * dst,
976a86
-      const uint8_t * src,
976a86
+     (CirrusVGAState *s, uint32_t dstaddr,
976a86
+      const uint8_t *src,
976a86
       int dstpitch, int srcpitch,
976a86
       int bltwidth, int bltheight)
976a86
 {
976a86
-    uint8_t *d;
976a86
+    uint32_t addr;
976a86
     int x, y;
976a86
     unsigned bits, bits_xor;
976a86
     unsigned int col;
976a86
@@ -123,7 +125,7 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
976a86
     for(y = 0; y < bltheight; y++) {
976a86
         bitmask = 0x80 >> srcskipleft;
976a86
         bits = *src++ ^ bits_xor;
976a86
-        d = dst + dstskipleft;
976a86
+        addr = dstaddr + dstskipleft;
976a86
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
976a86
             if ((bitmask & 0xff) == 0) {
976a86
                 bitmask = 0x80;
976a86
@@ -131,24 +133,24 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
976a86
             }
976a86
             index = (bits & bitmask);
976a86
             if (index) {
976a86
-                PUTPIXEL();
976a86
+                PUTPIXEL(s, addr, col);
976a86
             }
976a86
-            d += (DEPTH / 8);
976a86
+            addr += (DEPTH / 8);
976a86
             bitmask >>= 1;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
976a86
-     (CirrusVGAState * s, uint8_t * dst,
976a86
-      const uint8_t * src,
976a86
+     (CirrusVGAState *s, uint32_t dstaddr,
976a86
+      const uint8_t *src,
976a86
       int dstpitch, int srcpitch,
976a86
       int bltwidth, int bltheight)
976a86
 {
976a86
     uint32_t colors[2];
976a86
-    uint8_t *d;
976a86
+    uint32_t addr;
976a86
     int x, y;
976a86
     unsigned bits;
976a86
     unsigned int col;
976a86
@@ -161,29 +163,29 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
976a86
     for(y = 0; y < bltheight; y++) {
976a86
         bitmask = 0x80 >> srcskipleft;
976a86
         bits = *src++;
976a86
-        d = dst + dstskipleft;
976a86
+        addr = dstaddr + dstskipleft;
976a86
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
976a86
             if ((bitmask & 0xff) == 0) {
976a86
                 bitmask = 0x80;
976a86
                 bits = *src++;
976a86
             }
976a86
             col = colors[!!(bits & bitmask)];
976a86
-            PUTPIXEL();
976a86
-            d += (DEPTH / 8);
976a86
+            PUTPIXEL(s, addr, col);
976a86
+            addr += (DEPTH / 8);
976a86
             bitmask >>= 1;
976a86
         }
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
976a86
-     (CirrusVGAState * s, uint8_t * dst,
976a86
-      const uint8_t * src,
976a86
+     (CirrusVGAState *s, uint32_t dstaddr,
976a86
+      const uint8_t *src,
976a86
       int dstpitch, int srcpitch,
976a86
       int bltwidth, int bltheight)
976a86
 {
976a86
-    uint8_t *d;
976a86
+    uint32_t addr;
976a86
     int x, y, bitpos, pattern_y;
976a86
     unsigned int bits, bits_xor;
976a86
     unsigned int col;
976a86
@@ -207,28 +209,28 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
976a86
     for(y = 0; y < bltheight; y++) {
976a86
         bits = src[pattern_y] ^ bits_xor;
976a86
         bitpos = 7 - srcskipleft;
976a86
-        d = dst + dstskipleft;
976a86
+        addr = dstaddr + dstskipleft;
976a86
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
976a86
             if ((bits >> bitpos) & 1) {
976a86
-                PUTPIXEL();
976a86
+                PUTPIXEL(s, addr, col);
976a86
             }
976a86
-            d += (DEPTH / 8);
976a86
+            addr += (DEPTH / 8);
976a86
             bitpos = (bitpos - 1) & 7;
976a86
         }
976a86
         pattern_y = (pattern_y + 1) & 7;
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
976a86
-     (CirrusVGAState * s, uint8_t * dst,
976a86
-      const uint8_t * src,
976a86
+     (CirrusVGAState *s, uint32_t dstaddr,
976a86
+      const uint8_t *src,
976a86
       int dstpitch, int srcpitch,
976a86
       int bltwidth, int bltheight)
976a86
 {
976a86
     uint32_t colors[2];
976a86
-    uint8_t *d;
976a86
+    uint32_t addr;
976a86
     int x, y, bitpos, pattern_y;
976a86
     unsigned int bits;
976a86
     unsigned int col;
976a86
@@ -242,38 +244,37 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
976a86
     for(y = 0; y < bltheight; y++) {
976a86
         bits = src[pattern_y];
976a86
         bitpos = 7 - srcskipleft;
976a86
-        d = dst + dstskipleft;
976a86
+        addr = dstaddr + dstskipleft;
976a86
         for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
976a86
             col = colors[(bits >> bitpos) & 1];
976a86
-            PUTPIXEL();
976a86
-            d += (DEPTH / 8);
976a86
+            PUTPIXEL(s, addr, col);
976a86
+            addr += (DEPTH / 8);
976a86
             bitpos = (bitpos - 1) & 7;
976a86
         }
976a86
         pattern_y = (pattern_y + 1) & 7;
976a86
-        dst += dstpitch;
976a86
+        dstaddr += dstpitch;
976a86
     }
976a86
 }
976a86
 
976a86
 static void
976a86
 glue(glue(glue(cirrus_fill_, ROP_NAME), _),DEPTH)
976a86
      (CirrusVGAState *s,
976a86
-      uint8_t *dst, int dst_pitch,
976a86
+      uint32_t dstaddr, int dst_pitch,
976a86
       int width, int height)
976a86
 {
976a86
-    uint8_t *d, *d1;
976a86
+    uint32_t addr;
976a86
     uint32_t col;
976a86
     int x, y;
976a86
 
976a86
     col = s->cirrus_blt_fgcol;
976a86
 
976a86
-    d1 = dst;
976a86
     for(y = 0; y < height; y++) {
976a86
-        d = d1;
976a86
+        addr = dstaddr;
976a86
         for(x = 0; x < width; x += (DEPTH / 8)) {
976a86
-            PUTPIXEL();
976a86
-            d += (DEPTH / 8);
976a86
+            PUTPIXEL(s, addr, col);
976a86
+            addr += (DEPTH / 8);
976a86
         }
976a86
-        d1 += dst_pitch;
976a86
+        dstaddr += dst_pitch;
976a86
     }
976a86
 }
976a86
 
976a86
-- 
976a86
1.8.3.1
976a86