vchlum / hue-lights

Gnome Shell extension for Philips Hue compatible lights controlled by the Philips Hue Bridge and for controlling Philips Hue HDMI sync box.
https://extensions.gnome.org/extension/3737/hue-lights/
MIT License
183 stars 14 forks source link

Lagging desktop when using entertainment area sync #44

Open Ex0danify opened 2 years ago

Ex0danify commented 2 years ago

Hey there,

When I start using the LightSync for entertainment areas on my Linux desktop, the whole system gets very choppy/laggy.

MySetup:

Here is the Debug Log. For the log I started LightSync, moved some windows around and the stopped it again. If you need further information, please tell me.

Thanks for your great contribution

Cheers Ex0

vchlum commented 2 years ago

Hi @Ex0danify How many lights are in your entertainment group? Are there any gradient lights? In my experience, 10 lights (including one gradient light strip) work fine on the less powerful computer...

Ex0danify commented 2 years ago

Hey @vchlum, thanks for your quick response!

sorry I forgot to mention my entertainment area in my specs, my bad. I'm currently using 6 Play Bars with my entertainment group. I also did some testing, based on your request, here are the results:

I recorded two videos, so you can see what i mean with lag. If sync is off, everything is smooth, when running sync, it looks like there are a few frames skipped, when moving a window. Link to videos

If you need more, please ask

vchlum commented 2 years ago

Thank you for the details... I will test pop_os in my virtual box but as far as I know, a lot of users use Ubuntu without reporting this issue. Ubuntu is also part of my common testbed.

The sync screen feature gets a few pixels from screenshots for each light in the entertainment group. I am surprised the poor performance does not depend on the number of lights in your entertainment group. My suspicion is on the Nvidia driver in combination with the gnome-shell-based function 'get screenshot'. Not sure yet ...of course.

I will test pop_os and circle back.

Ex0danify commented 2 years ago

Thanks a lot man, highly appreciated!

vchlum commented 2 years ago

In my virtual box instance of pop_os, the issue is not recognizable. Could you please run the top command and check the difference with and without syncing? Please, try to identify what is utilizing your machine.

Ex0danify commented 2 years ago

Thanks for coming back at be @vchlum.

I tried moving a few windows with SyncOff and SyncOn. The process that seems to hog up resources is /usr/bin/gnome-shell When sync is on it sits at around 35%CPU, when sync is off it is around 2%CPU (That's without moving anything)

vchlum commented 2 years ago

This is actually expected. gnome-shell is the right process. I was curious if there is anything else related.

My gnome-shell process keeps it around 20-25%, and it goes to 10% sometimes. My machine is i7, intel xe, 16GB RAM. Definitely less powerful.

Could you please try to decrease the intensity of synchronization to the lowest value? It should decrease the utilization. I checked again on my bare metal and with high intensity, the lagging is noticeable too. Usually, I use middle intensity.

I will definitely look into optimization, but it uses a gnome-based feature to get color from the screen. I am not sure how to optimize it yet.

If decreasing intensity will relieve your issue, I can change the scale of intensity to allow a lower value. This would be one solution. I believe.

Ex0danify commented 2 years ago

Indeed, lowering the sensitivity makes the lag less noticeable, though it doesn't vanish completely.

vchlum commented 2 years ago

OK, you can set the default intensity to a lower value in the settings. I will try to optimize it, or I will decrease the lowest possible intensity.