mpv/filters
Philip Langdale 59478b0059 hwtransfer: implement support for hw->hw format conversion
Historically, we have not attempted to support hw->hw format conversion
in the autoconvert logic. If a user needed to do these kinds of
conversions, they needed to manually insert the hw format's conversion
filter manually (eg: scale_vaapi).

This was usually fine because the general rule is that any format
supported by the hardware can be used as well as any other. ie: You
would only need to do conversion if you have a specific goal in mind.

However, we now have two situations where we can find ourselves with a
hardware format being produced by a decoder that cannot be accepted by
a VO via hwdec-interop:
 * dmabuf-wayland can only accept formats that the Wayland compositor
   accepts. In the case of GNOME, it can only accept a handful of RGB
   formats.
 * When decoding via VAAPI on Intel hardware, some of the more unusual
   video encodings (4:2:2, 10bit 4:4:4) lead to packed frame formats
   which gpu-next cannot handle, causing rendering to fail.

In both these cases (at least when using VAAPI with dmabuf-wayland), if
we could detect the failure case and insert a `scale_vaapi` filter, we
could get successful output automatically. For `hwdec=drm`, there is
currently no conversion filter, so dmabuf-wayland is still out of luck
there.

The basic approach to implementing this is to detect the case where we
are evaluating a hardware format where the VO can accept the hardware
format itself, but may not accept the underlying sw format. In the
current code, we bypass autoconvert as soon as we see the hardware
format is compatible.

My first observation was that we actually have logic in autoconvert to
detect when the input sw format is not in the list of allowed sw
formats passed into the autoconverter. Unfortunately, we never populate
this list, and the way you would expect to do that is vo-query-format
returning sw format information, which it does not. We could define an
extended vo-query-format-2, but we'd still need to implement the
probing logic to fill it in.

On the other hand, we already have the probing logic in the hwupload
filter - and most recently I used that logic to implement conversion
on upload. So if we could leverage that, we could both detect when
hw->hw conversion is required, and pick the best target format.

This exercise is then primarily one of detecting when we are in this
case and letting that code run in a useful way. The hwupload filter is
a bit awkward to work with today, and so I refactored a bunch of the
set up code to actually make it more encapsulated. Now, instead of the
caller instantiating it and then triggering the probe, we probe on
creation and instantiate the correct underlying filter (hwupload vs
conversion) automatically.
2023-08-26 10:07:55 -07:00
..
f_async_queue.c f_async_queue: add various helper functions 2020-08-28 20:08:32 +02:00
f_async_queue.h f_async_queue: add various helper functions 2020-08-28 20:08:32 +02:00
f_auto_filters.c hwdec_vulkan: use bwdif_vulkan as deinterlacing auto filter 2023-05-28 15:46:05 -07:00
f_auto_filters.h filters/auto_filters: switch from scaletempo to scaletempo2 2021-02-15 00:13:03 +02:00
f_autoconvert.c hwtransfer: implement support for hw->hw format conversion 2023-08-26 10:07:55 -07:00
f_autoconvert.h vf_format: add gross mechanism for forcing scaler for testing 2020-04-13 15:56:27 +02:00
f_decoder_wrapper.c m_option: change m_option_type_aspect to double 2023-08-09 13:51:28 +00:00
f_decoder_wrapper.h player/video: check for forced eof 2023-07-22 17:42:25 +00:00
f_demux_in.c f_demux_in: log EOF "recovery" 2020-08-27 18:40:57 +02:00
f_demux_in.h
f_hwtransfer.c hwtransfer: implement support for hw->hw format conversion 2023-08-26 10:07:55 -07:00
f_hwtransfer.h hwtransfer: implement support for hw->hw format conversion 2023-08-26 10:07:55 -07:00
f_lavfi.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
f_lavfi.h filters: lavfi: allow hwdec_interop selection for filters 2022-09-21 09:39:34 -07:00
f_output_chain.c vf_vapoursynth: save display resolution as a variable 2023-08-13 19:58:20 +00:00
f_output_chain.h audio: redo video-sync=display-adrop 2020-05-23 04:04:46 +02:00
f_swresample.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
f_swresample.h options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
f_swscale.c f_swscale: do not reset color levels to default 2023-03-02 09:37:06 -05:00
f_swscale.h vf_format: add gross mechanism for forcing scaler for testing 2020-04-13 15:56:27 +02:00
f_utils.c osdep: rename MP_UNREACHABLE 2021-11-03 15:15:20 +01:00
f_utils.h various: fix typos 2022-04-25 09:07:18 -04:00
filter.c options: transition commands from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
filter.h vf_vapoursynth: save display resolution as a variable 2023-08-13 19:58:20 +00:00
filter_internal.h various: fix typos 2023-03-28 19:29:44 +00:00
frame.c
frame.h
user_filters.c filters: lavfi: allow hwdec_interop selection for filters 2022-09-21 09:39:34 -07:00
user_filters.h audio: add scaletempo2 filter based on chromium 2020-07-27 00:57:22 +02:00