[FFmpeg-devel] [PATCH v4 09/10] qsv: use a new method to create mfx session when using oneVPL

James Almer jamrial at gmail.com
Tue Sep 28 22:53:22 EEST 2021


On 9/23/2021 3:28 AM, Haihao Xiang wrote:
> In oneVPL, MFXLoad() and MFXCreateSession() are required to create a
> workable mfx session[1]
> 
> Add AccelerationMode config filter for D3D9/D3D11 session (galinart)
> 
> The default device is changed to d3d11va for oneVPL when both d3d11va
> and dxva2 are enabled on Microsoft Windows
> 
> This is in preparation for oneVPL support
> 
> [1] https://spec.oneapi.io/versions/latest/elements/oneVPL/source/programming_guide/VPL_prg_session.html#onevpl-dispatcher
> 
> Signed-off-by: galinart <artem.galin at intel.com>
> ---
>   libavcodec/qsv.c                 | 191 ++++++++++++++++--
>   libavcodec/qsv_internal.h        |   1 +
>   libavcodec/qsvdec.c              |   4 +
>   libavcodec/qsvenc.h              |   3 +
>   libavcodec/qsvenc_h264.c         |   1 -
>   libavcodec/qsvenc_hevc.c         |   1 -
>   libavcodec/qsvenc_jpeg.c         |   1 -
>   libavcodec/qsvenc_mpeg2.c        |   1 -
>   libavcodec/qsvenc_vp9.c          |   1 -
>   libavfilter/qsvvpp.c             | 107 ++++++++++-
>   libavfilter/qsvvpp.h             |   5 +
>   libavfilter/vf_deinterlace_qsv.c |  14 +-
>   libavfilter/vf_scale_qsv.c       |  12 +-
>   libavutil/hwcontext_qsv.c        | 319 +++++++++++++++++++++++++++----
>   libavutil/hwcontext_qsv.h        |  16 ++
>   15 files changed, 588 insertions(+), 89 deletions(-)

[...]

> diff --git a/libavutil/hwcontext_qsv.h b/libavutil/hwcontext_qsv.h
> index 42e34d0dda..65415d3d8c 100644
> --- a/libavutil/hwcontext_qsv.h
> +++ b/libavutil/hwcontext_qsv.h
> @@ -19,8 +19,23 @@
>   #ifndef AVUTIL_HWCONTEXT_QSV_H
>   #define AVUTIL_HWCONTEXT_QSV_H
>   
> +#include <mfxdefs.h>
>   #include <mfxvideo.h>
>   
> +#if (MFX_VERSION_MAJOR < 2)
> +
> +typedef void * mfxLoader;

No, use void* in AVQSVDeviceContext below.

> +
> +static av_always_inline void MFXUnload (mfxLoader mfxloader)
> +{
> +}

Neither of these belong in an exported header. They are not part of our 
API, so we can't define them in our headers.
For MFXUnload, either do it in an internal header, or directly in the c 
files where needed. And preferably as

#define MFXUnload(a) do{}while(0)

Instead.

> +
> +#else
> +
> +#include <mfxdispatcher.h>
> +
> +#endif
> +
>   /**
>    * @file
>    * An API-specific header for AV_HWDEVICE_TYPE_QSV.
> @@ -33,6 +48,7 @@
>    * This struct is allocated as AVHWDeviceContext.hwctx
>    */
>   typedef struct AVQSVDeviceContext {
> +    mfxLoader loader;

New fields should go at the end of the struct.

>       mfxSession session;
>   } AVQSVDeviceContext;
>   
> 



More information about the ffmpeg-devel mailing list