Not able to use iGPU for rendering Hyprland.
I am not able to use iGPU as the primary renderer for Hyprland, the setup used to work fine before, but doesn't work now (for some reason I wasn't able to debug. I checked the wiki, but that only mentions AQ_DRM_DEVICES which is properly set as I understand. I am Arch.
❯ lspci -d ::03xx
01:00.0 3D controller: NVIDIA Corporation GA107 [GeForce RTX 2050] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] (rev c6)
❯ l /dev/dri/by-path/
Permissions Size User Date Modified Name
lrwxrwxrwx - root 21 May 15:11 pci-0000:01:00.0-card -> ../card0
lrwxrwxrwx - root 21 May 15:11 pci-0000:01:00.0-render -> ../renderD129
lrwxrwxrwx - root 21 May 15:11 pci-0000:05:00.0-card -> ../card1
lrwxrwxrwx - root 21 May 15:11 pci-0000:05:00.0-render -> ../renderD128
❯ cat ~/.config/hypr/nvidia.lua
local env = hl.env
local igpu = true
if not igpu then
-- nvidia mode
env('__GLX_VENDOR_LIBRARY_NAME', 'nvidia')
env('__GL_VRR_ALLOWED', '1')
else
-- igpu mode
env('LIBVA_DRIVER_NAME', 'radeonsi')
env('__GLX_VENDOR_LIBRARY_NAME', 'mesa')
env('AQ_DRM_DEVICES', '/dev/dri/card1:/dev/dri/card0')
end
hl.config {
cursor = {
no_hardware_cursors = true,
},
}
❯ sudo lsof /dev/nvidia*
[sudo] password for sauceguy:
lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
Output information may be incomplete.
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Hyprland 1359 sauceguy 46u CHR 195,255 0t0 879 /dev/nvidiactl
Hyprland 1359 sauceguy 47u CHR 195,0 0t0 881 /dev/nvidia0
Hyprland 1359 sauceguy 48u CHR 195,0 0t0 881 /dev/nvidia0
Hyprland 1359 sauceguy 49u CHR 195,0 0t0 881 /dev/nvidia0
Hyprland 1359 sauceguy 50u CHR 195,255 0t0 879 /dev/nvidiactl
A problem with the previous setup was that if I started any game on the dGPU, then Hyprland too switched to the dGPU, even after closing the game, which inhibited sleep, ate battery, and needed a reboot to fix.
How do I fix this?