Some work on the Voodoo Banshee BitBlt code.

- Implemented ternary raster operations. With 3 binary input values we have 8
  possible combinations und the ROP code is the binary representation of the
  result table. Instead of implementing cascades of binary operations at byte
  level, we simply build a 3-bit value from D, S and P. This is the bit number
  of the ROP code to use as the result. This is performed for each bit of color
  data. We still keep the existing binary operations at byte level, since the
  code is faster for that case.
- Inplemented the "row #0 only" flag handling in pattern fill operations. This
  flags seems to have an undocumented effect on the source pitch of
  host-to-screen operations. This issue needs to be investigated.
- TODO: Some bits of the srcXY register seem to have an undocumented effect on
  host-to-screen operations, too.
This commit is contained in:
Volker Ruppert 2017-11-15 22:13:37 +00:00
parent 0c604d27d1
commit c81df659c1
5 changed files with 560 additions and 350 deletions

View File

@ -100,4 +100,25 @@ IMPLEMENT_BACKWARD_BITBLT(notsrc, *dst = (~(*src)))
IMPLEMENT_BACKWARD_BITBLT(notsrc_or_dst, *dst = (~(*src)) | (*dst))
IMPLEMENT_BACKWARD_BITBLT(notsrc_and_notdst, *dst = (~(*src)) & (~(*dst)))
void bx_ternary_rop(Bit8u rop0, Bit8u *dst_ptr, Bit8u *src_ptr, Bit8u *pat_ptr,
int dpxsize)
{
Bit8u mask, inbits, outbits;
for (int i = 0; i < dpxsize; i++) {
mask = 0x80;
outbits = 0;
for (int b = 7; b >= 0; b--) {
inbits = (*dst_ptr & mask) > 0;
inbits |= ((*src_ptr & mask) > 0) << 1;
inbits |= ((*pat_ptr & mask) > 0) << 2;
outbits |= ((rop0 & (1 << inbits)) > 0) << b;
mask >>= 1;
}
*dst_ptr++ = outbits;
src_ptr++;
pat_ptr++;
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -89,6 +89,7 @@ public:
void banshee_blt_pattern_fill_mono(void);
void banshee_blt_pattern_fill_color(void);
void banshee_blt_screen_to_screen(void);
void banshee_blt_screen_to_screen_pattern(void);
void banshee_blt_host_to_screen(void);
private:

View File

@ -1747,10 +1747,18 @@ struct _banshee_info
bx_bitblt_rop_t rop_fn;
bx_bitblt_rop_t rop_handler[2][0x100];
Bit8u rop_flags[0x100];
Bit32u src_base;
bx_bool src_tiled;
Bit8u src_fmt;
Bit16u src_pitch;
Bit16u src_x;
Bit16u src_y;
Bit16u src_w;
Bit16u src_h;
Bit32u dst_base;
bx_bool dst_tiled;
Bit8u dst_fmt;
Bit16u dst_pitch;
Bit16u dst_x;
Bit16u dst_y;
Bit16u dst_w;

View File

@ -3313,13 +3313,12 @@ void init_tmu_shared(tmu_shared_state *s)
v->banshee.blt.rop_flags[num] = flags; \
} while (0);
#define BX_ROP_PATTERN 0x01
#define BX_ROP_UNSUPPORTED 0x80
#define BX_ROP_PATTERN 0x01
void banshee_bitblt_init()
{
for (int i = 0; i < 0x100; i++) {
SETUP_BITBLT(i, nop, BX_ROP_UNSUPPORTED);
SETUP_BITBLT(i, nop, BX_ROP_PATTERN);
}
SETUP_BITBLT(0x00, 0, 0); // 0
SETUP_BITBLT(0x05, notsrc_and_notdst, BX_ROP_PATTERN); // PSan