RayeR wrote on 2024-07-05, 20:52:
Thanks for explanation. But why drivers for PCI card and vbios doesn't work while trio64v+ pci drivers and vbios works without modding?
Madao wrote on 2024-07-06, 05:49:Trio64V+ driver uses IO-Address and oldMMIO (this mode is aviable on PCI and VLB)
Virge Win9x driver uses also newMMIO (only PCI) , it doesn't work on VLB.
The point of "old MMIO" is that it makes the chip independent of I/O cycles, which can increase performance and allows easier integration in systems that do not support a dedicated I/O space. "old MMIO" has been introduced quite early in the S3 accelerator series. As it uses The address range A0000-AFFFF, it perfectly works on ISA cards, even if there is no address hole for high addresses, like you would need for an LFB. The first S3 chips were similar to the 8514/A: In "accelerator mode", the video memory is owned by the acceleration engine instead of the host bus. You can not directly access the video RAM on a S3 911 or 928 while the accelerator is enabled. If software wants to read or write video memory directly, it would need to turn off the acceleration engine, access video memory, and turn on the acceleration engine again. The design of the MMIO engine (which was not yet present in the 911) aims to make direct framebuffer access unimportant, by providing equal performance to a video drive if using MMIO. This includes a way of performing bulk video memory writes using "REP MOVSD" instead of "REP OUTSD". For this to work, the "video data exchange port", which is on a single I/O port on the 8514/A (and has been widedened to 32-bit by S3) is mapped into 32K of memory (A0000-A7FFF), so a read or write to any address in this 32K region is treated like an access to the video data exchange port.
Later S3 cards (don't ask me exactly, which ones, likely around the 964) did away with the limitation that you can't access a linear framebuffer while the accelerator is enabled, yet you need to ensure the accelerator is idle when you access the framebuffer. This way of operation uses the framebuffer as "linear framebuffer" into high memory, and keeps the A0000-A7FFF range used for MMIO. This mode obviously only works if the system supports providing access to a linear framebuffer, which is for example an issue in ISA systems with sufficient RAM. Also, most VLB-enabled S3 chips (maybe even all?) do not decode all 30 address lines (A2..A31) to reduce the pin count, but needs some external decoders. The consequence is that enabling LFB on those cards does not just require knowledge about the S3 chip itself, but also about external decoding logic. A well-made VL card with LFB support has a BIOS that already programs the LFB base address in the S3 chip (which always specifies all address bits A16..A31) to a range that is compatible with the hardware address decoder, and a driver should default to use the address already set by the BIOS. That's where S3VBE20 fails: It does not trust the BIOS of a VLB card to set up a valid base address, and insists on setting its own address.
With the Trio, S3 introduced a new "Trio MMIO" variant of "old MMIO". As the Trio is new enough to support MMIO and frame buffer access enabled at the same time, and not all system configurations allow a linear frame buffer, the Trio variant of "old MMIO" moved the command registers from A8000..AFFFF to B8000..BFFFF (the classic CGA memory range), abolished the memory transfer area at A0000..A7FFFF, and instead enabled a 64K framebuffer windows at A0000..AFFFF.
Up to then, MMIO registers are only accessible in the legacy VGA address space. You can't run a system with two S3 chips or an S3 chips and a second VGA-type graphics card, unless you do address remapping in glue logic. In the classic PC architecture, this was not percieved as an issue, as "the one and only non-MDA card" does not just occupy B8000..BFFFF, possibly A0000..AFFFF, but also the video BIOS at C00000, and the VGA I/O space at 3C0..3CF and the CGA I/O space at 3D0..3DF. With the advent of PCI and automatic resource configuration, as well as monitors getting cheap enough that multi-monitor setups started getting affordable and operating systems that supported multi-monitor setup, things changed. And this is when the classic S3 MMIO was renamed to "old MMIO", and a new MMIO mode was introduced with the Trio64V+: While you still can't move the classic VGA resources of the Trio64V+ or ViRGE, you can have them disabled. The card does not respond with framebuffer cycles in the A0000..BFFFF range while the LFB is enabled. Furthermore, the card does not respond with MMIO cycles in that address range, unless "old MMIO" (either the classic old MMIO or the Trio old MMIO) is enabled. So as long as you enable the LFB, disable old MMIO and disable I/O address response, the Trio64V+ and later chips can be operated in a "legacy free" mode, as any "well-behaved" PCI device should do anyway.
The key point of new MMIO is that the MMIO range is located next to the linear frame buffer in "high address space". To be exact, in new MMIO mode, the linear framebuffer is at the base address configured by the PCI BIOS, and the MMIO range is 16MB into that range. Everything that can be performed using classic I/O cycles can also be performed using MMIO cycles in the "new MMIO" range. This mode is the only mode supported by typical ViRGE software, and it is meant to simplify things: It allows coexistence with any kind of other graphics card (possibly you need to interact with I/O space once during boot to set up new MMIO), and it maps both the complete framebuffer and the MMIO space directly into processor-addressable memory. There is one key issue with new MMIO though: On the Trio64V+ and the ViRGE, the S3 chip only gets the address pins A2..A22, allowing a windows of 8MB! As the ViRGE only supports 2MB of video memory in VL configurations, this is not an issue for the LFB size. But as "new MMIO" is supposed to be located at "LFB base + 16M", there is no way for the ViRGE to distinguish LFB cycles from new MMIO cycles. The data sheet correctly points out this fact and explains that new MMIO is only available in PCI configurations (which do not use any address pins, as the PCI bus mulitplexes address and data on the same pins). The ViRGE has two input pins called SAUP1 and SAUP2. If exactly one of them is active, it indicates either "the first 8MB of address space" in which the Video BIOS, the I/O space and the classic VGA memory range is located or "the 8MB address space containing the LFB". It's obvious to see how this system supports "old MMIO" by mapping the MMIO into the "the first 8MB" and dedicating "the other 8MB" to the linear framebuffer, but this system obviously does not support "new MMIO".
While you could design a bridge that translates cycles that look like "new MMIO" to the VL bus into cycles that look like "old MMIO" towards the S3 chip, this translation logic will add extra decoding delay and make 0WS operation impossible in most configurations, removing much of the appeal of a ViRGE VL card. Instead of designing your own VL-to-VL bridge for an application like that, it would make more sense to use a VL-to-PCI bridge and run the ViRGE in PCI mode, which is known to be rock solid. A design like that also allows upgrading to a ViRGE/DX for better 3D performance. While this is a pragmatic solution, it is equivalent to just using a mainboard with PCI support and plugging a ViRGE PCI card into it. ViRGE PCI cards are abundant, and PCI-based 486 mainboards are also easily obtainable, so designing a roll-your-own VL-to-PCI implementation seems currently completely unappealing to retro hardware developers.
RayeR wrote on 2024-07-05, 20:52:
As virge lacks 2D accel and rely on 3D that doesn't work it makes it worse performance under windows and other apps that can use 2D accel.
I think you understood the issue correctly, but I will still point out to the public to avoid a common misconception: While the ViRGE no longer has the 8514/A-inspired 2D engine, the ViRGE unified 2D/3D engine is perfectly capable of accelerating 2D graphics in Windows, probably even better than the old Trio engine could do it. The advantage of the ViRGE engine is that it was designed after GDI got the de-facto standard for graphics card interfacing, while the 8514/A predates the dominance of GDI and is tailored towards the needs of AutoCAD in 1987 or around that time. While it is true that S3 added to that interface to make it better fit for GDI drivers, they did not change the core design until the ViRGE. I expect that a S3 911 acceleration driver still works on a Trio64V+ (of course, not exploiting the advanced features added by S3 in the mean time), but it will fail on the ViRGE.
It's not the new ViRGE engine in itself that "doesn't work", but the interface of that engine to the VL bus has design issues that go far beyond "new MMIO is not available in VL mode".