MESA Loader Fails to Open amdgpu, Doesn't Detect /dev/dri/card0

Specs: Ryzen 3960x, Radeon RX 5700, 13.0-RELEASE-p3

Problem is occuring inside jails. When I try to launch a GUI app (Falkon, Blender, etc), the app launches, but with significant lag for moving objects with mouse, videoplayback, and consuming large CPU resources even at idle.
browsing@browsing:~ % falkon
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: MESA-LOADER: failed to open amdgpu (search paths /usr/local/lib/dri)
libGL error: failed to load driver: amdgpu
libGL error: failed to open /dev/dri/card0: No such file or directory
libGL error: failed to load driver: radeonsi
My process thus far
  • Installed card to motherboard, boot, then in both host and jail
    • pkg install drm-kmod
    • pkg install xf86-video-amdgpu-19.1.0_2
    • pkg install clover
  • Delete previous /usr/local/etc/X11/xord.conf.d/xorg.conf
  • sysrc kld_list+=amdgpu
  • Modify /etc/devfs.rules GUI-jail section with
    • add path 'dri*' unhide
    • add path 'dri/card0' unhide
    • add path 'dri/renderD128' unhide
  • service devfs restart
Checks that look good:
  • kldstat shows amdpgu_navi10 drivers loaded
  • startx brings up i3wm normally
  • clinfo shows Radeon RX 5700 under the Clover section
  • start GUI-jail, and from inside the jail under normal user:
    • ls -a /dev/dri shows card0 appearing
    • ls -a /usr/local/lib/dri shows and
However, from inside the jail clinfo does not show the GPU as an available device. And of course the errors I listed above when launching most GUI apps.

I think I followed the wiki and handbook accurately. I'm going to try to nullfs mount the /dev/dri directory to the jail, and maybe try exposing the entire /dev/ directory to the jail (temporarily).

But I'm a bit stuck, not quite sure what else to try. Any other ideas on how to get an AMD GPU to show up inside a jail?
So I modified /etc/devfs.rules temporarily under GUI-jails section with add unhide so that the jail can see literally everything.

This fixed the error messages at the launch of Falkon and Blender, and it looks like video playback and TradingView (for example) have proper playback and response to inputs.

  • Blender is still horribly laggy to the point of unusability
  • clinfo still doesn't show the GPU as an available device
I have tried adding to /etc/devfs.rules the below lines, but I still get the errors unless unhiding everything.
  • add path 'drm*' unhide
  • add path 'drm/*' unhide
Okay, finally, some success ...

You have to unhide the pci device, in addition to dri and drm. Also for anyone reading this after the fact, here's something that drove me nuts regarding devfs.rules that took literally a few hours to figure out ... It's not enough to put add path dri unhide , or even add path 'dri*' unhide ... you have to have both
  • add path dri unhide
  • add path 'dri/*' unhide
Okay but this still doesn't fix the problem of clinfo not showing the GPU as available, and I still have terrible lag on Blender.

If anyone reading this has any thoughts, please let me know.