ffmpeg/libavutil
Soft Works a428949775 avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions
The test /libavutil/tests/hwdevice checks that when deriving a device
from a source device and then deriving back to the type of the source
device, the result is matching the original source device, i.e. the
derivation mechanism doesn't create a new device in this case.

Previously, this test was usually passed, but only due to two different
kind of flaws:

1. The test covers only a single level of derivation (and back)

It derives device Y from device X and then Y back to the type of X and
checks whether the result matches X.

What it doesn't check for, are longer chains of derivation like:

CUDA1 > OpenCL2 > CUDA3 and then back to OpenCL4

In that case, the second derivation returns the first device (CUDA3 ==
CUDA1), but when deriving OpenCL4, hwcontext.c was creating a new
OpenCL4 context instead of returning OpenCL2, because there was no link
from CUDA1 to OpenCL2 (only backwards from OpenCL2 to CUDA1)

If the test would check for two levels of derivation, it would have
failed.

This patch fixes those (yet untested) cases by introducing forward
references (derived_device) in addition to the existing back references
(source_device).

2. hwcontext_qsv didn't properly set the source_device

In case of QSV, hwcontext_qsv creates a source context internally
(vaapi, dxva2 or d3d11va) without calling av_hwdevice_ctx_create_derived
and without setting source_device.

This way, the hwcontext test ran successful, but what practically
happened, was that - for example - deriving vaapi from qsv didn't return
the original underlying vaapi device and a new one was created instead:
Exactly what the test is intended to detect and prevent. It just
couldn't do so, because the original device was hidden (= not set as the
source_device of the QSV device).

This patch properly makes these setting and fixes all derivation
scenarios.

(at a later stage, /libavutil/tests/hwdevice should be extended to check
longer derivation chains as well)

