mpv-player / mpv-build

🔨 Helper scripts to compile mpv on Linux
http://mpv.io
403 stars 104 forks source link

vd-lavc-dr is very slow. #185

Closed tsjnachos117 closed 2 years ago

tsjnachos117 commented 2 years ago

I've noticed that my CPU usage with newer (custom) builds of mpv has been really slow lately. With some decoders, the computer is almost unusable. I narrowed the problem down to the default vd-lavc-dr. Setting this option to "no" brings my CPU back down to something usable. I wonder why this is? I have multiple computers, but only one specific laptop (Dell Latitude e6410) seems to be affected.

PS: Is there a way to disable this system-wide? I know I can change /etc/mpv/mpv.conf, but that doesn't seem to affect Celluloid (which uses libmpv). Perhaps there's some configuration switch I can use when compiling?

OS: Linux Mint 20. CPU: Interl Core i5 M 520 @ 2.40GHz

tsjnachos117 commented 2 years ago

OK, I've just found a good (albiet temporary) workaround: I made a shell script in the source directory called "set_vd_dr". Here are it's contents:

\#\!/bin/sh

exec sed -i '/^ \{8\}\.dr = 1,$/ s/1/0' mpv/video/decode/vd_lavc.c

This will set the.dr = 1, declariation in mpv/video/decode/vd_lavc.c to 0. I guess it's a boolean operator? I have verified that mpv still builds, and runs OK. Compiling with --enable-libmpv-shared in mpv_options, I got a library version that seems to make Celluloid disable the vd-lavc-dr option by default as well.

Of course, this is just a workaround until a real solution is found, but it will still due just fine for now.

Dudemanguy commented 2 years ago

I think you just want to set --vd-lavc-dr=no. It's an option.

sfan5 commented 2 years ago

Low end Intel iGPUs are known to have severe performance issues with DR (though maybe yours is just too old in general?). I have considered adding a blacklist of GPU models so DR would automatically be turned off but that's a bit suboptimal.

tsjnachos117 commented 2 years ago

@Dudemanguy There's no easy way to do this system-wide with libmpv. I share this computer with a couple of people, and talking all of them through the process of adding a command-line option in Celluloid's options is a pain in the butt. Hacking the build as I have seems easier.

(For regular mpv, adding the aforementioned line to /etc/mpv/mpv.conf works just fine.)

Dudemanguy commented 2 years ago

It's up to the libmpv API user (or Celluloid in this case) to expose easy ways for users to configure things. Not an mpv in any case however, so I'll close this.

tsjnachos117 commented 2 years ago

Oops! I only just realized I posted this in the mpv-build repo. This was meant to be in the mpv-player repo. My bad. Anyway, my main point was "this option makes mpv slow", not "help me hack this plz". I guess it being closed was for the best, especially given the workarounds already discussed.