From ab7072f7e92832950f20cb4633a48d15901eb764 Mon Sep 17 00:00:00 2001 From: Cai_Jianxing Date: Sun, 5 Jan 2025 11:41:23 +0800 Subject: [PATCH] [VP] fix correption caused by 3d compression control surface not cleaned when target format be argb16 fix correption caused by 3d compression control surface not cleaned when target format be argb16. --- .../hal/packet/vp_render_sfc_xe_xpm_base.cpp | 20 +++++++++++++++++++ .../vp/hal/packet/vp_render_sfc_xe_xpm_base.h | 1 + .../hal/packet/vp_render_sfc_base_legacy.cpp | 4 ++-- .../vp/hal/packet/vp_render_sfc_base_legacy.h | 2 +- .../packet/vp_render_sfc_xe_lpm_plus_base.cpp | 20 +++++++++++++++++++ .../packet/vp_render_sfc_xe_lpm_plus_base.h | 1 + .../vp/hal/packet/vp_render_sfc_base.cpp | 4 ++-- .../common/vp/hal/packet/vp_render_sfc_base.h | 2 +- 8 files changed, 48 insertions(+), 6 deletions(-) diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.cpp b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.cpp index daccd21f047..2d74156fea6 100644 --- a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.cpp +++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.cpp @@ -308,3 +308,23 @@ bool SfcRenderXe_Xpm_Base::IsCscNeeded(SFC_CSC_PARAMS &cscParams) } return cscParams.bCSCEnabled || IsInputChannelSwapNeeded(cscParams.inputFormat); } + +MOS_STATUS SfcRenderXe_Xpm_Base::SetMmcParams(PMOS_SURFACE renderTarget, bool isFormatMmcSupported, bool isMmcEnabled) +{ + if (((renderTarget->Format == Format_A16R16G16B16) || + (renderTarget->Format == Format_A16B16G16R16)) && + renderTarget->CompressionMode == MOS_MMC_RC) + { + m_renderDataLegacy.sfcStateParams->bMMCEnable = true; + m_renderDataLegacy.sfcStateParams->MMCMode = MOS_MMC_RC; + VP_RENDER_NORMALMESSAGE("renderTarget->Format % d, m_renderData.sfcStateParams->MMCMode % d", renderTarget->Format, m_renderData.sfcStateParams->MMCMode); + return MOS_STATUS_SUCCESS; + } + + if (!isFormatMmcSupported && renderTarget->bIsCompressed && renderTarget->CompressionMode == MOS_MMC_RC) + { + VP_RENDER_ASSERTMESSAGE("CCS not cleaned due to fix function not supported the Format when compression on."); + } + + return SfcRenderM12::SetMmcParams(renderTarget, isFormatMmcSupported, isMmcEnabled); +} diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.h b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.h index 660076a9c67..9f8e203faaf 100644 --- a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.h +++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/vp/hal/packet/vp_render_sfc_xe_xpm_base.h @@ -67,6 +67,7 @@ class SfcRenderXe_Xpm_Base : public SfcRenderM12 virtual bool IsOutputChannelSwapNeeded(MOS_FORMAT outputFormat) override; virtual bool IsCscNeeded(SFC_CSC_PARAMS &cscParams) override; + virtual MOS_STATUS SetMmcParams(PMOS_SURFACE renderTarget, bool isFormatMmcSupported, bool isMmcEnabled) override; VP_SURFACE *m_tempFieldSurface = nullptr; diff --git a/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.cpp b/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.cpp index f8a754ff2d4..2a55531dc62 100644 --- a/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.cpp +++ b/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.cpp @@ -813,7 +813,7 @@ MOS_STATUS SfcRenderBaseLegacy::SetRotMirParams(PSFC_ROT_MIR_PARAMS rotMirParams return MOS_STATUS_SUCCESS; } -MOS_STATUS SfcRenderBaseLegacy::SetMmcParams(PMOS_SURFACE renderTarget, bool isFormalMmcSupported, bool isMmcEnabled) +MOS_STATUS SfcRenderBaseLegacy::SetMmcParams(PMOS_SURFACE renderTarget, bool isFormatMmcSupported, bool isMmcEnabled) { VP_FUNC_CALL(); @@ -821,7 +821,7 @@ MOS_STATUS SfcRenderBaseLegacy::SetMmcParams(PMOS_SURFACE renderTarget, bool isF VP_PUBLIC_CHK_NULL_RETURN(m_renderDataLegacy.sfcStateParams); if (renderTarget->CompressionMode && - isFormalMmcSupported && + isFormatMmcSupported && renderTarget->TileType == MOS_TILE_Y && isMmcEnabled) { diff --git a/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.h b/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.h index 34a15fb71f5..def0aba4e9f 100644 --- a/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.h +++ b/media_driver/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base_legacy.h @@ -146,7 +146,7 @@ class SfcRenderBaseLegacy : public SfcRenderBase //! \details Set mmc parameters //! \param [in] renderTarget //! render target surface - //! \param [in] isFormalMmcSupported + //! \param [in] isFormatMmcSupported //! Is format supported by mmc //! \param [in] isMmcEnabled //! Is mmc enabled diff --git a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.cpp b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.cpp index 6768901b03d..83753688a2c 100644 --- a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.cpp +++ b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.cpp @@ -685,3 +685,23 @@ MOS_STATUS SfcRenderXe_Lpm_Plus_Base::AddSfcState( return MOS_STATUS_SUCCESS; } +MOS_STATUS SfcRenderXe_Lpm_Plus_Base::SetMmcParams(PMOS_SURFACE renderTarget, bool isFormatMmcSupported, bool isMmcEnabled) +{ + if (((renderTarget->Format == Format_A16R16G16B16) || + (renderTarget->Format == Format_A16B16G16R16)) && + renderTarget->CompressionMode == MOS_MMC_RC) + { + m_renderData.sfcStateParams->bMMCEnable = true; + m_renderData.sfcStateParams->MMCMode = MOS_MMC_RC; + VP_RENDER_NORMALMESSAGE("renderTarget->Format % d, m_renderData.sfcStateParams->MMCMode % d", renderTarget->Format, m_renderData.sfcStateParams->MMCMode); + return MOS_STATUS_SUCCESS; + } + + if (!isFormatMmcSupported && renderTarget->bIsCompressed && renderTarget->CompressionMode == MOS_MMC_RC) + { + VP_RENDER_ASSERTMESSAGE("CCS not cleaned due to fix function not supported the Format when compression on."); + } + + return SfcRenderBase::SetMmcParams(renderTarget, isFormatMmcSupported, isMmcEnabled); +} + diff --git a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.h b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.h index e7e84fb7d7d..4530ec2a228 100644 --- a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.h +++ b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/vp/hal/packet/vp_render_sfc_xe_lpm_plus_base.h @@ -119,6 +119,7 @@ class SfcRenderXe_Lpm_Plus_Base : public SfcRenderBase PMOS_COMMAND_BUFFER pCmdBuffer, mhw::sfc::SFC_STATE_PAR *pSfcState, PMHW_SFC_OUT_SURFACE_PARAMS pOutSurface); + virtual MOS_STATUS SetMmcParams(PMOS_SURFACE renderTarget, bool isFormatMmcSupported, bool isMmcEnabled) override; VP_SURFACE *m_tempFieldSurface = nullptr; diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.cpp index edc59d9d420..8d01dfeb15b 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.cpp @@ -928,7 +928,7 @@ MOS_STATUS SfcRenderBase::SetRotMirParams(PSFC_ROT_MIR_PARAMS rotMirParams) return MOS_STATUS_SUCCESS; } -MOS_STATUS SfcRenderBase::SetMmcParams(PMOS_SURFACE renderTarget, bool isFormalMmcSupported, bool isMmcEnabled) +MOS_STATUS SfcRenderBase::SetMmcParams(PMOS_SURFACE renderTarget, bool isFormatMmcSupported, bool isMmcEnabled) { VP_FUNC_CALL(); @@ -936,7 +936,7 @@ MOS_STATUS SfcRenderBase::SetMmcParams(PMOS_SURFACE renderTarget, bool isFormalM VP_PUBLIC_CHK_NULL_RETURN(m_renderData.sfcStateParams); if (renderTarget->CompressionMode && - isFormalMmcSupported && + isFormatMmcSupported && renderTarget->TileType == MOS_TILE_Y && isMmcEnabled) { diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.h index da6c1baae6d..b3b5c15b257 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.h +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_sfc_base.h @@ -154,7 +154,7 @@ class SfcRenderBase //! \details Set mmc parameters //! \param [in] renderTarget //! render target surface - //! \param [in] isFormalMmcSupported + //! \param [in] isFormatMmcSupported //! Is format supported by mmc //! \param [in] isMmcEnabled //! Is mmc enabled