Is there a virtual machine with direct access to CPU and GPU for gaming?
Sorry for the long question.
With the coming of Steam for Linux I may have been over optimistic and got rid of windows installation. The problem is that I have about 100 Steam games that are not (and may never be) ported to Linux. Anyway I got tired of dual boot, and Wine solutions (wineprefix and playonlinux) don't always work. So I was wondering if there is any solution to use a virtual machine (or something similar) with direct access to hardware spec in order to run windows games in it. (something like what Parallels do on mac). Re-installing windows is not a huge problem but I was hoping to avoid it as I would like use Ubuntu as my everyday OS together with more "difficult" distros..to learn more about Linux.
Edit: Thanks for all your answers: I'll think about the solution you proposed. Honestly to this day I never heard of Xen, so I'll have to read about it...and maybe buy a new graphic card...and a new monitor. I think I'll end up re-installing windows on one of my drives...It's a pity though. thanks again.
Solution 1:
The short answer is: No.
The longer answer is: Not yet...
VBox's 3D support barely counts. It does provide 3D support but absolutely no performance. VMWare seems to perform a lot better (note the benchmark is on a Mac) and that might be playable. The downside here is a large pile of cash (I'm not sure what 3D support is like in their free offerings).
But if you want to take full advantage of your hardware for Windows-only games, there's only one solution and that's to boot into Windows. I'm afraid to say that's likely always going to be the case for that subset of games.
The only other near-acceptable solutions available:
- Fight Wine (when it does work, it tends to work really well)
- Buy a console.
- Lobby the developer for a port.
There are all sorts of server technologies that may filter through in time:
Nvidia+Vmware are working on a multi-head virtualised gaming platform but I honestly don't expect this level of integration to be in consumers' hands for another decade, if not longer. Graphics manufacturers want us to buy dozens and dozens of cards and virtualising hurts that aim.
You could reverse it and have a Windows Server host VM and paravirt a Ubuntu desktop, with shared 3D but again, I'm not sure what the performance would be like. And it's a ton of cash to do legally. The desktop-host isn't as good at all.
Xen won't paravirt a Windows install, so there's no point looking there yet. It does have PCI and VGA passthrough modules but they're locked to one VM so you'd have to have a graphics card for each install. Urgh.
Note I'm really only talking about 3D graphics here because the rest are solved or nearly-solved problems. CPU virtualisation is mature with paravirtualisation and CPU extensions like Intel VT-x and AMD-V. Peripheral passthrough is fairly low bandwidth so is simple to share.
Graphics are lagging because sharing them in the way we're talking about is not a commercial necessity for manufacturers. It does seems to be going that way though (for high-end render farms and server-based workstation consolidation) so watch that space.
Solution 2:
If both your hardware and your software support IOMMU (a.k.a. PCI passthrough, AMD-Vi and Intel VT-d), you can assign assign I/O devices (e.g., the graphics card) to VMs.
On the current versions of Ubuntu, you can use Xen, as long as both your motherboard and your CPU support IOMMU.
I'm currently using a Windows 7 VM with two AMD 7950 GPUs, and it works very well for gaming and Bitcoin/Litecoin mining.
Tutorials, etc.:
- Detailed guide about Xen VGA pass-through
- Full tutorial for building a gaming VM (uses Fedora, not Ubuntu)
- Installing Xen on Ubuntu
- Success story on Super User
- Xen VGA Passthrough Tested Adapters
Note that you can use the GPU on in that VM is you pass it through.