|
|
9ae3a8 |
From cc965429746aac94b7c37991f676dcd323ef212d Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 27 Mar 2017 10:01:21 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 6/7] cirrus: stop passing around src pointers in the blitter
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1490608882-10242-7-git-send-email-kraxel@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 74549
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.4 qemu-kvm PATCH v2 6/7] cirrus: stop passing around src pointers in the blitter
|
|
|
9ae3a8 |
Bugzilla: 1430060
|
|
|
9ae3a8 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Does basically the same as "cirrus: stop passing around dst pointers in
|
|
|
9ae3a8 |
the blitter", just for the src pointer instead of the dst pointer.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
For the src we have to care about cputovideo blits though and fetch the
|
|
|
9ae3a8 |
data from s->cirrus_bltbuf instead of vga memory. The cirrus_src*()
|
|
|
9ae3a8 |
helper functions handle that.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
Message-id: 1489584487-3489-1-git-send-email-kraxel@redhat.com
|
|
|
9ae3a8 |
(cherry picked from commit ffaf857778286ca54e3804432a2369a279e73aa7)
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/display/cirrus_vga.c | 61 +++++++++++++++++++++++++++++++++++---------
|
|
|
9ae3a8 |
hw/display/cirrus_vga_rop.h | 48 +++++++++++++++++-----------------
|
|
|
9ae3a8 |
hw/display/cirrus_vga_rop2.h | 38 ++++++++++++++-------------
|
|
|
9ae3a8 |
3 files changed, 93 insertions(+), 54 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c
|
|
|
9ae3a8 |
index 003cc4c..c1324ab 100644
|
|
|
9ae3a8 |
--- a/hw/display/cirrus_vga.c
|
|
|
9ae3a8 |
+++ b/hw/display/cirrus_vga.c
|
|
|
9ae3a8 |
@@ -174,7 +174,7 @@
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
struct CirrusVGAState;
|
|
|
9ae3a8 |
typedef void (*cirrus_bitblt_rop_t) (struct CirrusVGAState *s,
|
|
|
9ae3a8 |
- uint32_t dstaddr, const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t dstaddr, uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight);
|
|
|
9ae3a8 |
typedef void (*cirrus_fill_t)(struct CirrusVGAState *s,
|
|
|
9ae3a8 |
@@ -316,7 +316,7 @@ static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void cirrus_bitblt_rop_nop(CirrusVGAState *s,
|
|
|
9ae3a8 |
- uint32_t dstaddr, const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t dstaddr, uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch,int srcpitch,
|
|
|
9ae3a8 |
int bltwidth,int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -328,6 +328,45 @@ static void cirrus_bitblt_fill_nop(CirrusVGAState *s,
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static inline uint8_t cirrus_src(CirrusVGAState *s, uint32_t srcaddr)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ if (s->cirrus_srccounter) {
|
|
|
9ae3a8 |
+ /* cputovideo */
|
|
|
9ae3a8 |
+ return s->cirrus_bltbuf[srcaddr & (CIRRUS_BLTBUFSIZE - 1)];
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ /* videotovideo */
|
|
|
9ae3a8 |
+ return s->vga.vram_ptr[srcaddr & s->cirrus_addr_mask];
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static inline uint16_t cirrus_src16(CirrusVGAState *s, uint32_t srcaddr)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ uint16_t *src;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (s->cirrus_srccounter) {
|
|
|
9ae3a8 |
+ /* cputovideo */
|
|
|
9ae3a8 |
+ src = (void *)&s->cirrus_bltbuf[srcaddr & (CIRRUS_BLTBUFSIZE - 1) & ~1];
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ /* videotovideo */
|
|
|
9ae3a8 |
+ src = (void *)&s->vga.vram_ptr[srcaddr & s->cirrus_addr_mask & ~1];
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ return *src;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+static inline uint32_t cirrus_src32(CirrusVGAState *s, uint32_t srcaddr)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ uint32_t *src;
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (s->cirrus_srccounter) {
|
|
|
9ae3a8 |
+ /* cputovideo */
|
|
|
9ae3a8 |
+ src = (void *)&s->cirrus_bltbuf[srcaddr & (CIRRUS_BLTBUFSIZE - 1) & ~3];
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ /* videotovideo */
|
|
|
9ae3a8 |
+ src = (void *)&s->vga.vram_ptr[srcaddr & s->cirrus_addr_mask & ~3];
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+ return *src;
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
#define ROP_NAME 0
|
|
|
9ae3a8 |
#define ROP_FN(d, s) 0
|
|
|
9ae3a8 |
#include "cirrus_vga_rop.h"
|
|
|
9ae3a8 |
@@ -670,10 +709,10 @@ static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin,
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc)
|
|
|
9ae3a8 |
+static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
uint32_t patternsize;
|
|
|
9ae3a8 |
- uint8_t *src;
|
|
|
9ae3a8 |
+ bool videosrc = !s->cirrus_srccounter;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (videosrc) {
|
|
|
9ae3a8 |
switch (s->vga.get_bpp(&s->vga)) {
|
|
|
9ae3a8 |
@@ -694,16 +733,14 @@ static int cirrus_bitblt_common_patterncopy(CirrusVGAState *s, bool videosrc)
|
|
|
9ae3a8 |
if (s->cirrus_blt_srcaddr + patternsize > s->vga.vram_size) {
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
- src = s->vga.vram_ptr + s->cirrus_blt_srcaddr;
|
|
|
9ae3a8 |
- } else {
|
|
|
9ae3a8 |
- src = s->cirrus_bltbuf;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (blit_is_unsafe(s, true)) {
|
|
|
9ae3a8 |
return 0;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- (*s->cirrus_rop) (s, s->cirrus_blt_dstaddr, src,
|
|
|
9ae3a8 |
+ (*s->cirrus_rop) (s, s->cirrus_blt_dstaddr,
|
|
|
9ae3a8 |
+ videosrc ? s->cirrus_blt_srcaddr : 0,
|
|
|
9ae3a8 |
s->cirrus_blt_dstpitch, 0,
|
|
|
9ae3a8 |
s->cirrus_blt_width, s->cirrus_blt_height);
|
|
|
9ae3a8 |
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr,
|
|
|
9ae3a8 |
@@ -740,7 +777,7 @@ static int cirrus_bitblt_solidfill(CirrusVGAState *s, int blt_rop)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- return cirrus_bitblt_common_patterncopy(s, true);
|
|
|
9ae3a8 |
+ return cirrus_bitblt_common_patterncopy(s);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
|
|
9ae3a8 |
@@ -790,7 +827,7 @@ static int cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
(*s->cirrus_rop) (s, s->cirrus_blt_dstaddr,
|
|
|
9ae3a8 |
- s->vga.vram_ptr + s->cirrus_blt_srcaddr,
|
|
|
9ae3a8 |
+ s->cirrus_blt_srcaddr,
|
|
|
9ae3a8 |
s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch,
|
|
|
9ae3a8 |
s->cirrus_blt_width, s->cirrus_blt_height);
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -833,7 +870,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (s->cirrus_srccounter > 0) {
|
|
|
9ae3a8 |
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
|
|
|
9ae3a8 |
- cirrus_bitblt_common_patterncopy(s, false);
|
|
|
9ae3a8 |
+ cirrus_bitblt_common_patterncopy(s);
|
|
|
9ae3a8 |
the_end:
|
|
|
9ae3a8 |
s->cirrus_srccounter = 0;
|
|
|
9ae3a8 |
cirrus_bitblt_reset(s);
|
|
|
9ae3a8 |
@@ -841,7 +878,7 @@ static void cirrus_bitblt_cputovideo_next(CirrusVGAState * s)
|
|
|
9ae3a8 |
/* at least one scan line */
|
|
|
9ae3a8 |
do {
|
|
|
9ae3a8 |
(*s->cirrus_rop)(s, s->cirrus_blt_dstaddr,
|
|
|
9ae3a8 |
- s->cirrus_bltbuf, 0, 0, s->cirrus_blt_width, 1);
|
|
|
9ae3a8 |
+ 0, 0, 0, s->cirrus_blt_width, 1);
|
|
|
9ae3a8 |
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, 0,
|
|
|
9ae3a8 |
s->cirrus_blt_width, 1);
|
|
|
9ae3a8 |
s->cirrus_blt_dstaddr += s->cirrus_blt_dstpitch;
|
|
|
9ae3a8 |
diff --git a/hw/display/cirrus_vga_rop.h b/hw/display/cirrus_vga_rop.h
|
|
|
9ae3a8 |
index 3b16d70..16dffb8 100644
|
|
|
9ae3a8 |
--- a/hw/display/cirrus_vga_rop.h
|
|
|
9ae3a8 |
+++ b/hw/display/cirrus_vga_rop.h
|
|
|
9ae3a8 |
@@ -78,7 +78,7 @@ static inline void glue(rop_32_, ROP_NAME)(CirrusVGAState *s,
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
|
|
|
9ae3a8 |
uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -93,19 +93,19 @@ glue(cirrus_bitblt_rop_fwd_, ROP_NAME)(CirrusVGAState *s,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for (y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
for (x = 0; x < bltwidth; x++) {
|
|
|
9ae3a8 |
- ROP_OP(s, dstaddr, *src);
|
|
|
9ae3a8 |
+ ROP_OP(s, dstaddr, cirrus_src(s, srcaddr));
|
|
|
9ae3a8 |
dstaddr++;
|
|
|
9ae3a8 |
- src++;
|
|
|
9ae3a8 |
+ srcaddr++;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
dstaddr += dstpitch;
|
|
|
9ae3a8 |
- src += srcpitch;
|
|
|
9ae3a8 |
+ srcaddr += srcpitch;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(cirrus_bitblt_rop_bkwd_, ROP_NAME)(CirrusVGAState *s,
|
|
|
9ae3a8 |
uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -114,19 +114,19 @@ glue(cirrus_bitblt_rop_bkwd_, ROP_NAME)(CirrusVGAState *s,
|
|
|
9ae3a8 |
srcpitch += bltwidth;
|
|
|
9ae3a8 |
for (y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
for (x = 0; x < bltwidth; x++) {
|
|
|
9ae3a8 |
- ROP_OP(s, dstaddr, *src);
|
|
|
9ae3a8 |
+ ROP_OP(s, dstaddr, cirrus_src(s, srcaddr));
|
|
|
9ae3a8 |
dstaddr--;
|
|
|
9ae3a8 |
- src--;
|
|
|
9ae3a8 |
+ srcaddr--;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
dstaddr += dstpitch;
|
|
|
9ae3a8 |
- src += srcpitch;
|
|
|
9ae3a8 |
+ srcaddr += srcpitch;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
|
|
|
9ae3a8 |
uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch,
|
|
|
9ae3a8 |
int srcpitch,
|
|
|
9ae3a8 |
int bltwidth,
|
|
|
9ae3a8 |
@@ -143,19 +143,19 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for (y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
for (x = 0; x < bltwidth; x++) {
|
|
|
9ae3a8 |
- ROP_OP_TR(s, dstaddr, *src, transp);
|
|
|
9ae3a8 |
+ ROP_OP_TR(s, dstaddr, cirrus_src(s, srcaddr), transp);
|
|
|
9ae3a8 |
dstaddr++;
|
|
|
9ae3a8 |
- src++;
|
|
|
9ae3a8 |
+ srcaddr++;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
dstaddr += dstpitch;
|
|
|
9ae3a8 |
- src += srcpitch;
|
|
|
9ae3a8 |
+ srcaddr += srcpitch;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
|
|
|
9ae3a8 |
uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch,
|
|
|
9ae3a8 |
int srcpitch,
|
|
|
9ae3a8 |
int bltwidth,
|
|
|
9ae3a8 |
@@ -167,19 +167,19 @@ glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_8)(CirrusVGAState *s,
|
|
|
9ae3a8 |
srcpitch += bltwidth;
|
|
|
9ae3a8 |
for (y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
for (x = 0; x < bltwidth; x++) {
|
|
|
9ae3a8 |
- ROP_OP_TR(s, dstaddr, *src, transp);
|
|
|
9ae3a8 |
+ ROP_OP_TR(s, dstaddr, cirrus_src(s, srcaddr), transp);
|
|
|
9ae3a8 |
dstaddr--;
|
|
|
9ae3a8 |
- src--;
|
|
|
9ae3a8 |
+ srcaddr--;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
dstaddr += dstpitch;
|
|
|
9ae3a8 |
- src += srcpitch;
|
|
|
9ae3a8 |
+ srcaddr += srcpitch;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
|
|
|
9ae3a8 |
uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch,
|
|
|
9ae3a8 |
int srcpitch,
|
|
|
9ae3a8 |
int bltwidth,
|
|
|
9ae3a8 |
@@ -196,19 +196,19 @@ glue(glue(cirrus_bitblt_rop_fwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for (y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
for (x = 0; x < bltwidth; x+=2) {
|
|
|
9ae3a8 |
- ROP_OP_TR_16(s, dstaddr, *(uint16_t *)src, transp);
|
|
|
9ae3a8 |
+ ROP_OP_TR_16(s, dstaddr, cirrus_src16(s, srcaddr), transp);
|
|
|
9ae3a8 |
dstaddr += 2;
|
|
|
9ae3a8 |
- src += 2;
|
|
|
9ae3a8 |
+ srcaddr += 2;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
dstaddr += dstpitch;
|
|
|
9ae3a8 |
- src += srcpitch;
|
|
|
9ae3a8 |
+ srcaddr += srcpitch;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
|
|
|
9ae3a8 |
uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch,
|
|
|
9ae3a8 |
int srcpitch,
|
|
|
9ae3a8 |
int bltwidth,
|
|
|
9ae3a8 |
@@ -220,12 +220,12 @@ glue(glue(cirrus_bitblt_rop_bkwd_transp_, ROP_NAME),_16)(CirrusVGAState *s,
|
|
|
9ae3a8 |
srcpitch += bltwidth;
|
|
|
9ae3a8 |
for (y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
for (x = 0; x < bltwidth; x+=2) {
|
|
|
9ae3a8 |
- ROP_OP_TR_16(s, dstaddr, *(uint16_t *)src, transp);
|
|
|
9ae3a8 |
+ ROP_OP_TR_16(s, dstaddr, cirrus_src16(s, srcaddr), transp);
|
|
|
9ae3a8 |
dstaddr -= 2;
|
|
|
9ae3a8 |
- src -= 2;
|
|
|
9ae3a8 |
+ srcaddr -= 2;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
dstaddr += dstpitch;
|
|
|
9ae3a8 |
- src += srcpitch;
|
|
|
9ae3a8 |
+ srcaddr += srcpitch;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/display/cirrus_vga_rop2.h b/hw/display/cirrus_vga_rop2.h
|
|
|
9ae3a8 |
index bc92f0e..b86bcd6 100644
|
|
|
9ae3a8 |
--- a/hw/display/cirrus_vga_rop2.h
|
|
|
9ae3a8 |
+++ b/hw/display/cirrus_vga_rop2.h
|
|
|
9ae3a8 |
@@ -41,14 +41,14 @@
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
(CirrusVGAState *s, uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
uint32_t addr;
|
|
|
9ae3a8 |
int x, y, pattern_y, pattern_pitch, pattern_x;
|
|
|
9ae3a8 |
unsigned int col;
|
|
|
9ae3a8 |
- const uint8_t *src1;
|
|
|
9ae3a8 |
+ uint32_t src1addr;
|
|
|
9ae3a8 |
#if DEPTH == 24
|
|
|
9ae3a8 |
int skipleft = s->vga.gr[0x2f] & 0x1f;
|
|
|
9ae3a8 |
#else
|
|
|
9ae3a8 |
@@ -66,22 +66,24 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
for(y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
pattern_x = skipleft;
|
|
|
9ae3a8 |
addr = dstaddr + skipleft;
|
|
|
9ae3a8 |
- src1 = src + pattern_y * pattern_pitch;
|
|
|
9ae3a8 |
+ src1addr = srcaddr + pattern_y * pattern_pitch;
|
|
|
9ae3a8 |
for (x = skipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
|
9ae3a8 |
#if DEPTH == 8
|
|
|
9ae3a8 |
- col = src1[pattern_x];
|
|
|
9ae3a8 |
+ col = cirrus_src(s, src1addr + pattern_x);
|
|
|
9ae3a8 |
pattern_x = (pattern_x + 1) & 7;
|
|
|
9ae3a8 |
#elif DEPTH == 16
|
|
|
9ae3a8 |
- col = ((uint16_t *)(src1 + pattern_x))[0];
|
|
|
9ae3a8 |
+ col = cirrus_src16(s, src1addr + pattern_x);
|
|
|
9ae3a8 |
pattern_x = (pattern_x + 2) & 15;
|
|
|
9ae3a8 |
#elif DEPTH == 24
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- const uint8_t *src2 = src1 + pattern_x * 3;
|
|
|
9ae3a8 |
- col = src2[0] | (src2[1] << 8) | (src2[2] << 16);
|
|
|
9ae3a8 |
+ uint32_t src2addr = src1addr + pattern_x * 3;
|
|
|
9ae3a8 |
+ col = cirrus_src(s, src2addr) |
|
|
|
9ae3a8 |
+ (cirrus_src(s, src2addr + 1) << 8) |
|
|
|
9ae3a8 |
+ (cirrus_src(s, src2addr + 2) << 16);
|
|
|
9ae3a8 |
pattern_x = (pattern_x + 1) & 7;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
#else
|
|
|
9ae3a8 |
- col = ((uint32_t *)(src1 + pattern_x))[0];
|
|
|
9ae3a8 |
+ col = cirrus_src32(s, src1addr + pattern_x);
|
|
|
9ae3a8 |
pattern_x = (pattern_x + 4) & 31;
|
|
|
9ae3a8 |
#endif
|
|
|
9ae3a8 |
PUTPIXEL(s, addr, col);
|
|
|
9ae3a8 |
@@ -96,7 +98,7 @@ glue(glue(glue(cirrus_patternfill_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
(CirrusVGAState *s, uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -124,12 +126,12 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for(y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
bitmask = 0x80 >> srcskipleft;
|
|
|
9ae3a8 |
- bits = *src++ ^ bits_xor;
|
|
|
9ae3a8 |
+ bits = cirrus_src(s, srcaddr++) ^ bits_xor;
|
|
|
9ae3a8 |
addr = dstaddr + dstskipleft;
|
|
|
9ae3a8 |
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
|
9ae3a8 |
if ((bitmask & 0xff) == 0) {
|
|
|
9ae3a8 |
bitmask = 0x80;
|
|
|
9ae3a8 |
- bits = *src++ ^ bits_xor;
|
|
|
9ae3a8 |
+ bits = cirrus_src(s, srcaddr++) ^ bits_xor;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
index = (bits & bitmask);
|
|
|
9ae3a8 |
if (index) {
|
|
|
9ae3a8 |
@@ -145,7 +147,7 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
(CirrusVGAState *s, uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -162,12 +164,12 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
colors[1] = s->cirrus_blt_fgcol;
|
|
|
9ae3a8 |
for(y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
bitmask = 0x80 >> srcskipleft;
|
|
|
9ae3a8 |
- bits = *src++;
|
|
|
9ae3a8 |
+ bits = cirrus_src(s, srcaddr++);
|
|
|
9ae3a8 |
addr = dstaddr + dstskipleft;
|
|
|
9ae3a8 |
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
|
9ae3a8 |
if ((bitmask & 0xff) == 0) {
|
|
|
9ae3a8 |
bitmask = 0x80;
|
|
|
9ae3a8 |
- bits = *src++;
|
|
|
9ae3a8 |
+ bits = cirrus_src(s, srcaddr++);
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
col = colors[!!(bits & bitmask)];
|
|
|
9ae3a8 |
PUTPIXEL(s, addr, col);
|
|
|
9ae3a8 |
@@ -181,7 +183,7 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
(CirrusVGAState *s, uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -207,7 +209,7 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
pattern_y = s->cirrus_blt_srcaddr & 7;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for(y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
- bits = src[pattern_y] ^ bits_xor;
|
|
|
9ae3a8 |
+ bits = cirrus_src(s, srcaddr + pattern_y) ^ bits_xor;
|
|
|
9ae3a8 |
bitpos = 7 - srcskipleft;
|
|
|
9ae3a8 |
addr = dstaddr + dstskipleft;
|
|
|
9ae3a8 |
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
|
9ae3a8 |
@@ -225,7 +227,7 @@ glue(glue(glue(cirrus_colorexpand_pattern_transp_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
static void
|
|
|
9ae3a8 |
glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
(CirrusVGAState *s, uint32_t dstaddr,
|
|
|
9ae3a8 |
- const uint8_t *src,
|
|
|
9ae3a8 |
+ uint32_t srcaddr,
|
|
|
9ae3a8 |
int dstpitch, int srcpitch,
|
|
|
9ae3a8 |
int bltwidth, int bltheight)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
@@ -242,7 +244,7 @@ glue(glue(glue(cirrus_colorexpand_pattern_, ROP_NAME), _),DEPTH)
|
|
|
9ae3a8 |
pattern_y = s->cirrus_blt_srcaddr & 7;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
for(y = 0; y < bltheight; y++) {
|
|
|
9ae3a8 |
- bits = src[pattern_y];
|
|
|
9ae3a8 |
+ bits = cirrus_src(s, srcaddr + pattern_y);
|
|
|
9ae3a8 |
bitpos = 7 - srcskipleft;
|
|
|
9ae3a8 |
addr = dstaddr + dstskipleft;
|
|
|
9ae3a8 |
for (x = dstskipleft; x < bltwidth; x += (DEPTH / 8)) {
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|