From fd06c3da52ed323ad93264b52ffe2f311d3c0f0e Mon Sep 17 00:00:00 2001 From: Cai_Jianxing Date: Wed, 20 Nov 2024 15:32:59 +0800 Subject: [PATCH] [VP] fallback to Render when sfc input hight > 3072 fallback to Render when sfc input hight > 3072. --- .../common/vp/hal/feature_manager/policy.cpp | 38 ++++++++++++++++--- .../vp/hal/pipeline/vp_feature_report.h | 1 + .../common/vp/hal/pipeline/vp_pipeline.cpp | 21 ++++++++++ .../common/vp/hal/pipeline/vp_pipeline.h | 1 + .../utils/hal_ddi_share/vp_user_setting.cpp | 14 +++++++ .../vp/hal/utils/vp_user_feature_control.cpp | 21 ++++++++++ .../vp/hal/utils/vp_user_feature_control.h | 6 +++ .../agnostic/common/vp/hal/utils/vp_utils.h | 2 + 8 files changed, 99 insertions(+), 5 deletions(-) diff --git a/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp b/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp index ec700419984..dad2e326efa 100644 --- a/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp +++ b/media_softlet/agnostic/common/vp/hal/feature_manager/policy.cpp @@ -1181,9 +1181,12 @@ MOS_STATUS Policy::GetScalingExecutionCaps(SwFilter *feature, bool isHdrEnabled, VP_PUBLIC_CHK_NULL_RETURN(feature); VP_PUBLIC_CHK_NULL_RETURN(m_vpInterface.GetHwInterface()); VP_PUBLIC_CHK_NULL_RETURN(m_vpInterface.GetHwInterface()->m_userFeatureControl); + VP_PUBLIC_CHK_NULL_RETURN(m_vpInterface.GetHwInterface()->m_reporting); auto userFeatureControl = m_vpInterface.GetHwInterface()->m_userFeatureControl; bool disableSfc = userFeatureControl->IsSfcDisabled(); + bool fallbackScalingToRender8K = userFeatureControl->IsFallbackScalingToRender8K(); + auto reporting = m_vpInterface.GetHwInterface()->m_reporting; SwFilterScaling* scaling = (SwFilterScaling*)feature; FeatureParamScaling *scalingParams = &scaling->GetSwFilterParams(); VP_EngineEntry *scalingEngine = &scaling->GetFilterEngineCaps(); @@ -1255,11 +1258,12 @@ MOS_STATUS Policy::GetScalingExecutionCaps(SwFilter *feature, bool isHdrEnabled, (uint32_t)(scalingParams->input.rcDst.right - scalingParams->input.rcDst.left), m_hwCaps.m_sfcHwEntry[scalingParams->formatOutput].horizontalAlignUnit); + bool isScalingNeeded = (dwOutputRegionHeight != dwSourceRegionHeight || dwOutputRegionWidth != dwSourceRegionWidth); + if (!m_hwCaps.m_veboxHwEntry[scalingParams->formatInput].inputSupported) { // For non-scaling cases with vebox unsupported format, will force to use fc. - scalingEngine->bEnabled = (dwOutputRegionHeight != dwSourceRegionHeight || - dwOutputRegionWidth != dwSourceRegionWidth); + scalingEngine->bEnabled = isScalingNeeded; scalingEngine->SfcNeeded = 0; scalingEngine->VeboxNeeded = 0; scalingEngine->RenderNeeded = 1; @@ -1304,8 +1308,7 @@ MOS_STATUS Policy::GetScalingExecutionCaps(SwFilter *feature, bool isHdrEnabled, OUT_OF_BOUNDS(dwSurfaceHeight, veboxMinHeight, veboxMaxHeight)) { // For non-scaling cases with vebox unsupported format, will force to use fc. - scalingEngine->bEnabled = (dwOutputRegionHeight != dwSourceRegionHeight || - dwOutputRegionWidth != dwSourceRegionWidth); + scalingEngine->bEnabled = isScalingNeeded; scalingEngine->SfcNeeded = 0; scalingEngine->VeboxNeeded = 0; scalingEngine->forceEnableForSfc = 0; @@ -1322,6 +1325,31 @@ MOS_STATUS Policy::GetScalingExecutionCaps(SwFilter *feature, bool isHdrEnabled, return MOS_STATUS_SUCCESS; } + if (MEDIA_IS_WA(m_vpInterface.GetHwInterface()->m_waTable, Wa_16025683853) && + fallbackScalingToRender8K == true && + scalingParams->input.dwHeight > 3072 && + isScalingNeeded) + { + // For sfc input height > 3072 case, will force to use fc. + scalingEngine->bEnabled = 1; + scalingEngine->SfcNeeded = 0; + scalingEngine->VeboxNeeded = 0; + scalingEngine->RenderNeeded = 1; + scalingEngine->hdrKernelSupported = 1; + scalingEngine->fcSupported = 1; + scalingEngine->forceEnableForSfc = 0; + scalingEngine->forceEnableForFc = 1; + scalingEngine->sfcNotSupported = 1; +#if (_DEBUG || _RELEASE_INTERNAL) + reporting->GetFeatures().fallbackScalingToRender8K = fallbackScalingToRender8K; +#endif + + VP_PUBLIC_NORMALMESSAGE("The input height %d is greater than 3072.", scalingParams->input.dwHeight); + + PrintFeatureExecutionCaps(__FUNCTION__, *scalingEngine); + return MOS_STATUS_SUCCESS; + } + // Calculate the scaling ratio // Both source region and scaled region are pre-rotated // Need to take Interlace scaling into consideration next step @@ -2699,7 +2727,7 @@ MOS_STATUS Policy::GetInputPipeEngineCaps(SwFilterPipe& featurePipe, VP_EngineEn // not all features in input pipe can be processed by vebox/sfc and // features in output pipe cannot be combined to vebox/sfc workload. engineCapsForVeboxSfc.fcOnlyFeatureExists = true; - engineCapsForFc.fcOnlyFeatureExists = true; + engineCapsForFc.fcOnlyFeatureExists = true; } if (engineCaps.sfcNotSupported) { diff --git a/media_softlet/agnostic/common/vp/hal/pipeline/vp_feature_report.h b/media_softlet/agnostic/common/vp/hal/pipeline/vp_feature_report.h index dcf24ab4c06..da6ca29cc70 100644 --- a/media_softlet/agnostic/common/vp/hal/pipeline/vp_feature_report.h +++ b/media_softlet/agnostic/common/vp/hal/pipeline/vp_feature_report.h @@ -77,6 +77,7 @@ class VpFeatureReport uint32_t diffLogOclFC = 0; uint32_t featureLogOclFC = 0; bool isLegacyFCInUse = false; + bool fallbackScalingToRender8K = false; #endif bool VeboxScalability = false; //!< Vebox Scalability flag bool VPApogeios = false; //!< VP Apogeios flag diff --git a/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.cpp b/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.cpp index d40a6373628..5c93ad839de 100644 --- a/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.cpp +++ b/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.cpp @@ -44,6 +44,16 @@ VpPipeline::VpPipeline(PMOS_INTERFACE osInterface) : VpPipeline::~VpPipeline() { +#if (_DEBUG || _RELEASE_INTERNAL) + if (m_reportOnceFlag) + { + ReportUserSettingForDebug( + m_userSettingPtr, + __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K_REPORT, + 0, + MediaUserSetting::Group::Sequence); + } +#endif // Delete m_featureManager before m_resourceManager, since // m_resourceManager is referenced by m_featureManager. MOS_Delete(m_featureManager); @@ -261,6 +271,17 @@ MOS_STATUS VpPipeline::UserFeatureReport() m_reporting->GetFeatures().isLegacyFCInUse = false; } } + + if (m_reportOnceFlag && m_reporting->GetFeatures().fallbackScalingToRender8K) + { + ReportUserSettingForDebug( + m_userSettingPtr, + __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K_REPORT, + 1, + MediaUserSetting::Group::Sequence); + m_reporting->GetFeatures().fallbackScalingToRender8K = false; + m_reportOnceFlag = false; + } #endif diff --git a/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.h b/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.h index ba9f38d8fa5..70d37275b15 100644 --- a/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.h +++ b/media_softlet/agnostic/common/vp/hal/pipeline/vp_pipeline.h @@ -475,6 +475,7 @@ class VpPipeline : public MediaPipeline VpUserFeatureControl *m_userFeatureControl = nullptr; std::vector m_vpPipeContexts = {}; VpPipelineParamFactory *m_pipelineParamFactory = nullptr; + bool m_reportOnceFlag = true; MEDIA_CLASS_DEFINE_END(vp__VpPipeline) }; diff --git a/media_softlet/agnostic/common/vp/hal/utils/hal_ddi_share/vp_user_setting.cpp b/media_softlet/agnostic/common/vp/hal/utils/hal_ddi_share/vp_user_setting.cpp index 3ad293d9f10..7a3a6df8323 100644 --- a/media_softlet/agnostic/common/vp/hal/utils/hal_ddi_share/vp_user_setting.cpp +++ b/media_softlet/agnostic/common/vp/hal/utils/hal_ddi_share/vp_user_setting.cpp @@ -453,6 +453,20 @@ MOS_STATUS VpUserSetting::InitVpUserSetting(MediaUserSettingSharedPtr userSettin 0, true); + DeclareUserSettingKeyForDebug( + userSettingPtr, + __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K, + MediaUserSetting::Group::Sequence, + 0, + true); + + DeclareUserSettingKeyForDebug( + userSettingPtr, + __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K_REPORT, + MediaUserSetting::Group::Sequence, + 0, + true); + #endif return MOS_STATUS_SUCCESS; diff --git a/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.cpp b/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.cpp index c3932c4504c..122001cdabe 100644 --- a/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.cpp +++ b/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.cpp @@ -478,6 +478,27 @@ MOS_STATUS VpUserFeatureControl::CreateUserSettingForDebug() } VP_PUBLIC_NORMALMESSAGE("enableSFCLinearOutputByTileConvert value is set as %d.", m_ctrlValDefault.enableSFCLinearOutputByTileConvert); +#if (_DEBUG || _RELEASE_INTERNAL) + uint32_t fallbackScalingToRender8K = 0; + eRegKeyReadStatus = ReadUserSettingForDebug( + m_userSettingPtr, + fallbackScalingToRender8K, + __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K, + MediaUserSetting::Group::Sequence, + true, + true); + if (MOS_SUCCEEDED(eRegKeyReadStatus)) + { + m_ctrlValDefault.fallbackScalingToRender8K = fallbackScalingToRender8K; + } + else +#endif + { + // WA ID need be added before code merge. + m_ctrlValDefault.fallbackScalingToRender8K = 1; + } + VP_PUBLIC_NORMALMESSAGE("fallbackScalingToRender8K %d", m_ctrlValDefault.fallbackScalingToRender8K); + return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.h b/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.h index 25784f230a0..55b78ec7971 100644 --- a/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.h +++ b/media_softlet/agnostic/common/vp/hal/utils/vp_user_feature_control.h @@ -76,6 +76,7 @@ class VpUserFeatureControl uint32_t splitFramePortions = 1; bool decompForInterlacedSurfWaEnabled = false; bool enableSFCLinearOutputByTileConvert = false; + bool fallbackScalingToRender8K = false; }; uint32_t Is3DLutKernelOnly() @@ -208,6 +209,11 @@ class VpUserFeatureControl return m_ctrlVal.veboxTypeH; } + bool IsFallbackScalingToRender8K() + { + return m_ctrlVal.fallbackScalingToRender8K; + } + MOS_STATUS SetClearVideoViewMode(bool mode) { m_ctrlVal.clearVideoViewMode = mode; diff --git a/media_softlet/agnostic/common/vp/hal/utils/vp_utils.h b/media_softlet/agnostic/common/vp/hal/utils/vp_utils.h index 62c52d84f68..77956ac6b66 100644 --- a/media_softlet/agnostic/common/vp/hal/utils/vp_utils.h +++ b/media_softlet/agnostic/common/vp/hal/utils/vp_utils.h @@ -344,6 +344,8 @@ class Trace #define __MEDIA_USER_FEATURE_VALUE_ENABLE_VEBOX_ID_REPORT "Enable VEBOX ID REPORT" #define __MEDIA_USER_FEATURE_VALUE_USED_VEBOX_ID "USED VEBOX ID" +#define __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K "VP Fallback Scaling To Render 8k" +#define __MEDIA_USER_FEATURE_VALUE_FALLBACK_SCALING_TO_RENDER_8K_REPORT "VP Fallback Scaling To Render 8k Report" #endif //(_DEBUG || _RELEASE_INTERNAL) class VpUtils