Skip to content

vo_gpu: hwdec: load hwdec interops on-demand by default#9842

Merged
philipl merged 1 commit intompv-player:masterfrom
philipl:hwdec-interop
Feb 18, 2022
Merged

vo_gpu: hwdec: load hwdec interops on-demand by default#9842
philipl merged 1 commit intompv-player:masterfrom
philipl:hwdec-interop

Conversation

@philipl
Copy link
Member

@philipl philipl commented Feb 7, 2022

Historically, we have treated hwdec interop loading as a completely
separate step from loading the hwdecs themselves. Some hwdecs need an
interop, and some don't, and users generally configure the exact
hwdec they want, so interops that aren't relevant for that hwdec
shouldn't be loaded to save time and avoid warning/error spam.

The basic approach here is to recognise that interops are tied to
hwdecs by imgfmt. The hwdec outputs some format, and an interop is
needed to get that format to the vo without read back.

So, when we try to load an hwdec, instead of just blindly loading all
interops as we do today, let's pass the imgfmt in and only load
interops that work for that format. If more than one interop is
available for the format, the existing logic (whatever it is) will
continue to be used to pick one.

We also have one callsite in filters where we seem to pre-emptively
load all the interops. It's probably possible to trace down a specific
format but for now I'm just letting it keep loading all of them; it's
no worse than before.

You may notice there is no documentation update - and that's because
the current docs say that when the interop mode is auto, the interop
is loaded on demand. So reality now reflects the docs. How nice.

Fixes #8765
Fixes #9691

@philipl philipl force-pushed the hwdec-interop branch 2 times, most recently from e436616 to f5e3f30 Compare February 8, 2022 21:08
@philipl
Copy link
Member Author

philipl commented Feb 16, 2022

Updated to ensure we check for already loaded hwdecs in all scenarios.

Copy link
Member

@jeeb jeeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good now.

gl_video_load_hwdecs still has the original interpretation of what hwdec_interop_loading_done means, but that just leads to a difference if a specific interop is selected. or if all interops are disabled with "no".

@philipl
Copy link
Member Author

philipl commented Feb 17, 2022

Thanks, I'll tweak that to make it more consistent.

@jeeb
Copy link
Member

jeeb commented Feb 17, 2022

Finished my testing with:

  1. vo_libmpv (macOS), which is the only one calling gl_video_load_hwdecs with load_all_by_default set to true.
    mpv --no-config --hwdec=videotoolbox FILE
  2. d3d11va with d3d11vp (just to test one of the VPP filter usages).
    mpv -v --no-config --hwdec=d3d11va --vf=d3d11vpp --hwdec-codecs=mpeg2video random_broadcast.ts

Both seem to work :)

@jeeb
Copy link
Member

jeeb commented Feb 17, 2022

Thanks, I'll tweak that to make it more consistent.

For the record, I'm not sure if the inconsistency is a problem, since it just makes sure that what gets loaded by VO preinit (at least with the GPU and libmpv VOs) is then all that gets loaded in case an interop is specified or set to no.

Just thought it was worth bringing up as a difference, though.

@philipl
Copy link
Member Author

philipl commented Feb 17, 2022

Thanks, I'll tweak that to make it more consistent.

For the record, I'm not sure if the inconsistency is a problem, since it just makes sure that what gets loaded by VO preinit (at least with the GPU and libmpv VOs) is then all that gets loaded in case an interop is specified or set to no.

Just thought it was worth bringing up as a difference, though.

True. I can document the behaviour more clearly if nothing else.

Historically, we have treated hwdec interop loading as a completely
separate step from loading the hwdecs themselves. Some hwdecs need an
interop, and some don't, and users generally configure the exact
hwdec they want, so interops that aren't relevant for that hwdec
shouldn't be loaded to save time and avoid warning/error spam.

The basic approach here is to recognise that interops are tied to
hwdecs by imgfmt. The hwdec outputs some format, and an interop is
needed to get that format to the vo without read back.

So, when we try to load an hwdec, instead of just blindly loading all
interops as we do today, let's pass the imgfmt in and only load
interops that work for that format. If more than one interop is
available for the format, the existing logic (whatever it is) will
continue to be used to pick one.

We also have one callsite in filters where we seem to pre-emptively
load all the interops. It's probably possible to trace down a specific
format but for now I'm just letting it keep loading all of them; it's
no worse than before.

You may notice there is no documentation update - and that's because
the current docs say that when the interop mode is `auto`, the interop
is loaded on demand. So reality now reflects the docs. How nice.
@philipl philipl merged commit 5186651 into mpv-player:master Feb 18, 2022
@philipl philipl deleted the hwdec-interop branch February 18, 2022 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mpv shouldn't complain about missing libcuda.so.1 Option to disable cuda-nvdec when no CUDA device present

2 participants