0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
mpv/video/out
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
..
cocoa cocoa_common: remove deprecated VOCTRLs/VO_EVENTs 2019-12-12 19:56:03 +01:00
d3d11 hwdec: do not add hwdec device if it failed to create 2023-06-26 19:07:29 +02:00
gpu vo_gpu: allow --hdr-peak-decay-rate=0.0 2023-08-18 15:00:25 +02:00
gpu_next vo_gpu_next: respect gl->flipped 2023-05-27 11:37:48 +02:00
hwdec hwtransfer: implement support for hw->hw format conversion 2023-08-26 10:07:55 -07:00
mac options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
opengl context_drm_egl: remove references to VAAPI in error messages 2023-08-20 20:55:57 +02:00
placebo libplacebo: drop PL_API_VER compatibility paths 2023-08-18 16:39:57 +02:00
vulkan vulkan: don't assume all ra_ctx implementations have a swapchain 2023-06-03 18:37:43 -07:00
win32 win32: add support for drag-and-drop option 2023-07-01 02:06:02 +00:00
wldmabuf vo_dmabuf_wayland: drop linux-dmabuf-v2 (again) 2023-06-16 14:46:59 +00:00
android_common.c video/out/android: assert WinID value before use 2023-06-03 17:07:43 +02:00
android_common.h vo: change vo_platform_init to bool 2023-01-08 20:42:42 +00:00
aspect.c aspect: change --video-pan-x/y to be relative to the destination rect 2023-08-20 23:15:48 +00:00
aspect.h aspect: change license to LGPL 2017-06-17 17:08:51 +02:00
bitmap_packer.c video/out/bitmap_packer: Avoid empty initializer list 2019-11-18 16:50:21 +01:00
bitmap_packer.h bitmap_packer: remove some unused functions 2016-07-01 20:29:45 +02:00
cocoa_cb_common.swift options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
cocoa_common.h osx: change license of OSX and cocoa files to LGPL 2017-06-24 16:29:22 +02:00
cocoa_common.m build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
dither.c various: fix warning -Wimplicit-const-int-float-conversion 2023-02-26 16:45:07 +01:00
dither.h
dr_helper.c vo: add int flags to the get_image signature 2023-01-23 14:13:34 +01:00
dr_helper.h vo: add int flags to the get_image signature 2023-01-23 14:13:34 +01:00
drm_atomic.c drm: rewrite based around vo_drm_state 2023-01-21 17:08:29 +00:00
drm_atomic.h drm: rewrite based around vo_drm_state 2023-01-21 17:08:29 +00:00
drm_common.c drm_common: skip cards that don't have connected outputs 2023-08-20 19:59:36 +02:00
drm_common.h drm: rewrite based around vo_drm_state 2023-01-21 17:08:29 +00:00
drm_prime.c drm_prime: fallback to drmModeAddFB2 2020-05-08 21:26:25 +02:00
drm_prime.h drm_prime: double free bug 2020-03-05 18:12:57 +01:00
filter_kernels.c filter_kernels: fix kaiser 2022-12-20 13:53:25 +01:00
filter_kernels.h vo_opengl: refactor scaler LUT weight packing/loading 2017-09-04 13:53:14 +02:00
libmpv_sw.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
libmpv.h vo: add int flags to the get_image signature 2023-01-23 14:13:34 +01:00
meson.build meson: rename all features with underscores 2023-08-20 21:13:37 +00:00
present_sync.c vo: move wayland presentation to separate files 2022-06-19 18:13:55 +00:00
present_sync.h vo: move wayland presentation to separate files 2022-06-19 18:13:55 +00:00
vo_caca.c vo_caca: Implement VOCTRL_UPDATE_WINDOW_TITLE 2019-10-29 17:07:41 +01:00
vo_direct3d.c various: fix typos 2023-03-28 19:29:44 +00:00
vo_dmabuf_wayland.c build: remove outdated generated directory 2023-07-31 19:00:06 +00:00
vo_drm.c vo_drm: remove VOCTRL_SCREENSHOT_WIN 2023-07-21 20:23:11 +02:00
vo_gpu_next.c vo_gpu_next: move line to correct location (cosmetic) 2023-08-21 19:50:20 +02:00
vo_gpu.c vo: hwdec: Pass the ra_ctx to hwdecs instead of just the ra 2023-05-28 15:46:05 -07:00
vo_image.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
vo_kitty.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
vo_lavc.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
vo_libmpv.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
vo_mediacodec_embed.c hwdec: fix undeclared identifier in mediacodec_embed 2023-06-28 10:29:24 -07:00
vo_null.c options: change option macros and all option declarations 2020-03-18 19:52:01 +01:00
vo_rpi.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
vo_sdl.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
vo_sixel.c various: fix various typos in the code base 2023-03-28 19:29:44 +00:00
vo_tct.c options: transition options from OPT_FLAG to OPT_BOOL 2023-02-21 17:15:17 +00:00
vo_vaapi.c draw_bmp: fix overflowing coordinates in mark_rcs 2023-07-30 20:06:20 +02:00
vo_vdpau.c vo_vdpau: set hwdec image format 2023-08-02 18:51:02 +00:00
vo_wlshm.c vo_wlshm: bail out of resize if width/height is 0 2023-07-08 20:47:35 -05:00
vo_x11.c vo_x11: don't rely on XFree to free calloc-ed data 2023-07-02 12:47:31 +02:00
vo_xv.c various: drop unused #include "config.h" 2023-02-20 14:21:18 +00:00
vo.c meson: remove redundant libplacebo-next check 2023-08-18 16:39:57 +02:00
vo.h vo: make mp_frame_perf thread safe 2023-05-25 16:25:33 +02:00
w32_common.c win32: don't ignore --screen and --fs-screen 2023-08-23 15:37:41 +02:00
w32_common.h vo: change vo_platform_init to bool 2023-01-08 20:42:42 +00:00
wayland_common.c input: add missing keypad key defines 2023-08-25 15:55:31 +00:00
wayland_common.h wayland_common: remove questionable gcd impl and global state 2023-07-19 13:01:08 +02:00
win_state.c win_state: add vo_calc_window_geometry3 2021-09-06 10:16:10 +03:00
win_state.h win_state: add vo_calc_window_geometry3 2021-09-06 10:16:10 +03:00
x11_common.c input: add missing keypad key defines 2023-08-25 15:55:31 +00:00
x11_common.h x11: remove xinerama and refactor window geometry 2023-08-20 02:01:39 +00:00