Kwin_wayland always used Nvidia dGPU instead of Intel iGPU. `KWIN_DRM_DEVICES` not working

For some reason, kwin_wayland default to RTX dGPU on my laptop. Would this drain more battery than using iGPU? Which is better?

But anyways, I tried using KWIN_DRM_DEVICES, but it doesn’t seem to work? These are what I do:

~
❯ cat /sys/class/drm/card0/device/vendor
cat: /sys/class/drm/card0/device/vendor: No such file or directory

~
❯ cat /sys/class/drm/card*/device/vendor
0x10de
0x8086

~
❯ ls -l /dev/dri/by-path/
lrwxrwxrwx - root 19 Jun 00:09  pci-0000:00:02.0-card -> ../card2
lrwxrwxrwx - root 19 Jun 00:09  pci-0000:00:02.0-render -> ../renderD129
lrwxrwxrwx - root 19 Jun 00:09  pci-0000:01:00.0-card -> ../card1
lrwxrwxrwx - root 19 Jun 00:09  pci-0000:01:00.0-render -> ../renderD128

It seems like 0x10de is card1 (RTX dGPU) and 0x8086 is card2 (Intel iGPU).

I created ~/.config/plasma-workspace/env/kwin_gpu.sh based on Environment Variables · Wiki · Plasma / KWin · GitLab

#!/bin/bash
export KWIN_DRM_DEVICES=/dev/dri/card2:/dev/dri/card1

Then chmod +x kwin_gpu.sh. Rebooted my laptop, System Monitor still says it’s using dGPU. I changed it to this:

#!/bin/sh
export KWIN_DRM_DEVICES="/dev/dri/by-path/pci-0000\:00\:02.0-card:/dev/dri/by-path/pci-0000\:01\:00.0-card"

Rebooted my laptop. Still doesn’t work, and now I’m stuck with it using dGPU instead of iGPU for some reason.

Maybe you are missing some Intel graphics files?

Back when I was on Manjaro Linux, I kept getting served NVIDIA stuff when I actually only need Intel. The way I dealt with it was to run Octopi, and browse for all of the Intel graphics and selectively install things that seemed needed, and delete the NVIDIA stuff. It was risky but it worked.

I’m not very knowledgeable about this stuff, but you could maybe try a similar approach. Even if you don’t install and don’t delete anything, Octopi is helpful for reading the info/description about each file whether installed or not.

Also, you can do a keyword search on pacman using:

  • sudo pacman -Ss keyword

So you could do

  • sudo pacman -Ss Intel

to find out about any Intel files available.
Pacman will indicate of anything in the results in installed with the word “installed” at the end of the item.

Taken a step further, you can also use “| grep” to search for installed files. For example…

  • sudo pacman -Ss Intel | grep “installed”

I hope this makes sense.
Sorry I can’t be more helpful on this topic.

Hi!

By any chance were you able to fix this? I just realised the exact same thing is happening to me, when I did a quick check of nvidia-smi. Kwin_wayland is using my nvidia dgpu instead of my igpu.

I vaguely remember having a similar issue with Gnome when I was using Nobara but I forget the solution I used. Not sure if would be something similar here.

Edit - Found a solution -