Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

video/s3virge: refactor #12182

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
47887c3
video/s3virge.cpp: initial steps for major structural refactoring
angelosa Feb 7, 2024
bd9e035
Merge branch 'master' into pci_virge-fifo
angelosa Feb 24, 2024
6769077
video/s3virge: fix ViRGE spelling
angelosa Feb 24, 2024
489dcb4
pci/virge_pci: fix command_mask
angelosa Feb 24, 2024
8689582
Merge branch 'master' into pci_virge-fifo
angelosa Mar 6, 2024
ba2fc6f
Merge branch 'master' into pci_virge-fifo
angelosa Mar 25, 2024
0a1e14e
video/s3virge: base conversion to FIFO
angelosa Mar 26, 2024
98aa5db
video/s3virge: couple obvious blunders [skip ci]
angelosa Mar 26, 2024
10a78e8
video/s3virge: logging and misc cleanups
angelosa Mar 27, 2024
f540542
video/s3virge: WIP FIFO interactions, make command pipeline to be a b…
angelosa Mar 29, 2024
f39e73c
video/s3virge: refine a bit FIFO status
angelosa Mar 29, 2024
5b3cd47
video/s3virge: merge draw & command timers in one, simplify state log…
angelosa Mar 30, 2024
3205275
video/s3virge: move NOP logic in dequeue fn
angelosa Mar 31, 2024
c1950fb
Merge branch 'master' into pci_virge-fifo
angelosa Apr 2, 2024
69d0dfb
video/s3virge: add primary streams stride override, fix Ubuntu flavor…
angelosa Apr 4, 2024
bfd0363
video/s3virge: RAMDAC runs in unpacked mode if streams processor disa…
angelosa Apr 7, 2024
4d29c80
video/s3virge: flatten s3dvirge.s3d down to one struct (m_bitblt), ge…
angelosa Apr 13, 2024
76d914c
video/s3virge: fix 8514/A comment position
angelosa Apr 15, 2024
f63ae5e
Merge branch 'master' into pci_virge-fifo
angelosa Apr 15, 2024
6e699e6
Merge branch 'master' into pci_virge-fifo
angelosa Apr 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions src/devices/bus/pci/virge_pci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,42 @@ void virge_pci_device::mmio_map(address_map& map)
// image transfer ports
map(0x0000,0x7fff).w(m_vga, FUNC(s3virge_vga_device::image_xfer));

//map(0x8180,0x81ff) primary/secondary stream control
//map(0x8000,0x8043) PCI Configuration Space regs
map(0x8180,0x81ff).m(m_vga, FUNC(s3virge_vga_device::streams_control_map));

//map(0x8200,0x821f) memory port controller
//map(0x8220,0x8227) DMA control

// MMIO address map
map(0x83b0,0x83df).m(m_vga, FUNC(s3virge_vga_device::io_map));
map(0x8504,0x8507).rw(m_vga, FUNC(s3virge_vga_device::s3d_sub_status_r), FUNC(s3virge_vga_device::s3d_sub_control_w));
// TODO: writeable
map(0x850c,0x850f).r(m_vga, FUNC(s3virge_vga_device::s3d_func_ctrl_r));

//map(0x8580,0x858b) video DMA
//map(0x8590,0x859f) command DMA

// S3D engine registers
map(0xa000,0xb7ff).rw(m_vga, FUNC(s3virge_vga_device::s3d_register_r), FUNC(s3virge_vga_device::s3d_register_w));
map(0xa000,0xb7ff).m(m_vga, FUNC(s3virge_vga_device::s3d_register_map));

// alternate image transfer ports
map(0xd000,0xefff).w(m_vga, FUNC(s3virge_vga_device::image_xfer));

//map(0xff00, 0xff43) LPB control
//map(0xff00, 0xff5f) LPB Local Peripheral Bus control
//map(0xff1c, 0xff1f) LPB GIP/GOP General Input/Output Port (for OEM implementations)
//map(0xff20, 0xff23) Serial Port Register (DDC/I2C, pins 205-206, aliased at I/O ports $e2 or $e8)
//map(0xff24, 0xff27) LPB Video Input Window Size
//map(0xff28, 0xff2b) LPB Video Data Offsets
//map(0xff2c, 0xff2f) LPB Horizontal Decimation Control Register
//map(0xff30, 0xff33) LPB Vertical Decimation Control Register
//map(0xff34, 0xff37) LPB Line Stride
//map(0xff40, 0xff5f) LPB Output FIFO Register
}

