Run Windows inside a virtual machine on Linux for gaming

14,028

Solution 1

VMs, by definition, cannot use the actual graphics hardware. It's being used by the host so the guest can't use it too. That's just how it works. You can get better performance by installing the DirectX additions though.

You will need to install DirectX as an add-on for VirtualBox for it to work, but it does work.

To install DirectX, you need to boot the guest into safe mode. Boot your Windows VM into safe mode and go to VBoxGuest additions. Install the Direct3D additions. It has to be done in safe mode or it won't work.

https://www.dedoimedo.com/computers/virtualbox-3-directx.html

Solution 2

Install the VirtualBox Guest Additions on Windows, and enable "Display → 3D Acceleration" in the virtual machine properties.

Solution 3

You can actually pass through the graphics card to a windows guest, but you have to use something like Xen 4. The biggest caveats to this setup are that you need some patience and knowledge of hardware and linux, and the host OS cannot use the graphics card at the same time as the guests. Generally speaking, you need either scripts to manage moving your card from guest to host and back, or you just pipe it to the guest and access the host through ssh/cygwin X forwarding, etc. Not for the feint of heart, but shouldn't be more than a weekend project for an experienced tech. I have multiple graphics cards passed through to different guests using Xen 4 on top of Fedora, and it really wasn't that bad. Recompiling the kernel to add vt-d support was the thing that took the longest amount of time, but if you're comfortable recompiling your kernel, you should be able to get it to work.

The information out there about requiring FLReset/Function-level reset is old and bogus; neither of my devices have it and they work fine.

Share:
14,028

Related videos on Youtube

Yogesh Dube
Author by

Yogesh Dube

Updated on September 18, 2022

Comments

  • Yogesh Dube
    Yogesh Dube over 1 year

    Since making the full time move to using Linux (Fedora) from Windows, I've found the migration fairly easy and haven't had much disruption in how I do my work.

    However, there are some games I like to play such as Football Manager and some older games which rely on 3D rendering (either software or hardware). At the moment I have a VirtualBox VM running Windows XP and 95% of the games I've installed on this have failed to run due to problems with the graphics card (the virtual graphics card).

    What I would like to do is get the VM to use the laptop's actual physical graphics card directly, or something similar. I know there is a performance issue, but most of the games I play are over 5 years old and I'm not bothered about graphic quality etc. I just want it to work.

    I don't have to use VirtualBox, I just used it because I'm used to it. If VMWare or another virtual technology is a better option than VirtualBox then I will use it.

    • user1984103
      user1984103 over 11 years
      Have you tried wine? It's a compatibility later designed to run Windows applications directly on Linux (not through an emulator/VM), and actually can get 3D games running pretty well. It can be tricky to get working, and may not work at all, but will probably give you the best 3D performance of all your options if you can get it working.
    • Simon
      Simon over 11 years
      You may find the first part of this youtube video of interest concerning Linux Gaming being faster than Windows youtube.com/… and also this youtube.com/watch?v=Vtroqq5J-sQ
    • user
      user over 9 years
  • Jackson
    Jackson over 11 years
    Which sometimes works and sometimes doesn't, but definitely better than without.
  • BroScience
    BroScience over 11 years
    it actually has to be done in safe mode or it doesnt work at all.
  • Yogesh Dube
    Yogesh Dube over 11 years
    I did think that regarding the graphics card. But the 3D support option you suggest has worked! I can now play Football Manager :). Thank you!!!
  • Timothy Baldridge
    Timothy Baldridge over 11 years
    "by definition cannot use the actual graphics hardware". That's not really true. All it requires is a shim driver. Such drivers exist on MAC for both Fusion and Parallels. In addition, almost every major VM distributor also includes shim drivers for networking, disk access, etc.
  • Fake Name
    Fake Name over 11 years
    Furthermore, if you have two GPUs, and a CPU and motherboard that support something like intel's VT-D, you can directly pass one of the GPUs to the VM, making it perform as if it has a dedicated GPU.
  • Ravindra Bawane
    Ravindra Bawane almost 7 years
    @TimothyBaldridge, that's "Mac". "MAC" is an acronym for Media Access Control, the hardware address of a network device. "Mac" is short for "Macintosh" and refers to Apple Computer products.