[FFmpeg-devel] [PATCH v3 3/4] libavcodec/qsv: enabling d3d11va support, added mfxhdlpair

Mark Thompson sw at jkqxz.net
Sun Apr 26 21:31:26 EEST 2020


On 24/04/2020 15:52, artem.galin at gmail.com wrote:
> From: Artem Galin <artem.galin at intel.com>
> 
> Adding DX11 relevant device type checks and adjusting callbacks with
> proper MediaSDK pair type support.
> 
> Extending structure for proper MediaSDK pair type support.
> 
> Signed-off-by: Artem Galin <artem.galin at intel.com>
> ---
>  libavcodec/qsv.c          | 66 +++++++++++++++++++++++++++++++--------
>  libavcodec/qsv_internal.h |  1 +
>  2 files changed, 54 insertions(+), 13 deletions(-)
> 
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index db98c75073..35e62417f6 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -36,6 +36,8 @@
>  #include "avcodec.h"
>  #include "qsv_internal.h"
>  
> +#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
> +
>  #if QSV_VERSION_ATLEAST(1, 12)
>  #include "mfx/mfxvp8.h"
>  #endif
> @@ -221,8 +223,15 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame)
>      int i;
>      for (i = 0; i < ctx->nb_mids; i++) {
>          QSVMid *mid = &ctx->mids[i];
> +#if CONFIG_VAAPI
>          if (mid->handle == frame->surface.Data.MemId)
>              return i;
> +#else
> +        mfxHDLPair *pair = (mfxHDLPair*)frame->surface.Data.MemId;
> +        if ((mid->handle_pair.first == pair->first) &&
> +            (mid->handle_pair.second == pair->second))
> +            return i;
> +#endif

Is there any reason not to pass around an mfxHDLPair on Linux as well?  All the #ifdefs you're adding here are not fun.

>      }
>      return AVERROR_BUG;
>  }
> @@ -362,7 +371,11 @@ static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs)
>  int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs,
>                                   const char *load_plugins, int gpu_copy)
>  {
> +#if CONFIG_D3D11VA
> +    mfxIMPL          impl = MFX_IMPL_AUTO_ANY | MFX_IMPL_VIA_D3D11;

Does that still do the right thing on systems where only D3D9 works?

> ...

- Mark


More information about the ffmpeg-devel mailing list