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

VMware SVGA/SVGA II and VBoxVGA emulation #3405

Open
2 tasks done
Torinde opened this issue Apr 10, 2022 · 27 comments
Open
2 tasks done

VMware SVGA/SVGA II and VBoxVGA emulation #3405

Torinde opened this issue Apr 10, 2022 · 27 comments

Comments

@Torinde
Copy link
Contributor

Torinde commented Apr 10, 2022

Code of Conduct & Contributing Guidelines

  • I agree to follow the code of conduct and the contributing guidelines.

Have you checked that no other similar feature request(s) already exists?

  • I have searched and didn't find any similar issues.

Is your feature request related to a problem? Please describe.

No response

What you want

Running up to mid-2000s 3D games under Win98/ME by utilizing the host GPU (#1146).

Describe alternatives you've considered

Multi-core software GPU emulation (#2435), 86box (supports multi-core), Wine, VirtualBox/VMware

Additional context

Resource-demanding games running under Win9x/ME:

The last GPUs having Win9x/ME drivers:

Is it feasible to emulate a Geforce/Radeon 'surface' (doing passthrough to host GPU) good enough for running their original drivers? Are there open-source implementations of the drivers that can be modified or some other patches/mods for Win9x that can help? If not - what else can go beyond the present SVGA/VBE/Voodoo?

The VMware GPU appears to have DX8 hardware acceleration under Win9x [1], may help for the mouse integration as well (#3384) and may be useful for Win3.x as well.

Ideally to be later extended to a virtual DirectX9.0c/OpenGL2.1 Win9x device (pass-through to host to GPU for execution) with the characteristics similar to Geforce 6/Radeon X850 (e.g. "DOSbox-X Guest additions" with multi-monitor, etc.) - maybe emulate (or lift code from, if open source) Virtualbox/VMware GPU pass-through device - and modify the driver from their Guest additions/Tools. Or leverage MESA or WINE/WINED3D - like VirtualBox is using parts of WINE for their GPU pass-through.

For the software emulation (whether single core or multi-core):

  • Documentation to show required hardware with few examples, e.g. "to match Voodoo 5 speed you need at least a Threadripper"
@Torinde Torinde changed the title VMware SVGA and SVGA II emulation VMware SVGA/SVGA II and VBoxVGA emulation Jun 12, 2022
@Torinde
Copy link
Contributor Author

Torinde commented Jun 12, 2022

VirtualBox VBoxVGA emulation may help achieve the same goals? Open source, 2D and 3D acceleration in guest, 3D pass-through for execution on the host (OpenGL and D3D8/9 via translation to OpenGL?)

Besides the Guest Additions 2D/3D drivers for Win2K/XP/Vista, there is video miniport driver made by OS2museum for Win9x and WinNT+

Virtualbox 6.1.x drops support for 3D mode in Win2K/XP/Vista (although 6.1.0_RC1 driver maybe works in Vista), so it it would be good if DOSbox-X is made able of host-executed OpenGL/Direct3D.

@brunocastello
Copy link

the difference between the VMware SVGA cards is that SVGA II has 3D acceleration, but only for XP and later. These do not provide acceleration for Windows 98 afaik.

@Torinde
Copy link
Contributor Author

Torinde commented Jul 18, 2022

the difference between the VMware SVGA cards is that SVGA II has 3D acceleration, but only for XP and later. These do not provide acceleration for Windows 98 afaik.

Per the link above - SVGA II is not for Win98, correct. It works with WinME (due to WDM?). But it's not written if 3D acceleration will ALSO work in WinME or only from WinXP onwards?

@javispedro
Copy link
Contributor

Despite the links above, I don't remember any VMware version ever shipping a 3D acceleration driver for any Windows 9x/ME guest. If they ever shipped one, I have not found it.

@brunocastello
Copy link

the difference between the VMware SVGA cards is that SVGA II has 3D acceleration, but only for XP and later. These do not provide acceleration for Windows 98 afaik.

Per the link above - SVGA II is not for Win98, correct. It works with WinME (due to WDM?). But it's not written if 3D acceleration will ALSO work in WinME or only from WinXP onwards?

For 3D to be enabled in VMware for XP onwards it has to be running VMware Tools with the drivers. The VMware Tools do not have drivers for 3D accel on older Windows.

@Torinde
Copy link
Contributor Author

Torinde commented Jul 19, 2022

Can the VMware XP driver be backported to WinME? Like KernelEx...

Also, as Virtualbox sources are available - can VboxVGA (with 3D acceleration for XP) hardware emulation and driver be integrated into DOSbox-X?

@brunocastello
Copy link

Can the VMware XP driver be backported to WinME? Like KernelEx...

No, because the drivers for Me and XP are made completely different. KernelEx for 98/Me doesnt mean you can install such drivers there.

Also, as Virtualbox sources are available - can VboxVGA (with 3D acceleration for XP) hardware emulation and driver be integrated into DOSbox-X?

John to answer that...

@rderooy
Copy link
Contributor

rderooy commented Aug 20, 2022

There is now a VirtualBox video driver for Windows 95/98/ME
https://www.os2museum.com/wp/windows-9x-video-minidriver-hd

And here is the source code
https://www.os2museum.com/wp/windows-9x-video-minidriver-source-code/

So in theory, if DOSBox-X implemented this, it would be a cool alternative.

The author also seems to be working on Win3.x, 2.x and even 1.0 drivers. And he also has a WinNT 3.1-7.0 driver with source code https://www.os2museum.com/wp/nt-video-miniport-uhd/

@Torinde
Copy link
Contributor Author

Torinde commented Nov 20, 2022

It seems QEMU has equivalent functionality to the above: https://github.com/kjliew/qemu-3dfx/wiki/QEMU-3D-APIs-Pass-Through

@joncampbell123
Copy link
Owner

joncampbell123 commented Nov 27, 2022

I might be able to implement VirtualBox VBoxVGA. A while back I wrote a simple framebuffer driver for the Linux kernel that was able to set up almost any mode desired in both Bochs and VirtualBox, though that code has apparently bitrotted because the Linux kernel has deprecated fbdev for DRM/KMS and the multi-monitor support I had working no longer works in VirtualBox. I know the base API somewhat, so I might be able to do something.

Bochs VBE extensions are accessible through some fixed I/O ports. VBoxVGA last I checked implements the same but extends it with a PCI device for the VGA card and "OMAPI" extensions that become a sort of memory-mapped I/O with the virtual machine host. Meaning that you set up structures in memory and point the virtual machine host at them and the host interacts with them to do what you need it to do. I have some familiarity with the API in other words. Not sure what the other VBox display types use to interact and VirtualBox seems to prefer you no longer use VBoxVGA.

The last I checked with VirtualBox Guest Additions, they only seemed to work with Windows XP and higher, and Windows 2000 if you applied all the service packs. Glad to hear someone made drivers for Windows 9x/ME!

@javispedro
Copy link
Contributor

javispedro commented Nov 27, 2022

Not sure what the other VBox display types use to interact and VirtualBox seems to prefer you no longer use VBoxVGA.

This is because they have replaced VBoxVGA with vmsvga (vmware's version). My guess is this was done because (a) the older approach they used for 3D acceleration (ChromiumGL) was more difficult to secure, and (b) because by using vmsvga they reuse (open source) VMware guest drivers where available, like on Linux.

Under Windows, where there are no OSS VMware guest drivers, the default is now "VBoxSVGA" which is still vmsvga (rather than VBoxVGA) except with the PCI IDs changed, so that the VMware proprietary drivers won't load.
In fact, if I manually select "VMSVGA" as the display type on VirtualBox, then the VMware PCI IDs will be used, and VMware's guest drivers for 9x will actually work, albeit with some severe graphical glitching I have not found the cause for.

VirtualBox ships its own open-source 3D vmsvga/VBoxSVGA drivers for every Windows version starting from Vista. XP is still only using VBoxVGA which means that VBoxVGA support will likely stay in VirtualBox for years to come (and without 3D).

The os2museum's drivers are all based on VBoxVGA, not vmsvga. So you'll get arbitrary guest resolutions, but no acceleration (2D or 3D) whatsoever. Which means that depending on how much 2D acceleration support was implemented from the s3 cards, this may actually be slightly slower than the s3 driver... not noticeable for a VM, but maybe noticeable under emulation. That said, arbitrary guest resolution for 9x/3.x is very nice to have...

 

This also doesn't get anywhere closer to D3D acceleration. The probably easiest way to get to D3D acceleration on 9x is to "simply" forward OpenGL calls from the guest to the host and then to replace the 9x D3D libraries with WineD3D, even if this may lead to compatibility issues. This is what VirtualBox used to do before 6.1 (aka ChromiumGL), this is what https://github.com/kjliew/qemu-3dfx seems to be doing (alongside its patched qemu which does passthrough of OpenGL calls in a different way).

In fact, what about 3Dfx cards? I'm not very familiar with these, but from what I can tell, DOSBox-X can already emulate a Voodoo. Can't you use the official Voodoo drivers to get some D3D support (seems that up to D3D 6.x at least) ?

 

To recap:

Display adapter Hosts which support 2D drivers for 9x (D)3D drivers for 9x
VBoxVGA VirtualBox only Free: https://www.os2museum.com/wp/windows-9x-video-minidriver-hd NA
VMsvga/VBoxSVGA VirtualBox >= 6.1, Vmware, Qemu Free: None so far?
Closed: VMware guest tools for 9x
None
S3_* Many: Dosbox, VirtualPC, PCem, etc. Actual S3 drivers NA
3Dfx_* Dosbox-x, PCem, qemu with patch NA Actual 3Dfx drivers?
"OpenGL passthrough" VirtualBox < 6.1, qemu with patch NA https://github.com/kjliew/qemu-3dfx

@Torinde
Copy link
Contributor Author

Torinde commented Nov 28, 2022

VirtualBox also has multi-monitor support - maybe part of the VGA+Hercules setup can be extended towards that?

@MrPepka
Copy link

MrPepka commented Nov 30, 2022

To be honest, I was interested in this topic (i.e. is there a virtual graphics card that would allow you to run drivers for old GeForce or Radeon cards), but there is nothing like that. I know that QEMU has a VirGL virtual graphics card, the concept of which is based on Mesa3D, but the drivers for it are only for Linux, there are no such drivers for Windows (writing a paravirtualized device for Windows is not that easy, after all, Windows is closed source like not looking)

@Torinde
Copy link
Contributor Author

Torinde commented Dec 1, 2022

@MrPepka VirtualBox is (mostly) open source and supports host-accelerated 3D on Windows host. You can find many similar links in Virtualbox documentation and forums. From the changelogs and online help I gather:

  • Windows host VirtualBox 6.0 supports Direct3D8/9 via VBoxVGA in Win2K/XP and upwards guests.
  • Windows host VirtualBox 6.1 supports Direct3D8/9 via VBoxSVGA/VMware SVGA II in Win7 and upwards guests.
  • Windows host VirtualBox 7.0 supports Direct3D8/9/10/11 via VBoxSVGA/VMware SVGA II in Win7 and upwards guests.

Both QEMU and host-3D patched QEMU-3dfx work on Windows hosts.

From what others wrote above - it seems all ingredients are present and open source... only a skilled cook is needed to combine them?

@kjliew
Copy link

kjliew commented Dec 1, 2022

In fact, what about 3Dfx cards? I'm not very familiar with these, but from what I can tell, DOSBox-X can already emulate a Voodoo. Can't you use the official Voodoo drivers to get some D3D support (seems that up to D3D 6.x at least) ?

Yes, you can.
https://www.youtube.com/watch?v=XtPswCplKRk
https://www.youtube.com/watch?v=_uskTrQwZmE
https://www.vogons.org/viewtopic.php?p=348274#p348274

But DOSBox also suffers severe deficiencies in CPU/FPU emulation. Such won't matter for DOS games but they amplify when moving into Windows games. In fact, DOSBox HLE approach in emulation takes many shortcuts that make it very fast for DOS games with superb audio emulation. And in many occasions, *significantly better & faster* than "the other camp" "freaking fast" 3Dfx re-compiler for Windows games that can live with those deficiencies. It does not make a whole lot of sense for any features aiming at improving Windows games without addressing those deficiencies in CPU/FPU emulation.

From what others wrote above - it seems all ingredients are present and open source... only a skilled cook is needed to combine them?

And... make sure that skilled cook won't turn to the DARK side.🤣

@MrPepka
Copy link

MrPepka commented Dec 1, 2022

@MrPepka VirtualBox is (mostly) open source and supports host-accelerated 3D on Windows host. You can find many similar links in Virtualbox documentation and forums. From the changelogs and online help I gather:

  • Windows host VirtualBox 6.0 supports Direct3D8/9 via VBoxVGA in Win2K/XP and upwards guests.
  • Windows host VirtualBox 6.1 supports Direct3D8/9 via VBoxSVGA/VMware SVGA II in Win7 and upwards guests.
  • Windows host VirtualBox 7.0 supports Direct3D8/9/10/11 via VBoxSVGA/VMware SVGA II in Win7 and upwards guests.

Both QEMU and host-3D patched QEMU-3dfx work on Windows hosts.

From what others wrote above - it seems all ingredients are present and open source... only a skilled cook is needed to combine them?

I was referring to this part in the first post:
"Is it feasible to emulate a Geforce/Radeon 'surface' (doing passthrough to host GPU) good enough for running their original drivers? Are there open-source implementations of the drivers that can be modified or some other patches/mods for Win9x that can help? If not - what else can go beyond the present SVGA/VBE/Voodoo?"
Generally, I was more interested in the ability to run the original GeForce and Radeon drivers and their emulation

@rderooy
Copy link
Contributor

rderooy commented Dec 1, 2022

You can forget about that. Any reasonably modern video card from either AMD or NVidia is not going to be backward compatible with a card meant for use with Win9x. A whole lot of research and software emulation would be required, as you would need to fully emulate the legacy video card.

The only other option for something like this would require:

  • a legacy PCI video card (which has Win9x drivers) plugged into the host somehow (possibly using a PCI to PCIe bridge device)
  • A monitor connected to the legacy PCI video card
  • no video drivers loaded on the host for the legacy PCI video card
  • PCI pass-through support in DOSBox-X, as you would find in something like KVM, VMware or VirtualBox.

This, in theory, would allow you to get video from a legacy ATi, Matrox or NVidia video card. But it would first require someone to actually write PCI pass-through support for DOSBox-X. There have been a few requests over the years for USB pass-through, and that also has (so far) not been done.

@MrPepka
Copy link

MrPepka commented Dec 1, 2022

For NVIDIA cards, the Nouveau drivers could not help us? Maybe some of the features from NVIDIA cards could be emulated based on them? Or maybe there are some other modified drivers for NVIDIA GeForce and ATI Radeon cards that we could use to emulate drivers for these cards (or whole cards if possible)?

@rderooy
Copy link
Contributor

rderooy commented Dec 2, 2022

For emulating NVidia cards specifically, yes, the Nouveau drivers could help to understand how drivers interact with a Riva TNT or TNT2 card. But I'm sure quite a bit more time and research would be needed using a real adapter.

@Torinde
Copy link
Contributor Author

Torinde commented Aug 14, 2023

Two recent developments, closely related to the above:

So, there are the following drivers

Would be great if DOSbox-X gets support for that.

@justvlade
Copy link

Here is an interesting VirtualBox Virtual Machine. Someone was able to get 3d acceleration in Windows 98 on VirtualBox with VMSVGA adapter. I do not know where he got that driver, but in system it is said as "VMWare SVGA-II PCI Adapter". You can download vm from links in the description. I checked that on VirtualBox 7.10 under Linux Mint 21, and it worked, DX7, DX8 and DX9. He created a base configuration for "unknown linux" with 3d accelerated VMSVGA adapter.

https://www.youtube.com/watch?v=qEoIUiZ0pY8

Hope this information can be of any help.

@CE1CECL
Copy link

CE1CECL commented Aug 31, 2023

Two recent developments, closely related to the above:

* [Win9x SoftGPU 3D driver](https://github.com/JHRobotics/softgpu) @JHRobotics

* [Virtio GPU 3D acceleration for windows](https://github.com/virtio-win/kvm-guest-drivers-windows/pull/943) @max8rr8

So, there are the following drivers

* Win1.x-Win3.x https://www.os2museum.com/wp/antique-display-driving/

* Win9x 2D https://www.os2museum.com/wp/windows-9x-video-minidriver-hd

* Win9x 2D+3D https://github.com/JHRobotics/softgpu

* WinNT-Win7 2D https://www.os2museum.com/wp/nt-video-miniport-uhd/

* Win2K/XP 3D none yet [XP support JHRobotics/softgpu#12](https://github.com/JHRobotics/softgpu/issues/12)

* Vista/7 2D https://github.com/CE1CECL/qemu-vmvga @CE1CECL

* Win8 - ?

* Win8.1+ 2D+3D [[viogpu3d] Virtio GPU 3D acceleration for windows virtio-win/kvm-guest-drivers-windows#943](https://github.com/virtio-win/kvm-guest-drivers-windows/pull/943)

Would be great if DOSbox-X gets support for that.

ReactOS: https://github.com/reactos/reactos/tree/master/win32ss/drivers/miniport/vmx_svga

@Torinde
Copy link
Contributor Author

Torinde commented Aug 31, 2023

This ReactOS miniport driver seems to be for "VMWARE SVGA-II", so theoretically it can have 3D host acceleration? But I'm not sure that's implemented already inside it.

@rderooy
Copy link
Contributor

rderooy commented Aug 31, 2023

This one has so-far not been released in source or binary form:

@Torinde
Copy link
Contributor Author

Torinde commented Sep 1, 2023

Another Virtio-vgpu driver, Win10: https://github.com/tenclass/mvisor-win-vgpu-driver

@Torinde
Copy link
Contributor Author

Torinde commented Sep 4, 2023

@JHRobotics shares his thoughts at JHRobotics/softgpu#22 (comment) - SoftGPU current implementation relies on high CPU performance in the guest, so it may be too slow in emulators (vs hypervisors, #1089). Still worth to try.

Also, another implementation can be written, which shifts the computation to the host and which guest driver uses minimal resources. He'll try to contribute some code (per my understanding, after DOSBox implementation begins to take shape), is here somebody who wants to work on that?

@Torinde
Copy link
Contributor Author

Torinde commented Apr 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants