| Summary: | KWin switches the discrete GPU on every time a new Wayland window is opened in a switchable graphics setup | ||
|---|---|---|---|
| Product: | [Plasma] kwin | Reporter: | Prajna Sariputra <putr4.s> |
| Component: | platform-drm | Assignee: | KWin default assignee <kwin-bugs-null> |
| Status: | RESOLVED UPSTREAM | ||
| Severity: | normal | CC: | nate, xaver.hugl |
| Priority: | NOR | Keywords: | wayland-only |
| Version First Reported In: | 5.25.5 | ||
| Target Milestone: | --- | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Prajna Sariputra
2022-09-24 15:45:45 UTC
After further investigation it appears that it is just about anything that wants an EGL context that triggers the issue rather than anything Wayland related, since `eglinfo` also turns on the dGPU, and GTK3 apps (like `gtk3-demo`) don't touch the dGPU at all unless I try the OpenGL example in it (which I guess is why I never noticed the issue when I was using GNOME, as it was when most apps still use GTK3). So, at this point I'm not sure if I should report this issue elsewhere (Mesa?) or if it is just how EGL is designed and there is no way around it, any advice would be appreciated. KWin doesn't touch a GPU unless it's used for compositing or an output is attached. Most likely, something is probing all the GPUs on application startup (and eglinfo is doing that as well, but there it's intentional), instead of only picking the primary one. Do you have nvidia-utils installed? It caused this behavior for someone else before: https://www.reddit.com/r/kde/comments/u5qtjy/when_using_qt_programs_in_wayland_they_have_to/ (In reply to Zamundaaa from comment #2) > KWin doesn't touch a GPU unless it's used for compositing or an output is > attached. Most likely, something is probing all the GPUs on application > startup (and eglinfo is doing that as well, but there it's intentional), > instead of only picking the primary one. > Do you have nvidia-utils installed? It caused this behavior for someone else > before: > https://www.reddit.com/r/kde/comments/u5qtjy/ > when_using_qt_programs_in_wayland_they_have_to/ Ah, yes I do have nvidia-utils installed, however in my case I do actually need it there (occasionally if I need to use the dGPU properly I will switch to a Plasma X11 session running on said dGPU plus the proprietary driver, used to use bbswitch instead of nouveau for but that causes other issues I need to work around). Fortunately, it appears that the thing with `/usr/bin/nvidia-modprobe` in that post is just a symptom, the true cause is that libglvnd when using EGL will load all installed ICDs[1], including the NVIDIA one in my case, which is what was poking the dGPU. So, aside from just getting rid of nvidia-utils another way to solve the issue is to set the `__EGL_VENDOR_LIBRARY_FILENAMES` environment variable to only have the Mesa ICD like so: `__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json`. Anyway, thanks for pointing me in the right direction! Also, I am setting the resolution to "not a bug" since it's clearly not a KDE issue, but maybe "upstream" could be a better fit since it's the proprietary driver messing about when it shouldn't? [1]: https://gitlab.freedesktop.org/glvnd/libglvnd/-/blob/master/src/EGL/icd_enumeration.md |