wwmm / easyeffects

Limiter, compressor, convolver, equalizer and auto volume and many other plugins for PipeWire applications
GNU General Public License v3.0
6.61k stars 270 forks source link

Opening EasyEffects window leaves program running in background on nvidia dGPU even after exiting; leaving dGPU in D0 state #3476

Closed cowboy36289 closed 2 weeks ago

cowboy36289 commented 3 weeks ago

EasyEffects Version 7.1.8

What package are you using? Arch repo

Distribution EndeavourOS (KDE Plasma 6 + Wayland)

Describe the bug I'm running a notebook using hybrid graphics (AMD integrated [Radeon 680M] + nvidia discrete [3070 Ti Laptop]) with EndeavourOS (KDE Plasma 6 + Wayland) and noticed EasyEffects loaded and running in the background in nvidia-smi even after closing the GUi window. Seems to have started since a couple months ago when I see my system temperature and power draw being slightly elevated than normal if I had just EasyEffects running as a background service without opening the GUI window.

Currently on nvidia 560.35.03, and my dGPU is set to Runtime D3 mode (basically on sleep; video mem off). When EasyEffects GUI window is opened (and even after exiting), dGPU is left in D0 mode (fully active) and does not return to D3cold sleep state.

I had to add EasyEffects as a custom service and restarting via /usr/bin/easyeffects --gapplication-service to get it off the nvidia GPU's process list and see the dGPU return to D3cold sleep state.

Expected Behavior

wwmm commented 3 weeks ago

Process should be cleared from dGPU process list after exiting GUI window, and dGPU returns to D3cold sleep state after exiting

EasyEffects is a gui app that pretends to be a service. It just hides the window when running in the background. So it is normal that its process will be shown in the GPU processes list. But it should not be actually using it while the window is hidden. It is what I see on nvtop on my AMD cards. EasyEffects is in the list. But the amount of GPU processing power used is zero.

GUI window should be rendered using iGPU

This is definitely something that is in gtk4 hands. It is not something that an ordinary gtk4 app is supposed to handle in its code. The toolkit is the one doing the lower level stuff. EasyEffects does not even know if gtk is using OpenGL or vulkan while its process is running.

cowboy36289 commented 2 weeks ago

EasyEffects is a gui app that pretends to be a service. It just hides the window when running in the background. So it is normal that its process will be shown in the GPU processes list. But it should not be actually using it while the window is hidden. It is what I see on nvtop on my AMD cards. EasyEffects is in the list. But the amount of GPU processing power used is zero.

I understand. I do have xorg on the process list and it indeed is just there and not actually utilising my dGPU for anything. Neither is easyeffects.

However, after opening easyeffects GUI, it stays on that list like the xorg process, but keeps the dGPU "awake" and prevents it from going back to sleep. That is unexpected and did not occur in versions prior. I can't specify the version number though, since it was months ago when I first noticed this issue.

To clarify: dGPU is at 0% usage for everything, but somehow kept at D0 state and prevented from transitioning to D3cold.

Perhaps there is some kind of command or log I can run/collect regarding this?

violetmage commented 2 weeks ago

This sounds like something changed in one of the underlying system components (gtk, compositor, or gpu driver), easyeffects doesn't have any code that interacts with the GPU directly.

Perhaps you can try the flatpak version and see if it behaves as you expect; if so, then we can be sure that the change was in a system library from arch.

cowboy36289 commented 2 weeks ago

This sounds like something changed in one of the underlying system components (gtk, compositor, or gpu driver), easyeffects doesn't have any code that interacts with the GPU directly.

Perhaps you can try the flatpak version and see if it behaves as you expect; if so, then we can be sure that the change was in a system library from arch.

Just installed and tested with the Flatpak version (7.1.9)

All is good. Works as expected; not even showing on nvidia-smi process list while GUI window is open, dGPU still asleep on D3cold throughout.

Also noticed that the fonts look properly rendered, unlike on native install where they look really nasty and jagged.

wwmm commented 2 weeks ago

Just installed and tested with the Flatpak version (7.1.9)

All is good. Works as expected; not even showing on nvidia-smi process list while GUI window is open, dGPU still asleep on D3cold throughout.

Also noticed that the fonts look properly rendered, unlike on native install where they look really nasty and jagged.

I wonder if you are seeing a minor side effect of gtk's move from opengl to vulkan like it happened to #3402. Kill EasyEffects and run it as GSK_RENDERER=gl easyeffects to force the opengl backend. Maybe something changes.

cowboy36289 commented 2 weeks ago

I wonder if you are seeing a minor side effect of gtk's move from opengl to vulkan like it happened to #3402. Kill EasyEffects and run is as GSK_RENDERER=gl easyeffects to force the opengl backend. Maybe something changes.

Yup, seems to be the case. I ran it the way you specified, and it is working as expected now.

cowboy36289 commented 2 weeks ago

I wonder if you are seeing a minor side effect of gtk's move from opengl to vulkan like it happened to #3402. Kill EasyEffects and run is as GSK_RENDERER=gl easyeffects to force the opengl backend. Maybe something changes.

Addendum: It reverts to the issue if easyeffects is run as a background service beforehand. Launch service at system startup - ON

I had to disable that option first, then create my own service to add in that environment variable. Then opening the GUI window would bring the expected result.

Is there a proper way to make sure the env var isn't bypassed if that Service option is activated, other than my own workaround?

wwmm commented 2 weeks ago

Is there a proper way to make sure the env var isn't bypassed if that Service option is activated, other than my own workaround?

It should be fine to put it inside /etc/environment. After a reboot any gtk app should see the definition of the environmental variable.

cowboy36289 commented 2 weeks ago

Is there a proper way to make sure the env var isn't bypassed if that Service option is activated, other than my own workaround?

It should be fine to put it inside /etc/environment. After a reboot any gtk app should see the definition of the environmental variable.

Great! I was intending to apply it to only easyeffects, but I guess this env var is okay to set global for now. Thanks!

wwmm commented 2 weeks ago

I was intending to apply it to only easyeffects, but I guess this env var is okay to set global for now. Thanks!

Until they fix the issues in the vulkan backend it is probably better to force opengl for all gtk apps. If I remember well EasyEffects is not the only one affected. It depends on what the app does and also on the GPU driver. Things are fine on my Radeon but for some Intel users gtk4 apps are crashing when the vulkan backend is used.

In any case I think we can close this issue.