The Struggle to get ANY 3d acceleration in QEMU/KVM... Please Help

I'm REALLY struggling to get 3D acceleration working in QEMU/KVM. I've done a LOT of searching and reading and watching videos, and I feel like I'm close but I just can't get there. After reading through a number of different forums, I feel like I'm not alone so I'll go into some detail in case this thread ends up helping others.

Background
I'm new to Manjaro but not to Linux. I am no expert. I've built Debian boxes for clients that run Windows 7 guests in VirtualBox. I'm coming from using Macs since 2010. I'm currently still using a 2012 Macbook that runs Windows XP, 7, and 10 guests with Parallels at reasonable (not laggy) speeds.

I need to do LOTS of 3D rendering work and my Macbooks aren't going to cut it. So I built a PC.

A friend who loves Blender recommended Manjaro so here I am.

Expectations
I DO NOT expect "bare metal" performance from a Windows 10 guest on my Manjaro box. I mentioned my 2012 Macbook and the Windows VMs because I use them for everyday work and they don't feel laggy at all. I am not doing 3D rendering in Windows 10 but I do need a Windows that isn't laggy. I need 3D graphics to work, at least as well as they do in a Windows VM on my Macbook.

But, I also want to run Windows 10 in a window. I am not interested in passthrough.

System
I just built this system a few weeks ago. Its still running defaults except for enabling virtualization.

System:    Host: pc2019 Kernel: 4.19.49-1-MANJARO x86_64 bits: 64 compiler: gcc v: 8.3.0 
           Desktop: Xfce 4.13.4git-be04da Distro: Manjaro Linux 
Machine:   Type: Desktop Mobo: ASUSTeK model: ROG MAXIMUS XI HERO (WI-FI) v: Rev 1.xx serial: <root required> 
           UEFI: American Megatrends v: 0602 date: 10/19/2018 
Battery:   Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M525 charge: 100% (should be ignored) 
           status: Discharging 
CPU:       Topology: 8-Core model: Intel Core i9-9900KF bits: 64 type: MT MCP arch: Kaby Lake rev: C 
           L2 cache: 16.0 MiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 115232 
           Speed: 800 MHz min/max: 800/5000 MHz Core speeds (MHz): 1: 799 2: 801 3: 800 4: 800 5: 800 6: 800 7: 800 
           8: 800 9: 800 10: 800 11: 800 12: 800 13: 800 14: 800 15: 800 16: 800 
Graphics:  Device-1: NVIDIA TU106 [GeForce RTX 2070] vendor: eVga.com. driver: nvidia v: 430.14 bus ID: 01:00.0 
           Display: x11 server: X.Org 1.20.5 driver: nvidia resolution: 2560x1440~60Hz 
           OpenGL: renderer: GeForce RTX 2070/PCIe/SSE2 v: 4.6.0 NVIDIA 430.14 direct render: Yes 
Audio:     Device-1: Intel Cannon Lake PCH cAVS vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
           Device-2: NVIDIA TU106 High Definition Audio vendor: eVga.com. driver: snd_hda_intel v: kernel 
           bus ID: 01:00.1 
           Sound Server: ALSA v: k4.19.49-1-MANJARO 
Network:   Device-1: Intel Wireless-AC 9560 [Jefferson Peak] driver: iwlwifi v: kernel bus ID: 00:14.3 
           IF: wlo1 state: up mac: <nope> 
           Device-2: Intel Ethernet I219-V vendor: ASUSTeK driver: e1000e v: 3.2.6-k port: efa0 bus ID: 00:1f.6 
           IF: eno2 state: down mac: <nope> 
           IF-ID-1: virbr0 state: down mac: <nope>
           IF-ID-2: virbr0-nic state: down mac: <nope> 
