From 1c13afaf3355d67a66b51617d7a99af523b72231 Mon Sep 17 00:00:00 2001 From: zhang_alex1 Date: Wed, 30 Aug 2023 16:22:19 +0800 Subject: [PATCH] [VP] fix pipecontrol issue fix pipecontrol issue. --- media_common/agnostic/common/hw/mhw_mi.h | 1 + .../hw/mhw_mi_xe_lpm_plus_base_next_impl.h | 3 ++- media_softlet/agnostic/common/hw/mhw_mi_cmdpar.h | 1 + .../renderhal/renderhal_platform_interface_next.cpp | 1 + .../common/shared/packet/media_render_cmd_packet.h | 1 + .../common/vp/hal/packet/vp_render_cmd_packet.cpp | 10 ++++++++-- .../common/vp/hal/packet/vp_render_kernel_obj.cpp | 4 ++-- .../common/vp/hal/packet/vp_render_kernel_obj.h | 3 ++- .../vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.cpp | 2 +- .../vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.h | 2 +- .../vp/hal/packet/vp_render_vebox_hvs_kernel.cpp | 2 +- .../common/vp/hal/packet/vp_render_vebox_hvs_kernel.h | 2 +- 12 files changed, 22 insertions(+), 10 deletions(-) diff --git a/media_common/agnostic/common/hw/mhw_mi.h b/media_common/agnostic/common/hw/mhw_mi.h index 8aa55e24cbf..7abb98cb6a3 100644 --- a/media_common/agnostic/common/hw/mhw_mi.h +++ b/media_common/agnostic/common/hw/mhw_mi.h @@ -179,6 +179,7 @@ typedef struct _MHW_PIPE_CONTROL_PARAMS uint32_t bInvalidateTextureCache : 1; uint32_t bGenericMediaStateClear : 1; uint32_t bIndirectStatePointersDisable : 1; + uint32_t bUnTypedDataPortCacheFlush : 1; uint32_t bHdcPipelineFlush : 1; uint32_t bKernelFenceEnabled : 1; uint32_t bPPCFlush : 1; diff --git a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/hw/mhw_mi_xe_lpm_plus_base_next_impl.h b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/hw/mhw_mi_xe_lpm_plus_base_next_impl.h index bb77c7bf9a9..8cffeb75399 100644 --- a/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/hw/mhw_mi_xe_lpm_plus_base_next_impl.h +++ b/media_softlet/agnostic/Xe_M_plus/Xe_LPM_plus_base/hw/mhw_mi_xe_lpm_plus_base_next_impl.h @@ -662,7 +662,8 @@ class Impl : public mi::Impl cmd.DW1.StateCacheInvalidationEnable = params.bInvalidateStateCache; cmd.DW1.ConstantCacheInvalidationEnable = params.bInvalidateConstantCache; } - + cmd.DW0.UnTypedDataPortCacheFlush = params.bUnTypedDataPortCacheFlush; + cmd.DW0.HdcPipelineFlush = params.bHdcPipelineFlush; cmd.DW1.RenderTargetCacheFlushEnable = params.bFlushRenderTargetCache; cmd.DW1.DcFlushEnable = params.bFlushRenderTargetCache; // same as above cmd.DW1.VfCacheInvalidationEnable = params.bInvalidateVFECache; diff --git a/media_softlet/agnostic/common/hw/mhw_mi_cmdpar.h b/media_softlet/agnostic/common/hw/mhw_mi_cmdpar.h index a72403173aa..0a301e1d34e 100644 --- a/media_softlet/agnostic/common/hw/mhw_mi_cmdpar.h +++ b/media_softlet/agnostic/common/hw/mhw_mi_cmdpar.h @@ -188,6 +188,7 @@ namespace mi bool bInvalidateTextureCache = false; bool bGenericMediaStateClear = false; bool bIndirectStatePointersDisable = false; + bool bUnTypedDataPortCacheFlush = false; bool bHdcPipelineFlush = false; bool bKernelFenceEnabled = false; bool bPPCFlush = false; diff --git a/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp b/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp index 0ae291f5f94..f744529ccca 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp +++ b/media_softlet/agnostic/common/renderhal/renderhal_platform_interface_next.cpp @@ -504,6 +504,7 @@ MOS_STATUS XRenderHal_Platform_Interface_Next::AddMiPipeControl( par.bInvalidateTextureCache = params->bInvalidateTextureCache; par.bGenericMediaStateClear = params->bGenericMediaStateClear; par.bIndirectStatePointersDisable = params->bIndirectStatePointersDisable; + par.bUnTypedDataPortCacheFlush = params->bUnTypedDataPortCacheFlush; par.bHdcPipelineFlush = params->bHdcPipelineFlush; par.bKernelFenceEnabled = params->bKernelFenceEnabled; MHW_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(PIPE_CONTROL)(pCmdBuffer)); diff --git a/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h b/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h index b62f94794b4..30296c01def 100644 --- a/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h +++ b/media_softlet/agnostic/common/shared/packet/media_render_cmd_packet.h @@ -88,6 +88,7 @@ typedef struct _KERNEL_WALKER_PARAMS RECT alignedRect; bool isVerticalPattern; bool bSyncFlag; + bool bFlushL1; bool isGroupStartInvolvedInGroupSize; // true if group start need be involved in the group size. bool calculateBlockXYByAlignedRect; // true if iBlocksX/iBlocksY is calculated by alignedRect in RenderCmdPacket instead of kernel object. bool forcePreferredSLMZero; // true if preferredSLM need force to 0. diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp index 4bd87a820f6..877476009cc 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_cmd_packet.cpp @@ -1806,7 +1806,7 @@ MOS_STATUS VpRenderCmdPacket::SendMediaStates( MHW_MI_LOAD_REGISTER_IMM_PARAMS loadRegisterImmParams = {}; PMHW_MI_MMIOREGISTERS pMmioRegisters = nullptr; MOS_OCA_BUFFER_HANDLE hOcaBuf = 0; - + bool flushL1 = false; //--------------------------------------- MHW_RENDERHAL_CHK_NULL(pRenderHal); MHW_RENDERHAL_CHK_NULL(pRenderHal->pStateHeap); @@ -1901,6 +1901,11 @@ MOS_STATUS VpRenderCmdPacket::SendMediaStates( pipeCtlParams.dwFlushMode = MHW_FLUSH_CUSTOM; pipeCtlParams.bInvalidateTextureCache = true; pipeCtlParams.bFlushRenderTargetCache = true; + if (flushL1) + { //Flush L1 cache after consumer walker when there is a producer-consumer relationship walker. + pipeCtlParams.bUnTypedDataPortCacheFlush = true; + pipeCtlParams.bHdcPipelineFlush = true; + } MHW_RENDERHAL_CHK_STATUS(pRenderHal->pRenderHalPltInterface->AddMiPipeControl(pRenderHal, pCmdBuffer, &pipeCtlParams)); @@ -1941,7 +1946,8 @@ MOS_STATUS VpRenderCmdPacket::SendMediaStates( pCmdBuffer, &m_gpgpuWalkerParams)); - PrintWalkerParas(m_mediaWalkerParams); + flushL1 = it->second.walkerParam.bFlushL1; + PrintWalkerParas(m_mediaWalkerParams); } else { diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp index 3cc4326f6ab..24af0fe2600 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.cpp @@ -107,7 +107,7 @@ void VpRenderKernelObj::OcaDumpKernelInfo(MOS_COMMAND_BUFFER &cmdBuffer, MOS_CON } // Only for Adv kernels. -MOS_STATUS VpRenderKernelObj::SetWalkerSetting(KERNEL_THREAD_SPACE& threadSpace, bool bSyncFlag) +MOS_STATUS VpRenderKernelObj::SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1) { VP_FUNC_CALL(); VP_RENDER_CHK_STATUS_RETURN(MOS_STATUS_UNIMPLEMENTED); @@ -139,7 +139,7 @@ MOS_STATUS VpRenderKernelObj::SetKernelConfigs( VP_RENDER_CHK_STATUS_RETURN(SetSamplerStates(samplerStateGroup)); - VP_RENDER_CHK_STATUS_RETURN(SetWalkerSetting(kernelParams.kernelThreadSpace, kernelParams.syncFlag)); + VP_RENDER_CHK_STATUS_RETURN(SetWalkerSetting(kernelParams.kernelThreadSpace, kernelParams.syncFlag,kernelParams.flushL1)); return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h index 3ff789dfa5d..df7e408f16e 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_kernel_obj.h @@ -86,6 +86,7 @@ typedef struct _KERNEL_PARAMS KERNEL_ARGS kernelArgs; KERNEL_THREAD_SPACE kernelThreadSpace; bool syncFlag; + bool flushL1; } KERNEL_PARAMS; struct MEDIA_OBJECT_KA2_INLINE_DATA @@ -502,7 +503,7 @@ class VpRenderKernelObj protected: - virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE& threadSpace, bool bSyncFlag); + virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1 = false); virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext); diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.cpp index 491dc4f1e8f..9fbbb3a2a69 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.cpp @@ -461,7 +461,7 @@ MOS_STATUS VpRenderHdr3DLutKernelCM::GetWalkerSetting(KERNEL_WALKER_PARAMS &walk } // Only for Adv kernels. -MOS_STATUS VpRenderHdr3DLutKernelCM::SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag) +MOS_STATUS VpRenderHdr3DLutKernelCM::SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1) { VP_FUNC_CALL(); MOS_ZeroMemory(&m_walkerParam, sizeof(KERNEL_WALKER_PARAMS)); diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.h index 1dfd95c2c03..a8a4384be38 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.h +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hdr_3dlut_kernel.h @@ -291,7 +291,7 @@ class VpRenderHdr3DLutKernelCM : public VpRenderHdr3DLutKernel protected: virtual MOS_STATUS SetupSurfaceState() override; virtual MOS_STATUS CpPrepareResources() override; - virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag) override; + virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1 = false) override; virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext) override; virtual MOS_STATUS SetKernelConfigs(KERNEL_CONFIGS &kernelConfigs) override; diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.cpp b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.cpp index adddcf03518..6c1b576abef 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.cpp +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.cpp @@ -71,7 +71,7 @@ MOS_STATUS VpRenderHVSKernel::GetWalkerSetting(KERNEL_WALKER_PARAMS &walkerParam } // Only for Adv kernels. -MOS_STATUS VpRenderHVSKernel::SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag) +MOS_STATUS VpRenderHVSKernel::SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1) { VP_FUNC_CALL(); MOS_ZeroMemory(&m_walkerParam, sizeof(KERNEL_WALKER_PARAMS)); diff --git a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.h b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.h index 755ab965b62..466a16df70e 100644 --- a/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.h +++ b/media_softlet/agnostic/common/vp/hal/packet/vp_render_vebox_hvs_kernel.h @@ -227,7 +227,7 @@ class VpRenderHVSKernel : public VpRenderKernelObj protected: virtual MOS_STATUS SetupSurfaceState() override; - virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag) override; + virtual MOS_STATUS SetWalkerSetting(KERNEL_THREAD_SPACE &threadSpace, bool bSyncFlag, bool flushL1 = false) override; virtual MOS_STATUS SetKernelArgs(KERNEL_ARGS &kernelArgs, VP_PACKET_SHARED_CONTEXT *sharedContext) override; virtual MOS_STATUS SetKernelConfigs(KERNEL_CONFIGS &kernelConfigs) override;