[FFmpeg-devel] [PATCH v2] avutils/hwcontext: When deriving a hwdevice, search for existing device in both directions

Soft Works softworkz at hotmail.com
Wed Aug 11 20:22:20 EEST 2021



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces at ffmpeg.org> On Behalf Of
> Soft Works
> Sent: Tuesday, 10 August 2021 11:53
> To: ffmpeg-devel at ffmpeg.org
> Subject: [FFmpeg-devel] [PATCH v2] avutils/hwcontext: When deriving a
> hwdevice, search for existing device in both directions
> 

[..]

> Signed-off-by: softworkz <softworkz at hotmail.com>
> ---
> v2: allow storing multiple derived devices in a device ctx; add
> checks for oom
>  libavutil/hwcontext.c          | 38
> ++++++++++++++++++++++++++++++++++
>  libavutil/hwcontext.h          |  1 +
>  libavutil/hwcontext_internal.h |  6 ++++++
>  libavutil/hwcontext_qsv.c      | 10 ++++++++-
>  4 files changed, 54 insertions(+), 1 deletion(-)
> 
> diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
> index d13d0f7c9b..7f4e541553 100644
> --- a/libavutil/hwcontext.c
> +++ b/libavutil/hwcontext.c

Now, that Haihao's patch has been merged,
(https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=4532)

this patch is required to make all related derivation scenarios
work, and for some that are working, it will avoid duplicate 
instantiation of hw device contexts.

This version of the patch addresses the (valid) concerns
from @Hendrik by storing multiple derived device contexts
in cases where more than one device is derived from another
device.

It also adds the missing checks as pointed out by Haihao.

Would be great when someone could take a look at the code.


The combination of this and Haihao's patch is quite a milestone
(in the QSV area) as it will enable several scenarios that 
haven't been working before.

From a quick lock, this will also close the following tickets:


openCL cannot be run simultaneously with h264_qsv
https://trac.ffmpeg.org/ticket/6077 

Intel QSV: "No device available for encoder" message is given
https://trac.ffmpeg.org/ticket/6492 

overlay_qsv fails to create qsvvpp
https://trac.ffmpeg.org/ticket/7808 

overlay_qsv cannot burn graphic subtitles on windows
https://trac.ffmpeg.org/ticket/8609 

overlay_qsv fails with "Inputs with different underlying QSV 
devices are forbidden"
https://trac.ffmpeg.org/ticket/8995


Kind regards,
softworkz




More information about the ffmpeg-devel mailing list