diff --git a/media_common/agnostic/common/renderhal/renderhal.h b/media_common/agnostic/common/renderhal/renderhal.h index 1edd60448e5..e06b248cf2d 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 f96d0e15d7e..549b8d41b15 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 66b87b7faa6..9c4a9a25d11 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 9cc123c1264..e2c30c74bdb 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; }