virglrenderer for 3d support

Might be dumb but cant seem to edit the old post anymore... It's needed an update since qemu got bumped to 11.

So this works with some issues

This works better on the "unstable" distros. Currently using debian forky with this and it's the best out of the ubuntu/debian combinations I tried. Still has compatibility issues here and there, but seems to be more an issue of everything else catching up.

Screen Sharing Notes:
Sunshine's new vulkan_encode path does work for native_context. You will need to compile it from scratch, may need to add your distro to the compilation script, in my case I was running a frankendebian sid/trixie mix. The main problem you will run into is that the DRM plane modifiers are missing, and the driver expects them which will give you a very messed up image. Adding AMD_DEBUG=nodcc,notiling into your /etc/environment will fix this but it comes with a performance hit I'm sure.

Virglrenderer (host):
This needs to be built as well. I recommend doing it first as it does impact the pve-qemu build later.
I had weird issues with proxmox favoring the apt version so here are my steps
  1. sudo apt build-dep virglrenderer
  2. sudo apt-get source virglrenderer
  3. cd into the folder it extracted
  4. open debian/rules and add -Ddrm-renderers=amdgpu-experimental, -Dunstable-apis=true , -Dvideo=true , and -Dvenus=true to the configure-opts variable. (not sure if you need the last 3 tbh but it works so I'm not touching it)
  5. go back to the root folder and run dpkg-buildpackage -us -uc -b
  6. Now run sudo dpkg -i *.deb
1773448196169.png



PVE-QEMU:
Steps to get it working:
patch isn't needed, Qemu will pick up on the experimental virglrenderer features and work automatically.
  1. apt-get source pve-qemu
  2. Build with make deb
  3. Just install the new pve-qemu with sudo dpkg -i ./*.deb
Mesa (guest):
Mesa also isn't configured to support this so we will manually build off the apt source similar to virglrenderer.
  1. sudo apt build-dep mesa
  2. sudo apt-get source mesa
  3. cd into the folder
  4. Open debian/rules and near the end you have a giant block of "confflags". Add -Dvideo-codecs=all -Damdgpu-virtio=true \ to any line of it, I'll include a picture below of how it should look roughly.
  5. go back to the root of mesa and run dpkg-buildpackage -us -uc -b
  6. Now run sudo dpkg -i *.deb on the folder with the deb packages
  7. If it complains about missing packages just run apt --fix-broken install it should grab any it missed originally.
1773448113189.png


If dpkg -i ./*.debisn't working I used apt reinstall ./*.deb instead to ensure it was replacing the packages correctly but I don't think it's necessary.

QEMU Config:
You can somewhat just follow the normal instructions here.
I use this though args: -device virtio-gpu-gl,blob=on,drm_native_context=on,hostmem=8G -display egl-headless,rendernode=/dev/dri/renderD128 -object memory-backend-memfd,id=mem1,size=16G -machine memory-backend=mem1

Make sure that the size=x command matches the ram of the VM. The hostmem is just the "bar"/"aperture" size between the host/guest. Keep it between 256MB and 8GB I think it can have issues outside of that.

Misc Notes:
You will also need to be running kernel 6.14+ on the guest.

Also apt will attempt to update these packages at some point, so keep that in mind. Running something like apt mark hold "packagenamehere" is a temporary solution without breaking the whole proxmox dependency chain.
 
  • Like
Reactions: SInisterPisces