Drives:    Local Storage: total: 4.55 TiB used: 119.83 GiB (2.6%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 970 EVO Plus 1TB size: 931.51 GiB 
           ID-2: /dev/sda vendor: Western Digital model: WD40EFRX-68N32N0 size: 3.64 TiB 
Partition: ID-1: / size: 915.60 GiB used: 119.83 GiB (13.1%) fs: ext4 dev: /dev/nvme0n1p2 
Sensors:   System Temperatures: cpu: 41.0 C mobo: N/A gpu: nvidia temp: 39 C 
           Fan Speeds (RPM): cpu: 0 gpu: nvidia fan: 0% 
Info:      Processes: 315 Uptime: 9m Memory: 62.89 GiB used: 1.24 GiB (2.0%) Init: systemd Compilers: gcc: 8.3.0 
           Shell: bash v: 5.0.7 inxi: 3.0.34

Progress So Far
I've included these things because I've seen MANY other posts on various forums where people were having trouble with one or more of these...

I've enabled virtualization and edited GRUB so now I have:

$ sudo dmesg | grep "Virtualization Technology for Directed I/O"
[    1.452454] DMAR: Intel(R) Virtualization Technology for Directed I/O

I've installed qemu, ovmf, libvirt, spice, virglrenderer, seabios, and a bunch of other programs with their dependencies. I don't think I'm missing any software, although I could be wrong.

I downloaded the VirtIO iso and configured libvirt:

$ vi /etc/libvirt/qemu.conf

nvram = [
	"/usr/share/ovmf/x64/OVMF_CODE.fd:/usr/share/ovmf/x64/OVMF_VARS.fd"
]

$ sudo systemctl stop libvirtd
$ sudo systemctl start libvirtd

$ sudo gpasswd -a design215 libvirt

Now, the UEFI option is not grayed out in the VM setup

I selected QXL for Video

Finally, I created a Windows 10 guest and then installed spice-guest-tools from https://www.spice-space.org/download.html

My Windows 10 guest isn't bad. Its mostly acceptable except there is no 3d support at all and every combination of settings I've tried in Virtual Manager has failed. One of the common messages is:

"spice gl requires virtio graphics configured with accel3d"

On this page: https://wiki.archlinux.org/index.php/QEMU/Guest_graphics_acceleration it says:

"Fully virtualized GPU support via Intel-specific iGVT-g extension
iGVT-g is limited to Intel graphics on recent Intel CPUs"

"Virgil3d virtio-gpu is a paravirtualized 3d accelerated graphics driver, similar to non-graphics virtio drivers (see virtio driver information and virtio Windows guest drivers)." But it appears this is only for Linux guests.

and finally...

"For Windows guests, there is very little information on VirtIO-gpu OpenGL drivers. A project summary, the DOD (Windows kernel) driver and the ICD (Windows userland) driver are available. In addition, see this Phoronix article and its comments."

Some of those links look interesting but I didn't see anything concrete. Am I wrong?

So far I like Manjaro but I'm surprised it was this complicated just to get a Windows 10 VM running.

But HOW do you get 3d acceleration working???

thanks!

I have some PASSMARK test results:

           Macbook*      QEMU/KVM
CPU            3898          5979
2D              533           775
3D             1058           n/a
Memory          761          2648
Disk           6982          6701

Overall        2045          4418

*Macbook Pro, mid 2012, 2.3 GHz Intel Core i7, 8GB 1600 MHz DDR3,
NVIDIA GeForce GT 650M 512 MB
Parallels Desktop 14, Windows 7 Pro, 2GB RAM

So, its already faster than my 7 year old laptop, it just needs 3d graphics support.

I'm actually kind of surprised the CPU score in QEMU isn't faster by 4x.

Still NO 3d acceleration but I made some improvements to my config...

Originally, I had my Windows 10 guest set to use 4 CPUs in the Virtual Machine Manager.

After reading https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#CPU_pinning and doing some tests, I have changed my Windows 10 config to the following:

  <vcpu placement='static'>8</vcpu>
...
  <cpu mode='host-model' check='partial'>
    <model fallback='allow'/>
    <topology sockets='1' cores='4' threads='2'/>
  </cpu>

Here are my updated PASSMARK tests from just now:

           QEMU/KVM
CPU           19372
2D              833
3D              n/a
Memory         2869
Disk           7061

Overall        6324

As you can see, the CPU configuration made a HUGE difference! The Windows interface also feels a bit more snappy. The scores for 2D graphics improved from 775 to 833. Other scores also improved slightly.

I did NOT do any CPU pinning because it doesn't appear to be necessary.

BUT I still want 3d acceleration!! Help??

I've never used QEMU/KVM, so can't help with that specifically. If you aren't using GPU passthrough, have you tried using VirtualBox or VMWare? I had to use VMWare instead of VirtualBox or other way around sometimes when I have issues.

1 Like

I actually have a bit of experience using VirtualBox on Debian (Jessie). Its pretty easy to set up. The problem is, 3d acceleration doesn't work, or is extremely buggy.

There's an issue in VirtualBox, specifically with Windows 10 guests, where the screen will flicker and do weird things if 3d acceleration is enabled. People have spent YEARS fighting with the VirtualBox developers to fix this bug. Here's an example:

https://techblog.devlat.eu/2017/04/07/screen-flickering-in-virtualbox-with-3d-enabled/
scroll through the comments and you'll see what I mean.

I was up all night playing around with different settings and solutions and I DID try the latest version of VirtualBox, 6.0.8, and the 3d bug STILL EXISTS!! (3d acceleration works but Windows is basically unusable because of flickering, invisible ui elements, etc)


As you can see, half of the ui elements either disappear or turn solid black.

Here's my PASSMARK results for VirtualBox, Windows 10 guest with 3d accel enabled:

         VirtualBox
CPU           12261   
2D              785  
3D              838   
Memory         3356   
Disk          14743    

Overall        3880

Both QEMU and VirtualBox are configured with 1600x1200 display resolution. Both are configured with the same number of CPUs. The VirtualBox disk image is .vmdk and the QEMU disk image is .qcow2.

I have not tried VMWare on Manjaro. It was always buggy for me on Debian. Maybe its better now?

I was having issues running Nox Android Emulator in VirtualBox because virtualization wasn't working for the emulator within the VM, so I decided to run it in VMWare and it worked fine.

1 Like

Here's my PASSMARK on my windows 10 vm using Vmware workstation player 15 (installed from AUR)

vmware works fine for me on Manjaro, though it did require me to enable services and reboot after installing. see here VMware Player 14 no internet

Vmware Workstation 15 Player -
16gig ram, 8 cores, 3gig video ram
CPU 13785.7
2D 521.6
3D 2268.4 (this is why I use Vmware)
Memory 1665.4
Disk 7076.6
Overall 3604.8

VMware just stomps when it comes to 3D unless you are doing a passthrough setup.

1 Like

Thanks for the data! That looks pretty amazing. I'll probably download the trial and test it on my system.

But I also feel like I'm so close to having this work with QEMU. I really want to see how far I can go before I spend $249.99 for VMWare. The latest version of Parallels for Mac is only $69.99.

Here's a recap of the PASSMARK numbers so far in this thread:

           QEMU/KVM     VirtualBox        VMWare(1)
CPU           19372          12261         13785
2D              833            785           521
3D              n/a            838(2)       2268
Memory         2869           3356          1665
Disk           7061          14743          7076

Overall        6324           3880          3604

(1) @Xoast's system, not mine
(2) Windows is unusable with 3d acceleration turned on

I don't pay much attention to Passmark's "Overall Score" because it can be very misleading. Reducing those 5 tests to a single number doesn't really tell the story.

So... I'm still looking for HELP getting 3d working in QEMU/KVM!!!

Just as a note.
VMware player is free for non-commercial use, with very few limits (can't run mutipul vm's)
https://www.vmware.com/in/products/player/faqs.html

I use it at home for a bit of fun CAD and to play the few DX10 pc games i cant run under proton/lutris.

1 Like

UPDATE: I finally have 3d graphics working (sorta-kinda)...

Just to be clear, I was unable to run ANY 3d Passmark tests until this point. Here are the situations I've encountered so far:

1 - 2d graphics are good but none of the 3d tests run at all:

  Display
    Type: Spice server
    Listen type: Address
    OpenGL: disabled
  Video
    Model: QXL

2 - ERROR: "SPICE GL support is local-only for now and incompatible with -spice port/tls-port":

  Display
    Type: Spice server
    Listen type: Address
    OpenGL: enabled
    - NVIDIA card selected
  Video
    Model: Virtio
    3D acceleration: enabled

Details: (from the error dialog)

Error starting domain: internal error: qemu unexpectedly closed the monitor: 2019-07-06T05:04:33.630075Z qemu-system-x86_64: SPICE GL support is local-only for now and incompatible with -spice port/tls-port

Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 75, in cb_wrapper
    callback(asyncjob, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/asyncjob.py", line 111, in tmpcb
    callback(*args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/libvirtobject.py", line 66, in newfn
    ret = fn(self, *args, **kwargs)
  File "/usr/share/virt-manager/virtManager/object/domain.py", line 1279, in startup
    self._backend.create()
  File "/usr/lib/python3.7/site-packages/libvirt.py", line 1089, in create
    if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self)
libvirt.libvirtError: internal error: qemu unexpectedly closed the monitor: 2019-07-06T05:04:33.630075Z qemu-system-x86_64: SPICE GL support is local-only for now and incompatible with -spice port/tls-port

3 - A black screen with no mouse in the VM, a Force Stop is necessary:

  Display
    Type: Spice server
    Listen type: None
    OpenGL: enabled
    - NVIDIA card selected
  Video
    Model: Virtio
    3D acceleration: enabled

I just kept trying different combinations of settings, but kept getting one of those three results. I even found a worse combination that forced Windows into 800x600. Then, I found the following:

New Virtual Machine Manager Settings:

  Display
    Type: Spice server
    Listen type: None
    OpenGL: enabled
    - NVIDIA card selected
  Video
    Model: QXL

3d Performance is really bad BUT it works!!

  • Passmark tests for 3d work but the process won't complete to get a score
    • DirectX 9 runs at 4-5 fps, gets a score of 4
    • DirectX 10 runs at 2-3 fps, gets a score of 2
    • DirectX 11 runs at 1-2 fps, gets a score of 1
    • DirectX 12 has a white screen and ends with an "Unexpected error -2003238900"
    • GPU Compute has an error "The specified video adapter does not exist" then the program locks up
  • 2d tests still have the same performance

If I try setting Video Model to Virtio, it crashes and I have to force quit the program to change it back to QXL.

Next I tried editing the XML file for my VM to give the QXL card more memory. I tried larger numbers at first but it wouldn't start. I tried the settings below and it started but did not help the Passmark 3d tests:

    <video>
      <model type='qxl' ram='524288' vram='524288' vgamem='65536' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>

Research:

Here are my latest PASSMARK results:

           QEMU/KVM    VirtualBox
CPU           19271         12277 
2D              833           930 
3D                7           n/a(1)
Memory         2863          3440 
Disk           7957         14778 

Overall        6392          6672 

(1) Windows is unusable with 3d acceleration on, so I turned it off

I just installed the trial version of VMWare Workstation 15 and I created another Windows 10 VM. I have three now, lol. Spoiler alert, the 3d acceleration in VMWare is pretty amazing, just as @Xoast claimed. I have set up all three VMs to be as close as possible- same RAM, same CPUs, etc.

The interface is different in all three, with qemu being the most difficult to configure but also having the most control. VMWare appears to have created their own virtual graphics card with GPU and includes a setting for VRAM. I gave it 3GB which is the maximum.

PASSMARK results:

           QEMU/KVM    VirtualBox        VMWare
CPU           19271         12277         18826
2D              833           930           895
3D                7           n/a          8157
Memory         2863          3440          3305
Disk           7957         14778         10326

Overall        6392          6672          6543

Conclusion

My conclusion so far is that QEMU/KVM can run a perfectly functional Windows 10 VM, if you DON'T NEED 3d graphics acceleration. QEMU got consistently higher CPU scores than VirtualBox and is right on par with VMWare. The 2D graphics tests are a good measure of how "snappy" the interface feels, opening browsers and scrolling documents. Again, the QEMU score is pretty close to the other two, and it isn't enough of a difference that you would notice.

The only thing lacking from QEMU/KVM is 3d acceleration support. VirtualBox almost gets it, but the resulting destruction of the Windows interface make it a deal breaker. I've shown that 3d graphics DO work in QEMU right now without any adverse effects, but they're so slow, you can use them.

I'm still hoping to see someone post a solution here...

I've played around with this in the past, and reached the same point you're at, I'm happy you are reaching similar results to me.

The only way i can see to get it working in QEMU/KVM (in a viable way) is to have 2 GPU's and do pass through to the VM on one of them (leaving the other for your host)
I considered that, but in the end for my handful of DX10 Linux hating games vmware does the job for free, vs a 2nd GPU i don't have (yet)

I just wish Vmware would get DX11+ working. mutters about vermintide 2

Hello there, it's been several months since the last post, has the situation here changed in any way? I'm also curious about virtualizing windows 10 and I was wondering how technologies like virglrenderer perform. Has 3D acceleration in QEMU gotten any easier? And how does sharing the same GPU from the host to guest with virglrenderer perform in comparison to handing out an entire GPU to the host via PCI-passthrough?

I certainly have not looked into it with the depth rob has, but I can say from my end nothing has changed.
For both home and work, I can only use Vmware if I want workable 3D acceleration.

I haven't looked at Virgil 3d in ages, last time i checked it windows guests where on the "future scope" which means it's not an option for me (I vm to run CAD/render software and network management tools)

1 Like

Looking Glass lets you have it in a window.
Not sure if the 9900k still comes with an iGPU, but why not just pass that one through?
Intel HD performance certainly isnt very good, but maybe alot more hassle free than virtgl.

Looking Glass should only work on pci passthrough.

You can try the 3d acceleration provided by VMware. In fact, in the scenario where 3d performance is really needed, the 3d acceleration performance is not enough.

I only used Vmware's 3d acceleration to play some 2d games. To be honest, the fps of those games are only less than ten frames. Is there any improvement now?

I'll give a test run this weekend and report back, its been a while since I gamed in Vmware, as I've mostly moved to proton and lutris (because its one less thing to run)

Bear in mind though my windows vm has 8 cores and 16gig of ram assigned to it so results may vary.
I mostly played blizzard games (diablo 3 and starcraft 2) with it, but both of those are now done via lutris+wine.

Except the CAD software, I'm low on reasons to keep the VM at all at home, which makes me really happy.

Should work fine even with iGPU's.
https://www.reddit.com/r/VFIO/comments/7h1gi4/support_using_host_igpu_for_pci_passthrough/

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by