How to use OpenGL/3D acceleration in virt-manager with ubuntu?
I also faced the same problem while working on software based Hardware Acceleration as specified by: http://ryan.himmelwright.net/post/virtio-3d-vms/ . I tinkered around a little bit and found simple a solution which worked for me. But I cannot guarantee that it will work for you too:
I assume you have changed the 'Model' from 'QXL' to 'Virtio' and enabled '3D Acceleration' in 'Video Device' section along with the settings you specified above. I also assume the renderer that you have selected in the 'OpenGL' dropdown is your Dedicated GPU.
Now, just close your virt-manager instance and restart it from terminal by appending DRI_PRIME=1
before it i.e. run DRI_PRIME=1 virt-manager
in terminal. Now start your VM. Initially, I saw some screen glitches, but after the login screen was opened, the things ran smoothly. I monitored my AMD DGPU usage through radeontop
and it was running fine.
Note:
-
The same solution worked with VirtualBox when it was not using my DGPU even with 3D Acceleration enabled. I also noticed that the 3D Acceleration was more stable in VirtualBox compared to Virt-manager.
-
Even after successfully enabling 3D acceleration, you will not get full GPU performance and will probably run into driver issues at various places. You would probably want to use your GPU directly into VM through GPU pass-through to overcome these problems.
Edit 1:
After more fiddling with the VM hardware acceleration, I found that there is one more step that needs to be done to run the VM with the DGPU. We need to first increase the VRAM to atleast 512MB in the 'QXL Model' of the 'Video Device' section, click 'Apply', change the 'Model' from 'QXL' to 'Virtio' with '3D Acceleration' enabled, and then run the virt-manager with DRI_PRIME=1
.
When I tried this, Manjaro was running fine, but the performance of Windows 10 VM was very choppy.
Related videos on Youtube
Guerlando OCs
Updated on September 18, 2022Comments
-
Guerlando OCs over 1 year
Currently on Ubuntu 20.04 both as host and guest, I followed http://ryan.himmelwright.net/post/virtio-3d-vms/ and activated 3D acceleration on video, and OpenGL on dsplay, but on VM launch I get
SPICE GL support is local only for now and incompatible with -spice port/tls-port
How can I make it work?
UPDATE:
I disabled Listen Type to None
but I get a very glitchy image:
-
Guerlando OCs over 2 yearsI have no glitches but I still get the video in just 1/4 of the screen