virglrenderer for 3d support

SMG-Proxmox

New Member
Dec 9, 2019
1
0
1
58
I am trying to setup a VM to do game development. How do I install the virglrenderer package to use the VirGL is a driver that allows creating a virtual GPU within Virtual Machines that leverages host’s GPU without the need for passing it through (VFIO)

Thanks
Keith
 
yeah we would have to enable opengl and virgl support on our qemu builds, which we currently dont.. last time i tried it it was not very stable and did not work properly over the network (e.g. spice and vnc),
so not really usable in our standard deployment...

edit:

ok, so i just now tested it again, it "works" but i had many serious problems with it: crashes (with such simple things as changing the guest resolution), high cpu load (probably due to vnc encoding), weird vm behaviour, etc.
so.. not really usable at the moment

also i do not know if it would have been relevant for you, but there are currently no windows drivers...
 
Last edited:
yeah we would have to enable opengl and virgl support on our qemu builds, which we currently dont.. last time i tried it it was not very stable and did not work properly over the network (e.g. spice and vnc),
so not really usable in our standard deployment...

edit:

ok, so i just now tested it again, it "works" but i had many serious problems with it: crashes (with such simple things as changing the guest resolution), high cpu load (probably due to vnc encoding), weird vm behaviour, etc.
so.. not really usable at the moment

also i do not know if it would have been relevant for you, but there are currently no windows drivers...

Is it possible to get the steps to do this? I'm interested to try it and don't mind some crashing. :)
 
Is it possible to get the steps to do this? I'm interested to try it and don't mind some crashing. :)
well its basically editing the debian/rules file and
add the relevant configure flags
(e.g. --enable-virglrenderer)

then do a 'make deb' and it will complain about missing dependencies (which you have to install)

when its built, install the resulting debian files

to enable those features you have to start qemu manually though (or use the args config)
 
  • Like
Reactions: djx
well its basically editing the debian/rules file and
add the relevant configure flags
(e.g. --enable-virglrenderer)

then do a 'make deb' and it will complain about missing dependencies (which you have to install)

when its built, install the resulting debian files

to enable those features you have to start qemu manually though (or use the args config)
Thanks - but that's a bit out of my depth at this point. I look forward to when this is offered as an option to enable :).
 
well its basically editing the debian/rules file and
add the relevant configure flags
(e.g. --enable-virglrenderer)

then do a 'make deb' and it will complain about missing dependencies (which you have to install)

when its built, install the resulting debian files

to enable those features you have to start qemu manually though (or use the args config)
I'm actually giving it a try, so far cloned qemu-server from pve source git and modified debian/rules:

never used dh, so looking at the docs i guessed that it shoud look like this:

Code:
%:
        dh $@
override_dh_auto_configure:
        dh_auto_configure -- --enable-sdl --with-sdlabi=2.0 --enable-opengl --enable-virglrenderer

then 'make deb' and installed the resulting .deb with gdebi.

in the vm config added:
Code:
args: -display sdl,gl=on -device virtio-vga,virgl=on


when firing the vm I'm getting an error:
Code:
kvm: -display sdl,gl=on: SDL display supported is not available in this binary
TASK ERROR: start failed: QEMU exited with code 1


Guess that I havent figured the right way to add the parameters in the debian/rules and support is not being built.


I know there's movement around this in these days, (https://bugzilla.proxmox.com/show_bug.cgi?id=3849). I just wanna peek into it meanwhile :)

Regards!
 
Last edited:
  • Like
Reactions: jebbam
never used dh, so looking at the docs i guessed that it shoud look like this:

Code:
%:
dh $@
override_dh_auto_configure:
dh_auto_configure -- --enable-sdl --with-sdlabi=2.0 --enable-opengl --enable-virglrenderer
Normally yes, but as we already override that target you need to adapt the existing one.

Something like (note, the SDL part can be optional depending on your requirements, see below):

Diff:
diff --git a/debian/rules b/debian/rules            
index 0417703..b3872df 100755                        
--- a/debian/rules                                  
+++ b/debian/rules                                  
@@ -58,7 +58,7 @@ ${BUILDDIR}/config.status: configure
        --disable-guest-agent-msi \                  
        --disable-libnfs \                          
        --disable-libxml2 \                          
