Revision e69390ce hw/cirrus_vga.c
b/hw/cirrus_vga.c | ||
---|---|---|
31 | 31 |
|
32 | 32 |
/* |
33 | 33 |
* TODO: |
34 |
* - fix 24 bpp pattern fills (source is 32 bpp in that case) |
|
35 | 34 |
* - add support for WRITEMASK (GR2F) |
36 |
* - add support for scanline modulo in pattern fill |
|
37 | 35 |
* - optimize linear mappings |
38 | 36 |
* - optimize bitblt functions |
39 | 37 |
*/ |
... | ... | |
420 | 418 |
func,\ |
421 | 419 |
} |
422 | 420 |
|
421 |
static const cirrus_bitblt_rop_t cirrus_patternfill[16][4] = { |
|
422 |
ROP2(cirrus_patternfill_0), |
|
423 |
ROP2(cirrus_patternfill_src_and_dst), |
|
424 |
ROP_NOP2(cirrus_bitblt_rop_nop), |
|
425 |
ROP2(cirrus_patternfill_src_and_notdst), |
|
426 |
ROP2(cirrus_patternfill_notdst), |
|
427 |
ROP2(cirrus_patternfill_src), |
|
428 |
ROP2(cirrus_patternfill_1), |
|
429 |
ROP2(cirrus_patternfill_notsrc_and_dst), |
|
430 |
ROP2(cirrus_patternfill_src_xor_dst), |
|
431 |
ROP2(cirrus_patternfill_src_or_dst), |
|
432 |
ROP2(cirrus_patternfill_notsrc_or_notdst), |
|
433 |
ROP2(cirrus_patternfill_src_notxor_dst), |
|
434 |
ROP2(cirrus_patternfill_src_or_notdst), |
|
435 |
ROP2(cirrus_patternfill_notsrc), |
|
436 |
ROP2(cirrus_patternfill_notsrc_or_dst), |
|
437 |
ROP2(cirrus_patternfill_notsrc_and_notdst), |
|
438 |
}; |
|
439 |
|
|
423 | 440 |
static const cirrus_bitblt_rop_t cirrus_colorexpand_transp[16][4] = { |
424 | 441 |
ROP2(cirrus_colorexpand_transp_0), |
425 | 442 |
ROP2(cirrus_colorexpand_transp_src_and_dst), |
... | ... | |
569 | 586 |
{ |
570 | 587 |
uint8_t work_colorexp[256]; |
571 | 588 |
uint8_t *dst; |
572 |
uint8_t *dstc; |
|
573 |
int x, y; |
|
574 |
int tilewidth, tileheight; |
|
575 | 589 |
int patternbytes = s->cirrus_blt_pixelwidth * 8; |
576 | 590 |
|
577 | 591 |
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) { |
... | ... | |
592 | 606 |
} |
593 | 607 |
|
594 | 608 |
dst = s->vram_ptr + s->cirrus_blt_dstaddr; |
595 |
for (y = 0; y < s->cirrus_blt_height; y += 8) { |
|
596 |
dstc = dst; |
|
597 |
tileheight = qemu_MIN(8, s->cirrus_blt_height - y); |
|
598 |
for (x = 0; x < s->cirrus_blt_width; x += patternbytes) { |
|
599 |
tilewidth = qemu_MIN(patternbytes, s->cirrus_blt_width - x); |
|
600 |
(*s->cirrus_rop) (s, dstc, src, |
|
601 |
s->cirrus_blt_dstpitch, patternbytes, |
|
602 |
tilewidth, tileheight); |
|
603 |
dstc += patternbytes; |
|
604 |
} |
|
605 |
dst += s->cirrus_blt_dstpitch * 8; |
|
606 |
} |
|
609 |
(*s->cirrus_rop) (s, dst, src, |
|
610 |
s->cirrus_blt_dstpitch, 0, |
|
611 |
s->cirrus_blt_width, s->cirrus_blt_height); |
|
607 | 612 |
cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, |
608 |
s->cirrus_blt_dstpitch, s->cirrus_blt_width,
|
|
609 |
s->cirrus_blt_height);
|
|
613 |
s->cirrus_blt_dstpitch, s->cirrus_blt_width,
|
|
614 |
s->cirrus_blt_height);
|
|
610 | 615 |
return 1; |
611 | 616 |
} |
612 | 617 |
|
... | ... | |
636 | 641 |
static int cirrus_bitblt_videotovideo_patterncopy(CirrusVGAState * s) |
637 | 642 |
{ |
638 | 643 |
return cirrus_bitblt_common_patterncopy(s, |
639 |
s->vram_ptr + |
|
640 |
s->cirrus_blt_srcaddr);
|
|
644 |
s->vram_ptr +
|
|
645 |
(s->cirrus_blt_srcaddr & ~7));
|
|
641 | 646 |
} |
642 | 647 |
|
643 | 648 |
static int cirrus_bitblt_videotovideo_copy(CirrusVGAState * s) |
... | ... | |
855 | 860 |
cirrus_bitblt_bgcol(s); |
856 | 861 |
s->cirrus_rop = cirrus_colorexpand[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; |
857 | 862 |
} |
863 |
} else if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) { |
|
864 |
s->cirrus_rop = cirrus_patternfill[rop_to_index[blt_rop]][s->cirrus_blt_pixelwidth - 1]; |
|
858 | 865 |
} else { |
859 | 866 |
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_BACKWARDS) { |
860 | 867 |
s->cirrus_blt_dstpitch = -s->cirrus_blt_dstpitch; |
Also available in: Unified diff