Using Kepler Nvidia GPU with Wayland (Sway)Category: Linux
Nvidia dropped support for Kepler GPUs with 470xx series driver. And that driver still doesn't have GBM support, so you can't use modern Wayland compositors without EGL streams support.
I still have a couple of Kepler GPUs that are quite a bit more powerful than my current Radeon RX550, but I can't use them with Sway widndow manager. Nouveau driver makes them perform roughly the same as this AMD GPU, but yet they consume 200+ Watts.
Recently I found an interesting solution to my problem, it's PRIME.
Yes, you still need an Intel or AMD GPU for Wayland, but with PRIME you can utilize the proprietary Nvidia driver to run games under Xwayland. For that you need to install the proprietary Nvidia driver, make it load at boot, add
nvidia-drm.modeset=1 to your kernel cmdline and install the Nvidia GPU into your system. You don't need to connect any monitors to it. After booting back up, you should be able to run sway with
To run an app on the Nvidia GPU, you just add
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia environment variables. This will work for any X11 app, but native Wayland apps will use your primary GPU even with the environment variables.
One issue I ran into is getting this to work with flatpaks. Even if you launch a flatpak app with the variables, there is no Nvidia driver inside the flatpak container. Luckily you can install it as a runtime, just make sure it's the same version as the kernel modules:
You can even use CUDA this way. The only thing missing is nvidia-settings, you won't be able to launch them. Why is that an issue? Because Nvidia doesn't allow you to use nvidia-smi to look at the GPU utilization on consumer GPUs, even thought that data is available in nvidia-settings app.