Commit 4c8732d71b61d2950a57dbb758517de536125175
1 parent
1cc98a5f
cirrus blitter fixes
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@907 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
68 additions
and
11 deletions
hw/cirrus_vga.c
@@ -136,6 +136,7 @@ | @@ -136,6 +136,7 @@ | ||
136 | 136 | ||
137 | // control 0x33 | 137 | // control 0x33 |
138 | #define CIRRUS_BLTMODEEXT_SOLIDFILL 0x04 | 138 | #define CIRRUS_BLTMODEEXT_SOLIDFILL 0x04 |
139 | +#define CIRRUS_BLTMODEEXT_COLOREXPINV 0x02 | ||
139 | #define CIRRUS_BLTMODEEXT_DWORDGRANULARITY 0x01 | 140 | #define CIRRUS_BLTMODEEXT_DWORDGRANULARITY 0x01 |
140 | 141 | ||
141 | // memory-mapped IO | 142 | // memory-mapped IO |
@@ -325,7 +326,7 @@ static void cirrus_bitblt_fill_nop(CirrusVGAState *s, | @@ -325,7 +326,7 @@ static void cirrus_bitblt_fill_nop(CirrusVGAState *s, | ||
325 | #include "cirrus_vga_rop.h" | 326 | #include "cirrus_vga_rop.h" |
326 | 327 | ||
327 | #define ROP_NAME 1 | 328 | #define ROP_NAME 1 |
328 | -#define ROP_OP(d, s) d = 0xff | 329 | +#define ROP_OP(d, s) d = ~0 |
329 | #include "cirrus_vga_rop.h" | 330 | #include "cirrus_vga_rop.h" |
330 | 331 | ||
331 | #define ROP_NAME notsrc_and_dst | 332 | #define ROP_NAME notsrc_and_dst |
@@ -435,6 +436,25 @@ static const cirrus_bitblt_rop_t cirrus_colorexpand_transp[16][4] = { | @@ -435,6 +436,25 @@ static const cirrus_bitblt_rop_t cirrus_colorexpand_transp[16][4] = { | ||
435 | ROP2(cirrus_colorexpand_transp_notsrc_and_notdst), | 436 | ROP2(cirrus_colorexpand_transp_notsrc_and_notdst), |
436 | }; | 437 | }; |
437 | 438 | ||
439 | +static const cirrus_bitblt_rop_t cirrus_colorexpand_transp_inv[16][4] = { | ||
440 | + ROP2(cirrus_colorexpand_transp_inv_0), | ||
441 | + ROP2(cirrus_colorexpand_transp_inv_src_and_dst), | ||
442 | + ROP_NOP2(cirrus_bitblt_rop_nop), | ||
443 | + ROP2(cirrus_colorexpand_transp_inv_src_and_notdst), | ||
444 | + ROP2(cirrus_colorexpand_transp_inv_notdst), | ||
445 | + ROP2(cirrus_colorexpand_transp_inv_src), | ||
446 | + ROP2(cirrus_colorexpand_transp_inv_1), | ||
447 | + ROP2(cirrus_colorexpand_transp_inv_notsrc_and_dst), | ||
448 | + ROP2(cirrus_colorexpand_transp_inv_src_xor_dst), | ||
449 | + ROP2(cirrus_colorexpand_transp_inv_src_or_dst), | ||
450 | + ROP2(cirrus_colorexpand_transp_inv_notsrc_or_notdst), | ||
451 | + ROP2(cirrus_colorexpand_transp_inv_src_notxor_dst), | ||
452 | + ROP2(cirrus_colorexpand_transp_inv_src_or_notdst), | ||
453 | + ROP2(cirrus_colorexpand_transp_inv_notsrc), | ||
454 | + ROP2(cirrus_colorexpand_transp_inv_notsrc_or_dst), | ||
455 | + ROP2(cirrus_colorexpand_transp_inv_notsrc_and_notdst), | ||
456 | +}; | ||
457 | + | ||
438 | static const cirrus_bitblt_rop_t cirrus_colorexpand[16][4] = { | 458 | static const cirrus_bitblt_rop_t cirrus_colorexpand[16][4] = { |
439 | ROP2(cirrus_colorexpand_0), | 459 | ROP2(cirrus_colorexpand_0), |
440 | ROP2(cirrus_colorexpand_src_and_dst), | 460 | ROP2(cirrus_colorexpand_src_and_dst), |
@@ -820,8 +840,13 @@ static void cirrus_bitblt_start(CirrusVGAState * s) | @@ -820,8 +840,13 @@ static void cirrus_bitblt_start(CirrusVGAState * s) | ||
820 | CIRRUS_BLTMODE_COLOREXPAND) { | 840 | CIRRUS_BLTMODE_COLOREXPAND) { |
821 | 841 | ||
822 | if (s->cirrus_blt_mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) { | 842 | if (s->cirrus_blt_mode & CIRRUS_BLTMODE_TRANSPARENTCOMP) { |
823 | - cirrus_bitblt_fgcol(s); | ||
824 | - s->cirrus_rop = cirrus_colorexpand_transp[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; | 843 | + if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_COLOREXPINV) { |
844 | + cirrus_bitblt_bgcol(s); | ||
845 | + s->cirrus_rop = cirrus_colorexpand_transp_inv[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; | ||
846 | + } else { | ||
847 | + cirrus_bitblt_fgcol(s); | ||
848 | + s->cirrus_rop = cirrus_colorexpand_transp[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; | ||
849 | + } | ||
825 | } else { | 850 | } else { |
826 | cirrus_bitblt_fgcol(s); | 851 | cirrus_bitblt_fgcol(s); |
827 | cirrus_bitblt_bgcol(s); | 852 | cirrus_bitblt_bgcol(s); |
hw/cirrus_vga_rop2.h
@@ -36,14 +36,14 @@ | @@ -36,14 +36,14 @@ | ||
36 | #error unsupported DEPTH | 36 | #error unsupported DEPTH |
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | +/* NOTE: srcpitch is ignored */ | ||
39 | static void | 40 | static void |
40 | glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) | 41 | glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) |
41 | (CirrusVGAState * s, uint8_t * dst, | 42 | (CirrusVGAState * s, uint8_t * dst, |
42 | - const uint8_t * src1, | 43 | + const uint8_t * src, |
43 | int dstpitch, int srcpitch, | 44 | int dstpitch, int srcpitch, |
44 | int bltwidth, int bltheight) | 45 | int bltwidth, int bltheight) |
45 | { | 46 | { |
46 | - const uint8_t *src; | ||
47 | uint8_t *d; | 47 | uint8_t *d; |
48 | int x, y; | 48 | int x, y; |
49 | unsigned bits; | 49 | unsigned bits; |
@@ -54,7 +54,6 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) | @@ -54,7 +54,6 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) | ||
54 | 54 | ||
55 | col = s->cirrus_blt_fgcol; | 55 | col = s->cirrus_blt_fgcol; |
56 | for(y = 0; y < bltheight; y++) { | 56 | for(y = 0; y < bltheight; y++) { |
57 | - src = src1; | ||
58 | bitmask = 0x80 >> srcskipleft; | 57 | bitmask = 0x80 >> srcskipleft; |
59 | bits = *src++; | 58 | bits = *src++; |
60 | d = dst; | 59 | d = dst; |
@@ -70,7 +69,43 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) | @@ -70,7 +69,43 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) | ||
70 | d += (DEPTH / 8); | 69 | d += (DEPTH / 8); |
71 | bitmask >>= 1; | 70 | bitmask >>= 1; |
72 | } | 71 | } |
73 | - src1 += srcpitch; | 72 | + dst += dstpitch; |
73 | + } | ||
74 | +} | ||
75 | + | ||
76 | +/* NOTE: srcpitch is ignored */ | ||
77 | +static void | ||
78 | +glue(glue(glue(cirrus_colorexpand_transp_inv_, ROP_NAME), _),DEPTH) | ||
79 | + (CirrusVGAState * s, uint8_t * dst, | ||
80 | + const uint8_t * src, | ||
81 | + int dstpitch, int srcpitch, | ||
82 | + int bltwidth, int bltheight) | ||
83 | +{ | ||
84 | + uint8_t *d; | ||
85 | + int x, y; | ||
86 | + unsigned bits; | ||
87 | + unsigned int col; | ||
88 | + unsigned bitmask; | ||
89 | + unsigned index; | ||
90 | + int srcskipleft = 0; | ||
91 | + | ||
92 | + col = s->cirrus_blt_bgcol; | ||
93 | + for(y = 0; y < bltheight; y++) { | ||
94 | + bitmask = 0x80 >> srcskipleft; | ||
95 | + bits = *src++; | ||
96 | + d = dst; | ||
97 | + for (x = 0; x < bltwidth; x += (DEPTH / 8)) { | ||
98 | + if ((bitmask & 0xff) == 0) { | ||
99 | + bitmask = 0x80; | ||
100 | + bits = *src++; | ||
101 | + } | ||
102 | + index = (bits & bitmask); | ||
103 | + if (!index) { | ||
104 | + PUTPIXEL(); | ||
105 | + } | ||
106 | + d += (DEPTH / 8); | ||
107 | + bitmask >>= 1; | ||
108 | + } | ||
74 | dst += dstpitch; | 109 | dst += dstpitch; |
75 | } | 110 | } |
76 | } | 111 | } |
@@ -78,11 +113,10 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) | @@ -78,11 +113,10 @@ glue(glue(glue(cirrus_colorexpand_transp_, ROP_NAME), _),DEPTH) | ||
78 | static void | 113 | static void |
79 | glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) | 114 | glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) |
80 | (CirrusVGAState * s, uint8_t * dst, | 115 | (CirrusVGAState * s, uint8_t * dst, |
81 | - const uint8_t * src1, | 116 | + const uint8_t * src, |
82 | int dstpitch, int srcpitch, | 117 | int dstpitch, int srcpitch, |
83 | int bltwidth, int bltheight) | 118 | int bltwidth, int bltheight) |
84 | { | 119 | { |
85 | - const uint8_t *src; | ||
86 | uint32_t colors[2]; | 120 | uint32_t colors[2]; |
87 | uint8_t *d; | 121 | uint8_t *d; |
88 | int x, y; | 122 | int x, y; |
@@ -94,7 +128,6 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) | @@ -94,7 +128,6 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) | ||
94 | colors[0] = s->cirrus_blt_bgcol; | 128 | colors[0] = s->cirrus_blt_bgcol; |
95 | colors[1] = s->cirrus_blt_fgcol; | 129 | colors[1] = s->cirrus_blt_fgcol; |
96 | for(y = 0; y < bltheight; y++) { | 130 | for(y = 0; y < bltheight; y++) { |
97 | - src = src1; | ||
98 | bitmask = 0x80 >> srcskipleft; | 131 | bitmask = 0x80 >> srcskipleft; |
99 | bits = *src++; | 132 | bits = *src++; |
100 | d = dst; | 133 | d = dst; |
@@ -108,7 +141,6 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) | @@ -108,7 +141,6 @@ glue(glue(glue(cirrus_colorexpand_, ROP_NAME), _),DEPTH) | ||
108 | d += (DEPTH / 8); | 141 | d += (DEPTH / 8); |
109 | bitmask >>= 1; | 142 | bitmask >>= 1; |
110 | } | 143 | } |
111 | - src1 += srcpitch; | ||
112 | dst += dstpitch; | 144 | dst += dstpitch; |
113 | } | 145 | } |
114 | } | 146 | } |