From 68edce60a555fbfb597f316ca683daae81337a91 Mon Sep 17 00:00:00 2001 From: JayYang Date: Wed, 31 Jul 2024 22:50:36 +0800 Subject: [PATCH] [Media Common] [VP] [MCPY] Disable preemption for render copy Disable render copy preemption. --- media_common/agnostic/common/renderhal/renderhal.h | 4 ++++ .../common/shared/mediacopy/media_render_copy.cpp | 4 +++- media_softlet/agnostic/common/renderhal/renderhal.cpp | 10 ++++++++-- .../common/shared/mediacopy/media_render_copy_next.cpp | 4 +++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/media_common/agnostic/common/renderhal/renderhal.h b/media_common/agnostic/common/renderhal/renderhal.h index 1edd60448e..e06b248cf2 100644 --- a/media_common/agnostic/common/renderhal/renderhal.h +++ b/media_common/agnostic/common/renderhal/renderhal.h @@ -1282,6 +1282,10 @@ typedef struct _RENDERHAL_INTERFACE MediaPerfProfiler *pPerfProfiler = nullptr; //!< Performance data profiler bool eufusionBypass = false; MediaUserSettingSharedPtr userSettingPtr = nullptr; //!< Shared pointer to User Setting instance + + // if it's true, will disable preemption by setting NeedsMidBatchPreEmptionSupport flag in command buffer attribute as false; + // will also skip preemption control bits configure. + bool forceDisablePreemption = false; //--------------------------- // HW interface functions //--------------------------- diff --git a/media_driver/agnostic/common/shared/mediacopy/media_render_copy.cpp b/media_driver/agnostic/common/shared/mediacopy/media_render_copy.cpp index f96d0e15d7..549b8d41b1 100644 --- a/media_driver/agnostic/common/shared/mediacopy/media_render_copy.cpp +++ b/media_driver/agnostic/common/shared/mediacopy/media_render_copy.cpp @@ -108,7 +108,9 @@ MOS_STATUS RenderCopyState::Initialize() RenderHalSettings.iMediaStates = 32; MCPY_CHK_STATUS_RETURN(m_renderHal->pfnInitialize(m_renderHal, &RenderHalSettings)); - m_renderHal->sseuTable = VpDefaultSSEUTable; + m_renderHal->sseuTable = VpDefaultSSEUTable; + m_renderHal->forceDisablePreemption = true; + return MOS_STATUS_SUCCESS; } diff --git a/media_softlet/agnostic/common/renderhal/renderhal.cpp b/media_softlet/agnostic/common/renderhal/renderhal.cpp index 66b87b7faa..9c4a9a25d1 100644 --- a/media_softlet/agnostic/common/renderhal/renderhal.cpp +++ b/media_softlet/agnostic/common/renderhal/renderhal.cpp @@ -5132,7 +5132,8 @@ MOS_STATUS RenderHal_InitCommandBuffer( pCmdBuffer->Attributes.bMediaPreemptionEnabled = (pRenderHal->bEnableGpgpuMidBatchPreEmption || pRenderHal->bEnableGpgpuMidThreadPreEmption || - pRenderHal->pRenderHalPltInterface->IsPreemptionEnabled(pRenderHal)); + pRenderHal->pRenderHalPltInterface->IsPreemptionEnabled(pRenderHal)) && + !pRenderHal->forceDisablePreemption; if (pGenericPrologParams) { @@ -5535,7 +5536,12 @@ MOS_STATUS RenderHal_SendMediaStates( // Send L3 Cache Configuration MHW_RENDERHAL_CHK_STATUS_RETURN(pRenderHal->pRenderHalPltInterface->SetL3Cache(pRenderHal, pCmdBuffer)); - MHW_RENDERHAL_CHK_STATUS_RETURN(pRenderHal->pRenderHalPltInterface->EnablePreemption(pRenderHal, pCmdBuffer)); + // if forceDisablePreemption is true, preemption will be disabled by NeedsMidBatchPreEmptionSupport in command buffer header. + // skip preemption control bit configure as it won't take effect. + if (!pRenderHal->forceDisablePreemption) + { + MHW_RENDERHAL_CHK_STATUS_RETURN(pRenderHal->pRenderHalPltInterface->EnablePreemption(pRenderHal, pCmdBuffer)); + } // Send Debug Control, LRI commands used here & hence must be launched from a secure bb MHW_RENDERHAL_CHK_STATUS_RETURN(RenderHal_AddDebugControl(pRenderHal, pCmdBuffer)); diff --git a/media_softlet/agnostic/common/shared/mediacopy/media_render_copy_next.cpp b/media_softlet/agnostic/common/shared/mediacopy/media_render_copy_next.cpp index 9cc123c126..e2c30c74bd 100644 --- a/media_softlet/agnostic/common/shared/mediacopy/media_render_copy_next.cpp +++ b/media_softlet/agnostic/common/shared/mediacopy/media_render_copy_next.cpp @@ -117,7 +117,9 @@ MOS_STATUS RenderCopyStateNext::Initialize() RenderHalSettings.iMediaStates = 32; MCPY_CHK_STATUS_RETURN(m_renderHal->pfnInitialize(m_renderHal, &RenderHalSettings)); - m_renderHal->sseuTable = defaultSSEUTable; + m_renderHal->sseuTable = defaultSSEUTable; + m_renderHal->forceDisablePreemption = true; + return MOS_STATUS_SUCCESS; }