Add SVGA multi-monitor support

Cirrus Logic CL-GD5436/CL-GD5446 works as secondary video adapters
This commit is contained in:
Cacodemon345
2023-01-22 16:50:21 +06:00
parent b875e8518d
commit 7898109b66
10 changed files with 174 additions and 151 deletions

View File

@@ -453,7 +453,7 @@ banshee_render_16bpp_tiled(svga_t *svga)
{
banshee_t *banshee = (banshee_t *) svga->p;
int x;
uint32_t *p = &((uint32_t *) buffer32->line[svga->displine + svga->y_add])[svga->x_add];
uint32_t *p = &((uint32_t *) svga->monitor->target_buffer->line[svga->displine + svga->y_add])[svga->x_add];
uint32_t addr;
int drawn = 0;
@@ -1602,6 +1602,10 @@ banshee_read_linear(uint32_t addr, void *p)
cycles -= voodoo->read_time;
if ((banshee->pci_regs[0x30] & 0x01) && addr >= banshee->bios_rom.mapping.base && addr < (banshee->bios_rom.mapping.base + banshee->bios_rom.sz))
{
return rom_read(addr & (banshee->bios_rom.sz - 1), &banshee->bios_rom);
}
addr &= svga->decode_mask;
if (addr >= voodoo->tile_base) {
int x, y;
@@ -1616,7 +1620,7 @@ banshee_read_linear(uint32_t addr, void *p)
if (addr >= svga->vram_max)
return 0xff;
cycles -= video_timing_read_b;
cycles -= svga->monitor->mon_video_timing_read_b;
// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]);
@@ -1634,6 +1638,10 @@ banshee_read_linear_w(uint32_t addr, void *p)
return banshee_read_linear(addr, p) | (banshee_read_linear(addr + 1, p) << 8);
cycles -= voodoo->read_time;
if ((banshee->pci_regs[0x30] & 0x01) && addr >= banshee->bios_rom.mapping.base && addr < (banshee->bios_rom.mapping.base + banshee->bios_rom.sz))
{
return rom_readw(addr & (banshee->bios_rom.sz - 1), &banshee->bios_rom);
}
addr &= svga->decode_mask;
if (addr >= voodoo->tile_base) {
int x, y;
@@ -1648,7 +1656,7 @@ banshee_read_linear_w(uint32_t addr, void *p)
if (addr >= svga->vram_max)
return 0xff;
cycles -= video_timing_read_w;
cycles -= svga->monitor->mon_video_timing_read_w;
// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]);
@@ -1667,6 +1675,10 @@ banshee_read_linear_l(uint32_t addr, void *p)
cycles -= voodoo->read_time;
if ((banshee->pci_regs[0x30] & 0x01) && addr >= banshee->bios_rom.mapping.base && addr < (banshee->bios_rom.mapping.base + banshee->bios_rom.sz))
{
return rom_readl(addr & (banshee->bios_rom.sz - 1), &banshee->bios_rom);
}
addr &= svga->decode_mask;
if (addr >= voodoo->tile_base) {
int x, y;
@@ -1681,7 +1693,7 @@ banshee_read_linear_l(uint32_t addr, void *p)
if (addr >= svga->vram_max)
return 0xff;
cycles -= video_timing_read_l;
cycles -= svga->monitor->mon_video_timing_read_l;
// banshee_log("read_linear: addr=%08x val=%02x\n", addr, svga->vram[addr & svga->vram_mask]);
@@ -1712,7 +1724,7 @@ banshee_write_linear(uint32_t addr, uint8_t val, void *p)
if (addr >= svga->vram_max)
return;
cycles -= video_timing_write_b;
cycles -= svga->monitor->mon_video_timing_write_b;
svga->changedvram[addr >> 12] = changeframecount;
svga->vram[addr & svga->vram_mask] = val;
@@ -1747,7 +1759,7 @@ banshee_write_linear_w(uint32_t addr, uint16_t val, void *p)
if (addr >= svga->vram_max)
return;
cycles -= video_timing_write_w;
cycles -= svga->monitor->mon_video_timing_write_w;
svga->changedvram[addr >> 12] = changeframecount;
*(uint16_t *) &svga->vram[addr & svga->vram_mask] = val;
@@ -1790,7 +1802,7 @@ banshee_write_linear_l(uint32_t addr, uint32_t val, void *p)
if (addr >= svga->vram_max)
return;
cycles -= video_timing_write_l;
cycles -= svga->monitor->mon_video_timing_write_l;
svga->changedvram[addr >> 12] = changeframecount;
*(uint32_t *) &svga->vram[addr & svga->vram_mask] = val;
@@ -1862,7 +1874,7 @@ banshee_hwcursor_draw(svga_t *svga, int displine)
if (x_off > -8) {
for (xx = 0; xx < 8; xx++) {
if (plane0[x >> 3] & (1 << 7))
((uint32_t *) buffer32->line[displine])[x_off + xx + svga->x_add] = (plane1[x >> 3] & (1 << 7)) ? col1 : col0;
((uint32_t *) svga->monitor->target_buffer->line[displine])[x_off + xx + svga->x_add] = (plane1[x >> 3] & (1 << 7)) ? col1 : col0;
plane0[x >> 3] <<= 1;
plane1[x >> 3] <<= 1;
@@ -1877,9 +1889,9 @@ banshee_hwcursor_draw(svga_t *svga, int displine)
if (x_off > -8) {
for (xx = 0; xx < 8; xx++) {
if (!(plane0[x >> 3] & (1 << 7)))
((uint32_t *) buffer32->line[displine])[x_off + xx + svga->x_add] = (plane1[x >> 3] & (1 << 7)) ? col1 : col0;
((uint32_t *) svga->monitor->target_buffer->line[displine])[x_off + xx + svga->x_add] = (plane1[x >> 3] & (1 << 7)) ? col1 : col0;
else if (plane1[x >> 3] & (1 << 7))
((uint32_t *) buffer32->line[displine])[x_off + xx + svga->x_add] ^= 0xffffff;
((uint32_t *) svga->monitor->target_buffer->line[displine])[x_off + xx + svga->x_add] ^= 0xffffff;
plane0[x >> 3] <<= 1;
plane1[x >> 3] <<= 1;
@@ -2204,7 +2216,7 @@ banshee_overlay_draw(svga_t *svga, int displine)
// pclog("displine=%i addr=%08x %08x %08x %08x\n", displine, svga->overlay_latch.addr, src_addr, voodoo->overlay.vidOverlayDvdy, *(uint32_t *)src);
// if (src_addr >= 0x800000)
// fatal("overlay out of range!\n");
p = &((uint32_t *) buffer32->line[displine])[svga->overlay_latch.x + svga->x_add];
p = &((uint32_t *) svga->monitor->target_buffer->line[displine])[svga->overlay_latch.x + svga->x_add];
if (banshee->voodoo->scrfilter && banshee->voodoo->scrfilterEnabled)
skip_filtering = ((banshee->vidProcCfg & VIDPROCCFG_FILTER_MODE_MASK) != VIDPROCCFG_FILTER_MODE_BILINEAR && !(banshee->vidProcCfg & VIDPROCCFG_H_SCALE_ENABLE) && !(banshee->vidProcCfg & VIDPROCCFG_FILTER_MODE_DITHER_4X4) && !(banshee->vidProcCfg & VIDPROCCFG_FILTER_MODE_DITHER_2X2));