Reviewed-by: Lynne <dev@lynne.ee>
Reviewed-by: Anton Khirnov <anton@khirnov.net>
Tested-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-01-05 11:05:06 +08:00
..
aarch64 aarch64: Add Armv8.5-A BTI support 2021-11-16 13:43:56 +02:00
arm arm/aarch64: Use mach_absolute_time as timer on apple platforms 2021-02-21 22:41:34 +02:00
avr32
bfin
loongarch avcodec: [loongarch] Optimize h264_chroma_mc with LASX. 2021-12-15 18:37:40 +01:00
mips avutil/mips: Use $at as MMI macro temporary register 2021-07-28 23:31:48 +02:00
ppc
sh4
tests avutil/tests/cpu: add slowgather 2021-12-21 17:52:09 -03:00
tomi
x86 avutil/cpu: move slow gather checks below in the function 2021-12-21 17:51:17 -03:00
.gitignore
Makefile avutil: add objc.h to SKIPHEADERS 2021-12-19 09:41:16 -08:00
adler32.c avutil: Switch crypto APIs to size_t 2021-04-27 10:43:13 -03:00
adler32.h avutil: Switch crypto APIs to size_t 2021-04-27 10:43:13 -03:00
aes.c
aes.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
aes_ctr.c avutil/aes_ctr: Avoid allocation of AVAES struct 2021-12-08 14:14:00 +01:00
aes_ctr.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
aes_internal.h All: update names in copyright headers 2021-01-20 01:02:56 -06:00
attributes.h
audio_fifo.c Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
audio_fifo.h
avassert.h
avsscanf.c Remove unnecessary avassert.h inclusions 2021-07-22 15:02:30 +02:00
avstring.c avutil/avstring: Check for memory allocation error in av_escape 2021-03-15 06:45:07 +01:00
avstring.h avutil/{avstring,bprint}: add XML escaping from ffprobe to avutil 2021-03-05 19:45:00 +02:00
avutil.h
avutilres.rc
base64.c avutil/base64: Fix undefined NULL + 0 2021-04-01 14:47:00 +02:00
base64.h
blowfish.c
blowfish.h
bprint.c all: Use av_memdup() where appropriate 2021-12-03 16:07:02 +01:00
bprint.h
bswap.h
buffer.c avutil/buffer: Avoid allocation of AVBuffer when using buffer pool 2021-09-18 23:16:49 +02:00
buffer.h avutil/buffer: constify some function parameters 2021-09-17 13:28:09 -03:00
buffer_internal.h avutil/buffer: Avoid allocation of AVBuffer when using buffer pool 2021-09-18 23:16:49 +02:00
camellia.c
camellia.h
cast5.c
cast5.h
channel_layout.c
channel_layout.h
color_utils.c
color_utils.h
colorspace.h
common.h libavutil/common: clip nan value to amin 2021-11-15 16:50:08 -03:00
cpu.c avutil/cpu: add slowgather to av_parse_cpu_caps() 2021-12-21 17:51:27 -03:00
cpu.h libavutil/cpu: Add AV_CPU_FLAG_SLOW_GATHER. 2021-12-21 17:44:44 -03:00
cpu_internal.h avutil: [loongarch] Add support for loongarch SIMD. 2021-12-15 18:37:40 +01:00
crc.c
crc.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
cuda_check.h
des.c
des.h
detection_bbox.c avutil/detection_bbox: Fix av_detection_bbox_alloc failed if nb_bboxes == 0 2021-10-08 10:11:59 +08:00
detection_bbox.h lavu/detection_bbox.h: use AV_NUM_DETECTION_BBOX_CLASSIFY to replace AV_NUM_BBOX_CLASSIFY 2021-04-18 10:41:17 +08:00
dict.c
dict.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
display.c
display.h avutil/display: fix inverted doc 2021-12-20 21:29:42 +01:00
dovi_meta.c lavu/frame: Add Dolby Vision metadata side data type 2022-01-04 11:59:02 +01:00
dovi_meta.h lavu/frame: Add Dolby Vision metadata side data type 2022-01-04 11:59:02 +01:00
downmix_info.c
downmix_info.h
dynarray.h
encryption_info.c Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
encryption_info.h
error.c
error.h avutil/error: Include macros.h for MKTAG 2021-07-29 22:02:05 +02:00
eval.c libavutil/eval: Remove CONFIG_TRAPV special handling 2021-02-10 12:28:29 +01:00
eval.h
ffmath.h
fifo.c
fifo.h
file.c
file.h
file_open.c
film_grain_params.c libavutil: introduce AVFilmGrainParams side data 2020-11-25 23:06:33 +01:00
film_grain_params.h avcodec/h264_slice: compute and export film grain seed 2021-08-24 09:58:52 -03:00
fixed_dsp.c
fixed_dsp.h
float_dsp.c
float_dsp.h
frame.c lavu/frame: Add Dolby Vision metadata side data type 2022-01-04 11:59:02 +01:00
frame.h lavu/frame: Add Dolby Vision metadata side data type 2022-01-04 11:59:02 +01:00
hash.c avutil: Switch crypto APIs to size_t 2021-04-27 10:43:13 -03:00
hash.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
hdr_dynamic_metadata.c
hdr_dynamic_metadata.h
hmac.c Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
hmac.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
hwcontext.c avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions 2022-01-05 11:05:06 +08:00
hwcontext.h avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions 2022-01-05 11:05:06 +08:00
hwcontext_cuda.c avutil/hwcontext_cuda: return more useful error codes from init functions 2021-11-22 23:03:21 +01:00
hwcontext_cuda.h
hwcontext_cuda_internal.h
hwcontext_d3d11va.c Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
hwcontext_d3d11va.h libavutil/hwcontext_d3d11va: adding more texture information to the D3D11 hwcontext API 2021-09-08 17:48:02 -03:00
hwcontext_drm.c hwcontext_drm: make dependency on Linux kernel headers optional 2020-12-30 23:14:46 +01:00
hwcontext_drm.h
hwcontext_dxva2.c avutil/hwcontext_dxva2: add ARGB format 2021-11-13 19:22:57 +01:00
hwcontext_dxva2.h
hwcontext_internal.h avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions 2022-01-05 11:05:06 +08:00
hwcontext_mediacodec.c
hwcontext_mediacodec.h
hwcontext_opencl.c Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
hwcontext_opencl.h
hwcontext_qsv.c avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions 2022-01-05 11:05:06 +08:00
hwcontext_qsv.h
hwcontext_vaapi.c libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame 2021-12-10 17:03:48 +01:00
hwcontext_vaapi.h
hwcontext_vdpau.c avutil/buffer: Switch AVBuffer API to size_t 2021-04-27 10:43:13 -03:00
hwcontext_vdpau.h
hwcontext_videotoolbox.c lavu/hwcontext_videotoolbox: use OS-provided mapping routines when available 2021-12-22 18:43:34 -06:00
hwcontext_videotoolbox.h lavu/videotoolbox: expose routine to set CVPixelBufferRef metadata 2021-12-22 18:43:17 -06:00
hwcontext_vulkan.c hwcontext_vulkan: remove VK_EXT_hdr_metadata from autoloaded extensions list 2022-01-03 03:16:45 +01:00
hwcontext_vulkan.h hwcontext_vulkan: stricter semaphore number requirements 2021-12-10 17:04:22 +01:00
imgutils.c imgutils: expose av_image_copy_plane_uc_from() 2021-08-14 00:27:43 +02:00
imgutils.h imgutils: expose av_image_copy_plane_uc_from() 2021-08-14 00:27:43 +02:00
imgutils_internal.h
integer.c
integer.h
internal.h Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
intfloat.h
intmath.c
intmath.h
intreadwrite.h
lfg.c
lfg.h
libavutil.v
libm.h
lls.c Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
lls.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
log.c
log.h avutil/log: Reorder elements of AVClass to make it smaller 2021-08-25 23:01:53 +02:00
log2_tab.c
lzo.c
lzo.h
macos_kperf.c lavu/kperf: use ff_thread_once() 2021-07-21 16:35:27 +02:00
macos_kperf.h lavu/kperf: use ff_thread_once() 2021-07-21 16:35:27 +02:00
macros.h avutil/common, macros: Move several macros from common.h to macros.h 2021-07-29 22:02:05 +02:00
mastering_display_metadata.c
mastering_display_metadata.h
mathematics.c Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
mathematics.h avutil/mathematics: Document av_rescale_rnd() behavior on non int64 results 2021-10-21 14:13:03 +02:00
md5.c avutil/md5: Avoid av_unused variable 2021-10-02 17:13:57 +02:00
md5.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
mem.c avutil/mem: Deprecate av_mallocz_array() 2021-09-20 01:04:09 +02:00
mem.h avutil/mem: Deprecate av_mallocz_array() 2021-09-20 01:04:09 +02:00
mem_internal.h avutil/mem: make ff_fast_malloc() internal to mem.c 2021-05-27 10:29:52 -03:00
motion_vector.h
murmur3.c avutil: Switch crypto APIs to size_t 2021-04-27 10:43:13 -03:00
murmur3.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
objc.h avutil: add obj-c helpers into header-only include 2021-12-18 11:55:47 -08:00
opt.c avutil/opt: fix mis-alignment of option and constant values for filter help 2021-11-13 19:55:32 +01:00
opt.h avutil/opt: Document actual behaviour of av_opt_copy a bit more 2021-08-17 19:11:57 +02:00
parseutils.c avutil/parseutils: add qhd(Quad HD) or wqhd(Wide Quad HD) for 1440p 2021-11-03 21:38:37 +08:00
parseutils.h
pca.c
pca.h
pixdesc.c lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats 2021-11-28 16:40:43 -06:00
pixdesc.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
pixelutils.c
pixelutils.h
pixfmt.h lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats 2021-11-28 16:40:43 -06:00
qsort.h
random_seed.c
random_seed.h
rational.c
rational.h
rc4.c
rc4.h
replaygain.h
reverse.c
reverse.h
ripemd.c avutil: Switch crypto APIs to size_t 2021-04-27 10:43:13 -03:00
ripemd.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
samplefmt.c avutil/samplefmt: don't add offsets to NULL pointers 2021-06-13 16:10:37 -03:00
samplefmt.h avutil/samplefmt: remove outdated comment 2021-06-13 16:10:37 -03:00
sha.c avutil: Switch crypto APIs to size_t 2021-04-27 10:43:13 -03:00
sha.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
sha512.c avutil: Switch crypto APIs to size_t 2021-04-27 10:43:13 -03:00
sha512.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
slicethread.c lavu/slicethread: return ENOSYS rather than EINVAL in the dummy func 2021-08-29 18:45:04 +02:00
slicethread.h
softfloat.h
softfloat_ieee754.h
softfloat_tables.h
spherical.c avutil/spherical: Use av_strstart instead of strncmp 2021-02-28 17:14:21 +01:00
spherical.h
stereo3d.c avutil/stereo3d: Use av_strstart instead of strncmp 2021-02-28 17:14:21 +01:00
stereo3d.h
tablegen.h
tea.c
tea.h
thread.h
threadmessage.c
threadmessage.h
time.c lavu: use address-of operator checking clock_gettime 2020-12-28 01:12:26 -03:00
time.h
time_internal.h
timecode.c avutil/timecode: Avoid fps overflow 2021-03-14 23:29:51 +01:00
timecode.h avutil/timecode: add av_timecode_init_from_components 2020-12-03 18:32:54 +01:00
timer.h lavu/kperf: use ff_thread_once() 2021-07-21 16:35:27 +02:00
timestamp.h
tree.c
tree.h Remove obsolete version.h inclusions 2021-07-22 14:34:31 +02:00
twofish.c avutil/twofish: Fixed decryption 2021-12-19 01:02:59 +01:00
twofish.h
tx.c avutil/tx: add a return at the end of non-void functions 2021-08-06 21:22:49 -03:00
tx.h lavu/tx: add full-sized iMDCT transform flag 2021-04-24 17:17:27 +02:00
tx_double.c
tx_float.c
tx_int32.c
tx_priv.h Remove unnecessary avassert.h inclusions 2021-07-22 15:02:30 +02:00
tx_template.c checkasm: add av_tx FFT SIMD testing code 2021-04-24 17:19:17 +02:00
utils.c avutil/utils: Remove racy check from avutil_version() 2021-09-29 02:58:07 +02:00
version.h lib*/version.h: Bump Versions after release/5.0 branch 2022-01-04 14:29:06 +01:00
video_enc_params.c lavu/video_enc_params: make sure blocks are properly aligned 2021-06-10 16:59:50 +02:00
video_enc_params.h mpegvideo: use the AVVideoEncParams API for exporting QP tables 2021-01-01 14:23:19 +01:00
vulkan.c lavu/vulkan: check for initialization when freeing buffers 2021-11-20 01:48:45 +01:00
vulkan.h vulkan: fix checkheaders 2021-11-19 16:47:28 +01:00
vulkan_functions.h avutil/hwcontext_vulkan: fully support customizable validation layers 2021-11-26 10:36:39 +01:00
vulkan_glslang.c avutil/vulkan_glslang: fix compiling failure issue 2021-11-19 16:47:48 +01:00
vulkan_loader.h vulkan_loader: fix typo in error message 2021-11-18 06:40:52 +01:00
vulkan_shaderc.c lavu/vulkan: add support for using libshaderc as a GLSL compiler 2021-11-19 16:47:30 +01:00
wchar_filename.h Replace all occurences of av_mallocz_array() by av_calloc() 2021-09-20 01:03:52 +02:00
xga_font_data.c
xga_font_data.h
xtea.c
xtea.h