How to switch primary gpu for wayland

Hi
I have a laptop with both, NVIDIA GPU and Intel UHD graphics.
My fedora uses by default Intl UHD

[~ (0) ]$ glxinfo | egrep "OpenGL vendor|OpenGL renderer"
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics (CML GT2)

ATM I try to dbbug why Unity 3d doesn’t work on my machine.
I want to make my laptop use dedicated NVIDIA driver (and gpu).
I found some documents about this in google, but they are for X11, and I’m using gnome on wayland.

Fedora does not include the driver by default, but instead the opensource nouveau drivers.

Those are not comparable in speed and hardware utilization, but more trustworthy and integrated.

The NVIDIA drivers are on rpmfusion.org so add their repos and search for tutorials online.

The easiest way to use NVIDIA on Fedora (or Linux in general) is by using an atomic variant. The drivers often break as they are not tested with the many use cases that can happen. On an atomic system you can just reset to the last working version and wait a bit longer with the update.

Fedora cannot include the proprietary NVIDIA drivers in their atomic variants too for legal reasons. The project uBlue fixes that.

So I highly recommend you to try ublue silberblue-nvidia.

If you really want to do it on traditional Fedora Workstation:

  • add rpmfusion
  • install drivers
  • blacklist nouveau drivers with kargs

Here is how ublue does it but read below how to do with dnf

Most of those commands with rpmostree are likely not to work with a system. using dnf.
The instructions at rpmfusion are really clear and easy to follow instead.

After enabling the rpmfusion repo the only command needed for dnf is
sudo dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda which handles everything needed for the nvidia drivers on more than 95% of all user systems that are not rpm-ostree based for package management.

While I realize that you probably use one of the atomic versions, the great majority of users here do not and instructions like that can become very confusing especially to new users.

2 Likes

I’m Ssorry, I think I forgot to highlight that I’ve already installed an official NVIDIA driver from their official website (by .run file, not rpmfusion because rpmfusion version didn’t work for me).
Thte thing is, how to make my laptop prefer nvidia gpu over intel uhd?

You could blocklist the iGPU

sudo cat > /etc/modprobe.d/blocklist-intelgpu.conf <<EOF
blacklist i915
EOF

After a reboot you will either have no GPU or the NVIDIA one

And installing stuff through .run files is really really bad and can likely break your system, at least when an upgrade comes.

thank you for your rply!

You could blocklist the iGPU

thats a very strange solution, but it might work :smile: I’ll try that!

After a reboot you will either have no GPU or the NVIDIA one

just in case, what will happen if the first option happens? :smile: Will I be able to revert this anyhow?

And installing stuff through .run files is really really bad and can likely break your system, at least when an upgrade comes.

I suppose that but rpmfusion didn’t wokr for me at all - it caused more problems than nouveau. I will update carefully and maybe will work…

Just go to TTY and remove that file.

Also the system should be able to use software rendering as a fallback.

What problems did rpmfusion cause?

What problems did rpmfusion cause?

iirc, it caused issues with my dual-monitor setup (I hope I fixed that by adding nvidia_drm.modeset=1 to kernel commandline) but it also caused some random freezes while startup and running my system.

I tried that but it didn’t do anything

[~ (0) ]$ glxinfo | grep -e OpenGL.vendor -e OpenGL.renderer
OpenGL vendor string: Intel
OpenGL renderer string: Mesa Intel(R) UHD Graphics (CML GT2)

What is this i915 in your example? how can I find it?

To utilize a dedicated GPU for specific applications, you can set environment variables as follows:

 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only glxinfo | egrep "OpenGL vendor|OpenGL renderer"

To force your laptop to exclusively use the dedicated GPU, you can follow the method described in this post: Fedora 36: Nvidia as Primary GPU.

I’ve tried this out on KDE, and it worked fine for me. However, I haven’t given it a go on GNOME yet.

i915 is the driver used for almost every intel GPU.
You can see it in several ways.
Some examples are inxi -Gxx, lspci -nnk | grep -iA5 vga, lsmod | grep i915 and others.

that worked, thank you!

1 Like

Did you try the udev rules file? After adding it on my laptop with Intel and Nvidia gpus I can’t see the system login page. I can still login by entering password but the page itself is blank.

sorry for confusion. I meant I was able to use these env variables mentioned by @ali-a .
I didn’t try disabling intel apu because, in fact I want it. I just had to run a single application (in my case Unity) on GPU because else it didn’t work correctly.

Thanks. The env variable worked for me as well, though I still need to figure out how to make Docker use Nvidia. The udev rules didn’t work out.

This is a different questions and there are solutions for this in the forums, but if you need help please create another thread and we can assist you better.

1 Like

I have a Dual-Grafics laptop from Acer, with a Intel and Nvidia Graficcard..
imho should we have for all Peeep’s a extra Admin Gui-grafics-Program (AGGP’h *g*) where check the Graficscard"'s", if 2 Graficscard, then let see if the 2nd or first a Nvidia or an AMD,
then if once of them a $xcard, install the nvidia-drivers or the amd drivers properly,
the next step, customice the Wayland server to this way which the Primary and the Secundary
Card with an Button for nvidiasettings or “amdsettings” if some exist ..,

this programm could also very helpful for configuring an Workstation with an Nvidia-Card,
for checking if the first card a Nvidia and enabling at the same step the Repos from the nvidia-drivers, also by the Laptop .. and install the nvidia-drivers properly..

i guess, all the Nvidia and AMD-Users there oudside would welcome some Installer/Configurations gui for all Computers of the world for the Wayland..

if there others extra Graficsdrivers could these also check and install extra Grafics/gpu-Drivers if avail ..
For have a really nice way for configuring the orginal-drivers for the GPU/Graficscard in Wayland.

Well, i am not a Programmer, but this could really be a Issues for the C-Programmers and javaprogrammers for KDE/Plasma and Gnome or others Surface, or an intepended Programm wheres easy runs on Wayland (and maybe in prompt) for configuring the Multicraficscards in a Laptop and a Graficscard for a Workstation in easy way with an Gui without any without any prior knowledge as Admin, just Start the “Graficsetup” in prompt and it starts as Gui or in promptgui for “let config” the system for the right gpu-drivers from the Manufacturer and as Config-gui for use/select the head GPU with the possibility for change and use less energy for batterie.

would nice, if there outside a Programmer where build up some handy Program
for let display in Wayland and in prompt.

best regards
Blacky