void virge_pci_device::lfb_map(address_map& map)
{
map(0x0, 0x00ffffff).rw(m_vga, FUNC(s3virge_vga_device::fb_r), FUNC(s3virge_vga_device::fb_w));
// NOTE: upper mirror is i/f for BE hosts.
map(0x0, 0x00ffffff).mirror(0x02000000).rw(m_vga, FUNC(s3virge_vga_device::fb_r), FUNC(s3virge_vga_device::fb_w));
}

void virge_pci_device::config_map(address_map &map)
Expand Down Expand Up @@ -152,6 +163,12 @@ void virge_pci_device::device_start()
add_map(64 * 1024 * 1024, M_MEM | M_DISABLED, FUNC(virge_pci_device::lfb_map));
set_map_address(0, 0x70000000);

command = 0x0000;
// DAC SNP / BME / MEM / I/O
command_mask = 0x27;
// medium DEVSELB
status = 0x0200;

remap_cb();
machine().save().register_postload(save_prepost_delegate(FUNC(virge_pci_device::postload), this));
}
Expand All @@ -174,18 +191,23 @@ void virgedx_pci_device::device_start()
void virge_pci_device::map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space,
uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space)
{
memory_space->install_readwrite_handler(0xa0000, 0xbffff, read8sm_delegate(*this, FUNC(virge_pci_device::vram_r)), write8sm_delegate(*this, FUNC(virge_pci_device::vram_w)));

io_space->install_device(0x03b0, 0x03df, *this, &virge_pci_device::legacy_io_map);

// NOTE: this looks unrelated to the linear addressing
// xubuntu 6.10 and BeOS 3.x definitely wants it this way.
if(downcast<s3virge_vga_device *>(m_vga.target())->is_new_mmio_active())
if (BIT(command, 1))
{
const u32 get_bar_address = get_vga_linear_address() | 0x01000000;

memory_space->install_device(get_bar_address, get_bar_address | 0xffff, *this, &virge_pci_device::mmio_map);
memory_space->install_readwrite_handler(0xa0000, 0xbffff, read8sm_delegate(*this, FUNC(virge_pci_device::vram_r)), write8sm_delegate(*this, FUNC(virge_pci_device::vram_w)));
// NOTE: this looks unrelated to the linear addressing
// xubuntu 6.10 and BeOS 3.x definitely wants it this way.
if(downcast<s3virge_vga_device *>(m_vga.target())->is_new_mmio_active())
{
u32 get_bar_address = get_vga_linear_address() | 0x01000000;
memory_space->install_device(get_bar_address, get_bar_address | 0xffff, *this, &virge_pci_device::mmio_map);

get_bar_address |= 0x02000000;
memory_space->install_device(get_bar_address, get_bar_address | 0xffff, *this, &virge_pci_device::mmio_map);
}
}

if (BIT(command, 0))
io_space->install_device(0x03b0, 0x03df, *this, &virge_pci_device::legacy_io_map);
}

void virge_pci_device::device_add_mconfig(machine_config &config)
Expand Down
2 changes: 1 addition & 1 deletion src/devices/video/pc_vga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ void vga_device::sequencer_map(address_map &map)
vga.sequencer.char_sel.A = (((data & 0xc) >> 2)<<1) | ((data & 0x20) >> 5);
vga.sequencer.char_sel.B = (((data & 0x3) >> 0)<<1) | ((data & 0x10) >> 4);
if(data)
popmessage("Char SEL checker, contact MAMEdev (%02x %02x)\n",vga.sequencer.char_sel.A,vga.sequencer.char_sel.B);
popmessage("Char SEL checker (%02x %02x)\n",vga.sequencer.char_sel.A,vga.sequencer.char_sel.B);
})
);
// Sequencer Memory Mode Register
Expand Down
Loading