luisbocanegra / plasma-smart-video-wallpaper-reborn

Smart Video Wallpaper for KDE Plasma 6
https://store.kde.org/p/2139746
GNU General Public License v2.0
45 stars 1 forks source link

GPU usage 2-3x more than playing back videos directly #18

Open TheOverpassArsonist opened 2 months ago

TheOverpassArsonist commented 2 months ago

On an nvidia 3080 with the latest packages from the arch repos and two 1080p displays I'm getting 2-3x higher GPU usage playing videos as my desktop than I am if I play the videos in full screen in a seperate player like Haruna.

With no active videos playing and my cursor still I rest at ~0% GPU usage. (which makes sense as literally nothing is actually happening on screen) With this video playing in full screen in Haruna using the nvdec hardware decoder I rest at about 10% With that video playing as my desktop background I rest at about 30%. With that video playing as both of my desktop backgrounds it fluctuates a lot more, but tends to sit around 45-50% (with it playing on both monitors fullscreen in Haruna it's around 20%)

I've tested with several videos and it is consistently around 2-3x more resource intensive to run them as my background than play them directly, and I'm not sure why that is. I'd wager that the reason that two videos isn't quite 2x as intensive is that my monitors don't refresh at the same rate. My left monitor is 120hz and my right monitor is 75hz. Notably though, those differing refresh rates don't effect Haruna which does simply double to 20% usage, so I'm guessing part of the resource loss has something to do with the monitor refresh rate, with higher refresh rates requiring more resources to play the same video.

On the matter of performance there are two additional notes that I wanted to add but felt way too minor to be their own things, 1st : would it be possible to 'share' resources between monitors? Maybe I'm wrong (I have very little reference here) but if you're playing the same video on both desktops, it seems like you could just mirror the content for near-free since you only need to decode it once. 2nd : would it be possible to generate basically an LOD version of the video? In other words instead of outright pausing the video instead start playing a lower-resolution version of the video, with the reduced resolution being made up for by the blur-effect. Not sure if that's even a little bit possible to do, but it'd allow the video to play non-stop while using a fraction of the resources. This would keep multi-monitor setups more cleanly in sync. Amazingly the pausing/resuming is basically seamless, but if one display has a fullscreen application which makes the video pause and the other doesn't then they will desync which can be quite noticable depending on the video you use. Additionally an LOD system would probably make translucent windows look nicer, but I don't use any translucent window rules myself so I can't speak for that

luisbocanegra commented 1 month ago

I have seen the increased GPU usage too in both Intel integrated graphics and Nvidia. Not sure if it's just how it is or some configuration can improve this, that needs to be investigated.

On the matter of performance there are two additional notes that I wanted to add but felt way too minor to be their own things, 1st : would it be possible to 'share' resources between monitors? Maybe I'm wrong (I have very little reference here) but if you're playing the same video on both desktops, it seems like you could just mirror the content for near-free since you only need to decode it once. 2nd : would it be possible to generate basically an LOD version of the video? In other words instead of outright pausing the video instead start playing a lower-resolution version of the video, with the reduced resolution being made up for by the blur-effect. Not sure if that's even a little bit possible to do, but it'd allow the video to play non-stop while using a fraction of the resources. This would keep multi-monitor setups more cleanly in sync.

Amazingly the pausing/resuming is basically seamless, but if one display has a fullscreen application which makes the video pause and the other doesn't then they will desync which can be quite noticable depending on the video you use. Additionally an LOD system would probably make translucent windows look nicer, but I don't use any translucent window rules myself so I can't speak for that

Maybe, but that will require adding C++ and knowing about video/graphics and I don't have either. Not sure if the effort would be worth the benefit. wallpaper-engine-kde-plugin supports mpv maybe you could try that to see how it performs

luisbocanegra commented 1 month ago

Hi. Please download the file below and run kpackagetool6 -t Plasma/Wallpaper -u plasma-smart-video-wallpaper-reborn-v0.2.1.zip, reboot/re-login and try with a single video first then multiple while journalctl -f > journal.txt is running.

Let me know if there is any improvement on both 3D and video decoding usage

plasma-smart-video-wallpaper-reborn-v0.2.1.zip

luisbocanegra commented 1 week ago

Moving shared resources topic to https://github.com/luisbocanegra/plasma-smart-video-wallpaper-reborn/issues/23

luisbocanegra commented 3 days ago

The GPU usage should be fixed in the latest release https://github.com/luisbocanegra/plasma-smart-video-wallpaper-reborn/releases/tag/v0.4.0

When blur is not showing, the usage should now be more or less the same as mpv --profile=fast video.mp4