From b3e7404312f1d33cae93d7f00561904550c94146 Mon Sep 17 00:00:00 2001 From: Mengkejiergeli Ba Date: Thu, 20 Jul 2023 15:46:32 +0800 Subject: [PATCH] msdkvpp: Add compute scaling mode Part-of: --- .../gst-plugins-bad/sys/msdk/gstmsdkvpp.c | 21 ++++++++++++++----- .../gst-plugins-bad/sys/msdk/msdk-enums.c | 4 ++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c index 6e021f053a..d8fb773974 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c +++ b/subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c @@ -1076,11 +1076,22 @@ ensure_filters (GstMsdkVPP * thiz) /* Scaling Mode */ if (thiz->flags & GST_MSDK_FLAG_SCALING_MODE) { - mfxExtVPPScaling *mfx_scaling = &thiz->mfx_scaling; - mfx_scaling->Header.BufferId = MFX_EXTBUFF_VPP_SCALING; - mfx_scaling->Header.BufferSz = sizeof (mfxExtVPPScaling); - mfx_scaling->ScalingMode = thiz->scaling_mode; - gst_msdkvpp_add_extra_param (thiz, (mfxExtBuffer *) mfx_scaling); + gboolean scaling_mode_is_compute = FALSE; +#if (MFX_VERSION >= 2007) + if (thiz->scaling_mode == MFX_SCALING_MODE_INTEL_GEN_COMPUTE) + scaling_mode_is_compute = TRUE; +#endif + if (MFX_RUNTIME_VERSION_ATLEAST (thiz->version, 2, 7) || + !scaling_mode_is_compute) { + mfxExtVPPScaling *mfx_scaling = &thiz->mfx_scaling; + mfx_scaling->Header.BufferId = MFX_EXTBUFF_VPP_SCALING; + mfx_scaling->Header.BufferSz = sizeof (mfxExtVPPScaling); + mfx_scaling->ScalingMode = thiz->scaling_mode; + gst_msdkvpp_add_extra_param (thiz, (mfxExtBuffer *) mfx_scaling); + } else { + GST_WARNING_OBJECT (thiz, + "Compute scaling mode not supported, ignore it..."); + } } /* FRC */ diff --git a/subprojects/gst-plugins-bad/sys/msdk/msdk-enums.c b/subprojects/gst-plugins-bad/sys/msdk/msdk-enums.c index cd0de2a4df..79ec767227 100644 --- a/subprojects/gst-plugins-bad/sys/msdk/msdk-enums.c +++ b/subprojects/gst-plugins-bad/sys/msdk/msdk-enums.c @@ -371,6 +371,10 @@ gst_msdkvpp_scaling_mode_get_type (void) {MFX_SCALING_MODE_DEFAULT, "Default Scaling", "disable"}, {MFX_SCALING_MODE_LOWPOWER, "Lowpower Scaling", "lowpower"}, {MFX_SCALING_MODE_QUALITY, "High Quality Scaling", "quality"}, +#if (MFX_VERSION >= 2007) + {MFX_SCALING_MODE_INTEL_GEN_COMPUTE, + "Compute Mode Scaling (running on EUs)", "compute"}, +#endif {0, NULL, NULL} };