aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Galin <artem.galin@intel.com>2021-08-20 22:48:06 +0100
committerJames Almer <jamrial@gmail.com>2021-09-08 17:48:32 -0300
commita611c35001f477f1c911027faa93cddf67874693 (patch)
tree5671dc512d660e013fd2d984d5ff6f3e2cdf79fe
parent4f78711f9c28b11dae4e4b96be46b6b4925eb8c6 (diff)
downloadffmpeg-a611c35001f477f1c911027faa93cddf67874693.tar.gz
libavfilter/qsvvpp: enabling d3d11va support, added mfxhdlpair
Adding DX11 relevant device type checks and adjusting callback with proper MediaSDK pair type support. Signed-off-by: Artem Galin <artem.galin@intel.com>
-rw-r--r--libavfilter/qsvvpp.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c
index c7ef8a915f..66b8673d4e 100644
--- a/libavfilter/qsvvpp.c
+++ b/libavfilter/qsvvpp.c
@@ -36,12 +36,7 @@
MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET))
#define IS_OPAQUE_MEMORY(mode) (mode & MFX_MEMTYPE_OPAQUE_FRAME)
#define IS_SYSTEM_MEMORY(mode) (mode & MFX_MEMTYPE_SYSTEM_MEMORY)
-
-static const mfxHandleType handle_types[] = {
- MFX_HANDLE_VA_DISPLAY,
- MFX_HANDLE_D3D9_DEVICE_MANAGER,
- MFX_HANDLE_D3D11_DEVICE,
-};
+#define MFX_IMPL_VIA_MASK(impl) (0x0f00 & (impl))
static const AVRational default_tb = { 1, 90000 };
@@ -202,7 +197,13 @@ static mfxStatus frame_unlock(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
static mfxStatus frame_get_hdl(mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
{
- *hdl = mid;
+ mfxHDLPair *pair_dst = (mfxHDLPair*)hdl;
+ mfxHDLPair *pair_src = (mfxHDLPair*)mid;
+
+ pair_dst->first = pair_src->first;
+
+ if (pair_src->second != (mfxMemId)MFX_INFINITE)
+ pair_dst->second = pair_src->second;
return MFX_ERR_NONE;
}
@@ -572,14 +573,18 @@ static int init_vpp_session(AVFilterContext *avctx, QSVVPPContext *s)
return AVERROR_UNKNOWN;
}
- for (i = 0; i < FF_ARRAY_ELEMS(handle_types); i++) {
- ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_types[i], &handle);
- if (ret == MFX_ERR_NONE) {
- handle_type = handle_types[i];
- break;
- }
+ if (MFX_IMPL_VIA_VAAPI == MFX_IMPL_VIA_MASK(impl)) {
+ handle_type = MFX_HANDLE_VA_DISPLAY;
+ } else if (MFX_IMPL_VIA_D3D11 == MFX_IMPL_VIA_MASK(impl)) {
+ handle_type = MFX_HANDLE_D3D11_DEVICE;
+ } else if (MFX_IMPL_VIA_D3D9 == MFX_IMPL_VIA_MASK(impl)) {
+ handle_type = MFX_HANDLE_D3D9_DEVICE_MANAGER;
+ } else {
+ av_log(avctx, AV_LOG_ERROR, "Error unsupported handle type\n");
+ return AVERROR_UNKNOWN;
}
+ ret = MFXVideoCORE_GetHandle(device_hwctx->session, handle_type, &handle);
if (ret < 0)
return ff_qsvvpp_print_error(avctx, ret, "Error getting the session handle");
else if (ret > 0) {