-       --disable-sdl \                              
+       --enable-sdl \                              
        --disable-smartcard \                        
        --disable-strip \                            
        --disable-xen \                              
@@ -77,6 +77,8 @@ ${BUILDDIR}/config.status: configure
        --enable-usb-redir \                        
        --enable-virtfs \                            
        --enable-virtiofsd \                        
+       --enable-opengl \                            
+       --enable-virglrenderer \                    
        --enable-xfsctl                              
                                                     
 build: build-stamp

in the vm config added:
Code:
args: -display sdl,gl=on -device virtio-vga,virgl=on
Can you rather try -display egl-headless,gl=core, that way it works with the noVNC (and spice) viewers and would not require SDL at all for the build, albeit internal tests seem to suggest that the SDL mode is more performant.
 
  • Like
Reactions: jebbam and mapache
Thanks for the tips! I'll try egl-headless when got the support compiled.


Something like (note, the SDL part can be optional depending on your requirements, see below):
Looking at the diff seems like I'm using a different version of the debian/rules, the one int the git repo is very short:

Code:
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
    dh $@


where I can find the one with the target override?
 
My bad! I was trying to modify qemu-server from pve repo instead of pve-qemu.
Came back to it some days ago and managed to compile pve-qemu with
Code:
--enable-sdl --enable-virglrenderer --enable-opengl
without problem.

Now I can fire vms with
Code:
args: -display egl-headless,gl=core -device virtio-vga-gl
and it will boot and and show some lines on dmesg regarding virtio_gpu:

Code:
[    0.474289] efifb: probing for efifb
[    0.474314] efifb: showing boot graphics
[    0.475611] efifb: framebuffer at 0xc0000000, using 3072k, total 3072k
[    0.475613] efifb: mode is 1024x768x32, linelength=4096, pages=1
[    0.475614] efifb: scrolling: redraw
[    0.475614] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[    0.475670] fbcon: Deferring console take-over
[    0.475670] fb0: EFI VGA frame buffer device
[.........]
[    2.241020] [drm] pci: virtio-vga detected at 0000:00:02.0
[    2.241027] checking generic (c0000000 300000) vs hw (f0000000 800000)
[    2.241029] checking generic (c0000000 300000) vs hw (44800100000 4000)
[    2.241030] checking generic (c0000000 300000) vs hw (f1a4d000 1000)
[    2.241129] [drm] features: +virgl +edid -resource_blob -host_visible
[    2.241600] [drm] number of scanouts: 1
[    2.241604] [drm] number of cap sets: 2
[    2.246535] [drm] cap set 0: id 1, max-version 1, max-size 308
[    2.246596] [drm] cap set 1: id 2, max-version 2, max-size 688
[    2.247092] [drm] Initialized virtio_gpu 0.1.0 0 for virtio0 on minor 0
[    2.248414] checking generic (c0000000 300000) vs hw (0 0)
[    2.248469] virtio_gpu virtio0: [drm] fb1: virtio_gpudrmfb frame buffer device
[    2.250691] checking generic (c0000000 300000) vs hw (c0000000 20000000)
[    2.250696] fb0: switching to qxl from EFI VGA
[    2.250787] Console: switching to colour dummy device 80x25
[    2.250802] qxl 0000:00:01.0: vgaarb: deactivate vga console
[    2.250847] [drm] Device Version 0.0
[    2.250848] [drm] Compression level 0 log level 0
[    2.250849] [drm] 98302 io pages at offset 0x8000000
[    2.250850] [drm] 134217728 byte draw area at offset 0x0
[    2.250851] [drm] RAM header offset: 0x1fffe000
[    2.250864] [drm] qxl: 128M of VRAM memory size
[    2.250865] [drm] qxl: 511M of IO pages memory ready (VRAM domain)
[    2.250866] [drm] qxl: 256M of Surface memory size
[    2.253255] [drm] slot 0 (main): base 0xc0000000, size 0x1fffe000
[    2.253366] [drm] slot 1 (surfaces): base 0xe0000000, size 0x10000000
[    2.255281] pstore: Using crash dump compression: deflate
[    2.255287] pstore: Registered efi as persistent store backend
[    2.256390] [drm] Initialized qxl 0.1.0 20120117 for 0000:00:01.0 on minor 1
[    2.256929] fbcon: qxldrmfb (fb0) is primary device
[    2.256967] Console: switching to colour frame buffer device 128x48
[    2.256983] qxl 0000:00:01.0: [drm] fb0: qxldrmfb frame buffer device

