clapper icon indicating copy to clipboard operation
clapper copied to clipboard

Changing GStreamer priority is needed to prefer VA-API over NVDEC whenever both are available

Open not-a-dev-stein opened this issue 2 years ago • 4 comments

In NVIDIA Optimus laptops (where battery life is needed as much as possible), one aspect that Clapper isn't quite good with its defaults is in its priorities for what GPU to use.

By default it is using NVDEC (at least on my laptop), cranking the dedicated GPU, which in turn tanks the laptop's battery life, which forces me to manually go into the preferences to manually raise the priority for VA-API. Doing that usually gives up to an extra hour and a half of battery life on my laptop on longer viewing sessions.

So is it just an overlooked detail or purposefully the default? And if so, wouldn't it be better to change it?

not-a-dev-stein avatar Jul 14 '22 13:07 not-a-dev-stein

This really depends on user hardware. In NVIDIA Optimus you are gonna get like 4 different HW decoders right now:

  • nvdec
  • nvsldec (new stateless implementation)
  • vaapi (old plugin, scheduled to be deprecated)
  • va (new vaapi implementation)

Which one your HW does best or even works with? I dunno. There were multiple reports from Nvidia users about corrupted/scrambled video image when either VA or VAAPI was ranked higher (and thus used). None of them had issues with Nvidia decoder. So I went with that by default, giving the whole plugin ranking for people to tweak/decide what works best on their systems.

cranking the dedicated GPU, which in turn tanks the laptop's battery life, which forces me to manually go into the preferences to manually raise the priority for VA-API (..) So is it just an overlooked detail or purposefully the default? And if so, wouldn't it be better to change it?

I do not mind changing the default. But it would need more people with different systems to test if old Optimus issues are no longer present (and if they agree with you on this). Ideally I would just go with GStreamer defaults, but that would mean no NVDEC on any system (even non-optimus) as its currently ranked in a way that causes software decoder to be picked.

Rafostar avatar Jul 14 '22 15:07 Rafostar

Can't the app check for either the currently set power-save mode or which GPU it's rendering on? Not sure about the flatpak compatibility of the former but for the latter, i.e. only use nvdec when launched with the discrete GPU? (which should be just a right click away on gnome). Or just a manual toggle for "Enable nvdec" instead of defaulting to it? (while still with a higher rank than software renderer by default)

Beryesa avatar Nov 17 '22 15:11 Beryesa

Can't the app check for either the currently set power-save mode

This would involve a lot of effort, considering there are users requesting for the player to run on Windows or macOS. We should aim to have as many similar features/behavior regardless of the OS.

Or just a manual toggle for "Enable nvdec" instead of defaulting to it

We can consider changing the default, but an additional in-app setting like that will be a no from me. No benefit complicating it further for the user by having multiple settings that do the same thing and this is already customizable via plugin ranking in preferences.

only use nvdec when launched with the discrete GPU? (which should be just a right click away on gnome).

This is an interesting suggestion. Not sure if we can get this info from GStreamer, but this would also avoid copying frame data between GPUs for displaying it by ensuring same GPU does both decoding and rendering. Also, I have no idea how to make this behavior not clash with values set manually in the ranking. Problematic for cases when one GPU can decode more formats then the other.

With all the recent feedback I have been getting, it seems that (for now) having va default and nvsldec below combination would make the most users happy.

Rafostar avatar Nov 17 '22 17:11 Rafostar

I use an environment variable to change this behavior in all GStreamer based apps:

https://github.com/Kimiblock/moeOS.config/blob/8868b49b7955dcfcfb1c563fa44fc3183a978a5e/etc/environment.d/moeOS-GStreamer.conf#L7

We'd better inform the upstream about this situation though...

Kimiblock avatar Apr 16 '24 14:04 Kimiblock