y4my4my4m / kde-shader-wallpaper

KDE / Plasma - Shader Wallpaper plugin
GNU General Public License v3.0
224 stars 12 forks source link

Possibility to decide which GPU is used #58

Open financelurker opened 3 weeks ago

financelurker commented 3 weeks ago

Hi!

I am using these awesome wallpaper shader - cudos for the implementation.

Since I have two GPUs (one iGPU and one Nvidia) - as of now only the Nvidia GPU is used (where I have a constant 40% of GPU utilization with active wallpaper shaders).

Is it possible, that I can decide which GPU is used for these wallpaper shaders? (I would want to give that task to the iGPU - since it probably won't need that much power and I would expect a lower power consumption)

  1. KDE PLasma 6.0.5
  2. KDE Frameworks: 6.2.0
  3. Qt: 6.7.1
  4. Kernel: 6.9.3-zen1-1-zen (64 bit)
  5. Graphics Platform: Wayland
  6. Graphics Processor: NVIDIA GeForce RTX 4090/PCIe/SSE2
y4my4my4m commented 3 weeks ago

@financelurker Yes, it's possible. I don't know if wayland affects this in anyway, but I remember having tried it before on X11 and it worked. Essentially you need to launch plasmashell using DRI_PRIME=1 plasmashell --replace or __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia plasmashell --replace

https://chatgpt.com/share/c17d5a99-3758-449e-af47-82a2a2c27cb3

Essentially, this isn't a plugin thing but rather you need to launch the plasmashell using your GPU instead of iGPU. There may be a more advanced way to get the shaderengine use a specific GPU, but that would probably require modifying the wallpaper feature of KDE directly.

financelurker commented 3 weeks ago

So, to get that right - I would need to set the whole plasmashell to the iGPU and not just the Wallpaper Shaders? I cannot gasp the impact of that, but I will try it within the next days. Thx for your feedback.

I've stumbled over https://wiki.archlinux.org/title/PRIME - which is roughly describing the DRI_PRIME parameter you mentioned. Is it right to infer, that the Wallpaper Shader are running in the execution context of the plasmashell then and are not a dedicated own binary that can be executed (and therefore the DRI_PRIME param can be set specifically for the Wallpaper Shaders)?

Edit: On the other hand I might as well put the whole plasmashell to the iGPU and have the dGPU resources available for other stuff (if this is a possible solution).

y4my4my4m commented 3 weeks ago

@financelurker As far as I understand it, the whole "desktop" interface of KDE runs on Plasma-Desktop (Which is actually called plasmashell). This does not include all the graphical windows being displayed (that's handled by X11 and Wayland), having plasmashell run on your GPU won't make "dolphin" or "chrome" use your GPU, only the taskbar, KDE menus, etc.

In Plasmashell there is an element called "Desktop" (literally your desktop where the icons are and etc), and within that there is something called a "wallpaper", the wallpaper plugins (images/shaders/etc) are then loaded within that "wallpaper" element.

What my shader wallpaper does is limited in it's ability to go beyond the "wallpaper" element and what's available for it to use.