Maybe i'm still missing something as I see no noticeable increase of desktop performance, unity hasn't enabled acceleration and youtube is still choppy.
 
  • Like
Reactions: jebbam
Maybe i'm still missing something as I see no noticeable increase of desktop performance, unity hasn't enabled acceleration and youtube is still choppy.
What's the guest OS? You'll need one with the newest mesa version possible.
Also note that currently there's much development going on in this area, IMO it should start to work much better once that work (e.g., in virgl library, kernel/mesa support) gets released more widely, which can be still a few months to even years though (PVE 8.0 stuff, if I had to guess).
 
What's the guest OS? You'll need one with the newest mesa version possible.
Also note that currently there's much development going on in this area, IMO it should start to work much better once that work (e.g., in virgl library, kernel/mesa support) gets released more widely, which can be still a few months to even years though (PVE 8.0 stuff, if I had to guess).
I have my expectations tamed, virgl is going slow and getting some feature like that into production would take extensive testing and validation. If it would come with pve 8 i would be more than happy. Meanwhile I would love to have accelerated linux vms, so I'm up for the challenge of recompiling qemu every now and then.

As guests I'm trying ubuntu 20.04, 21.10 and manjaro, I think the acceleration is not being completely enabled when I start the vm via proxmox gui as glxinfo on the guest shows llvmpipe as opengl renderer.

VM config:
Code:
agent: 1,fstrim_cloned_disks=1
args: -display egl-headless,gl=core -device virtio-vga-gl
audio0: device=intel-hda,driver=spice
balloon: 4096
bios: ovmf
boot: order=scsi0
cores: 8
cpu: host
cpuunits: 4096
efidisk0: local-zfs:vm-1011050-disk-0,size=1M
hotplug: disk,network,usb,memory,cpu
machine: q35
memory: 8192
name: test
net0: virtio=FA:BA:DA:DB:D5:BC,bridge=vmbr0,firewall=1,queues=2
numa: 1
ostype: l26
protection: 1
scsi0: local-zfs:vm-1011050-disk-1,discard=on,size=100G,ssd=1
scsihw: virtio-scsi-pci
smbios1: uuid=xxxxxxxxxxxxxxxxxxxxxxxx
sockets: 1
spice_enhancements: foldersharing=1
startup: order=2,down=60
usb0: spice,usb3=1
usb1: spice,usb3=1
usb2: spice,usb3=1
vga: qxl,memory=128
vmgenid: xxxxxxxxxxxxxxxxxxx


It might be just an invocation problem(ej. something missing in the args: ) as the underlying systems seems to work, installed desktop on that machine and I can start a vm manually with
Code:
sudo qemu-system-x86_64 -name ubuntu20.10 -drive file=/var/lib/libvirt/images/ubuntu20.10.qcow2 -m 5G -enable-kvm -M q35 -cpu host -smp 6,sockets=1,cores=6,threads=1 -display sdl,gl=on -device virtio-vga-gl
it works with acceleration, gnome enables effects and glxinfo shows virgl as renderer.

Actually it has an acceptable performance(for everyday's tasks) with the nvidia proprietary driver on the host, I'm getting 80fps on phoronix opengl test,same test in the host will achieve ~260 fps. Wanna try egl-headless via commandline too, but first I need to setup some remote access or spice in that vm.


Bests,
Javi
 
Last edited by a moderator:
Hi @mapache , I found about this thread today and am following super tightly, as I'm the one logging in bugzilla #3849.

In order to start the VM with args: -display egl-headless,gl=core -device virtio-vga-gl do you need to 1st compile pve-qemu with --enable-sdl --enable-virglrenderer --enable-opengl ?
Any way to start the VM with some config without compiling anything? I don't mind compiling, just that I'd like to test quickly, but if it is required to compiled 1st then I'll do it.
 
  • Like
Reactions: jebbam
What does this commit mean, that instead of compiling pve-qemu with the diff, the source will already be available with the diff included and we will only need to compile it (no diff required)?
Yeah if you clone from latest master it'll have all relevant flags already enabled, so you'd only need to build the source as is then, alternatively one can also wait out a few weeks until we make our next qemu package bump and get it already enabled automatically.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!