Snaps don't detect NVIDIA driver in Wayland

Oops, sorry, all the talk about the nvidia-graphics and other graphics snaps that are not really related, along with the steam discussions kind of got me off track… indeed the thread is originally for Firefox… sorry for the confusion…

Though I guess we need to make more clear that things like nvidia-core22 are not really for general consumption (not even sure what happens if you install this snap on non UbuntuCore systems which it is designed for)

In general classic snaps gain access to host drivers and libraries via the hostfs filepaths. Thus for working nvidia gpu, i would first start to ensure that drivers & userspace are correctly installed on the host.

Use gnome-shell search for “Additional Drivers” and install highest support version of nvidia drivers, and reboot.

If that is installed, and you rebooted, most things should start to work correctly out of the box.

Installing nvidia-core22 only makes sense for a few niche snaps that use graphics-core22 interface, most of which are targeting Ubuntu Core only and not classic.

I’m already running the latest stable Nvidia drivers afaik, but ran software-properties-gtk to double check (I’m on kde plasma). Hardware accel does work when running firefox outside snapd cofinement as in MOZ_ENABLE_WAYLAND=1 /snap/firefox/current/usr/lib/firefox/firefox as mentioned earlier.

I’ve proposed PR #13209 to address the PrefersNonDefaultGPU key being filtered out. That doesn’t directly address the Nvidia/Wayland problem though.

I know there’s a few additional components in Nvidia’s Wayland stack compared to Mesa that are probably missing here. In particular, Nvidia’s egl-wayland library:

I’m not sure of the best way to handle this: these are Open Source components built by the distro, so we can’t assume they’ll be compatible with libraries in the sandbox. It might be as simple as including this in the gnome platform snap, and setting an environment variable to point at the egl_external_platform.d configuration file. Or it might require a lot more work than that.

Just updated to Ubuntu 23.10 beta but nothing has changed wrt firefox’s software acceleration. Running the binary manually still results in hardware acceleration working.

Yes, better documentation would be helpful. I might have been misled: Just migrated the freeorion snap to use the graphics-core22 interface as it seemed a good idea that the end user might pull in a different driver to what gets used in the desktop, especially on non-ubuntu systems. So would the advice be to roll back on that or should i advice not to use nvidia-core22 just because one has a nvidia card?

p.s. hey moderators, could you split this out to something like “using the graphics-core22 interface in the desktop”

I can confirm this issue when running steam in a wayland session with nvidia graphics. Note this isn’t the generally recommended setup, Ubuntu defaults to X when using the nvidia driver. However we do need to investigate this bug.

they are two different things …

  • graphics-core22 ships the mesa libs and userspace drivers, you can use it in your snap if you want users to be able to use different (or newer) mesa stacks on a userspace level …

  • nvidia-core22 ships a kernel driver (and probably some libs too hat use this driver) that is related to the pc-kernel snap that runs on UbuntuCore systems

1 Like

I reported the bug against snapd at https://bugs.launchpad.net/snapd/+bug/2037544

1 Like

Ok, let me try to sum up. Those are the only plugs for the interface I know of, so the reason for existence of that interface is to allow e.g. nvidia kiosks or compute applications(?). And in principle one would be able to roll ones own implementation. Simply switching to a newer graphics stack would also be possible by using a content snap (like the gaming-graphics-core22); in both cases the snap needs to explicitly support/import it (either the interface or the specific content snap)

1 Like

Correct

Updating gnome-42-2204 to revision 145 on edge enabled WebRender hardware acceleration in Firefox for me. Thanks!

This has been reverted and we’re back with software rendering in Firefox :crying_cat_face: as of revision 149 of gnome-42-2204.

Yes, that caused a regression. We’re still working on it.

I’ve been sticking to revision 145 of gnome-42-2204 since october when the proposed fix was reverted (I run snap revert gnome-42-2204 whenever a new update is automatically installed), and hardware acceleration in Firefox kept working… until now. Not sure what changed or when exactly, but hardware accel stopped working very recently, even with gnome-42-2204 r145.

Running the firefox binary bypassing snapd still works, as in MOZ_ENABLE_WAYLAND=1 /snap/firefox/current/usr/lib/firefox/firefox.