Skip to content

Commit

Permalink
[VP] Enable Cache for Render Indirect States
Browse files Browse the repository at this point in the history
Fix SR perf drop w/ Cache for Render Indirect States enabled.
  • Loading branch information
kchen1024 authored and intel-mediadev committed Dec 13, 2023
1 parent 5a48fc3 commit d5f5df5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions media_softlet/agnostic/common/hw/mhw_render_cmdpar.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ struct _MHW_PAR_T(GPGPU_CSR_BASE_ADDRESS)

struct _MHW_PAR_T(_3DSTATE_BINDING_TABLE_POOL_ALLOC)
{
uint32_t mocs4SurfaceState = 0;
};

struct _MHW_PAR_T(CFE_STATE)
Expand Down
7 changes: 6 additions & 1 deletion media_softlet/agnostic/common/hw/mhw_render_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,12 @@ class Impl : public Itf, public mhw::Impl
this->m_osItf,
this->m_currentCmdBuf,
&resource_params));
}

if (params.mocs4SurfaceState != 0)
{
cmd.DW1_2.SurfaceObjectControlState = params.mocs4SurfaceState;
}
}

cmd.DW3.BindingTablePoolBufferSize = indirect_state_size;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1500,5 +1500,16 @@ MHW_SETPAR_DECL_SRC(COMPUTE_WALKER, XRenderHal_Platform_Interface_Next)
params.GroupDepth = 1;
}

return MOS_STATUS_SUCCESS;
}

MHW_SETPAR_DECL_SRC(_3DSTATE_BINDING_TABLE_POOL_ALLOC, XRenderHal_Platform_Interface_Next)
{
MHW_STATE_BASE_ADDR_PARAMS *pStateBaseParams = nullptr;
MHW_RENDERHAL_CHK_NULL_RETURN(m_renderHal);
pStateBaseParams = &m_renderHal->StateBaseAddressParams;
MHW_RENDERHAL_CHK_NULL_RETURN(pStateBaseParams);
params.mocs4SurfaceState = pStateBaseParams->mocs4SurfaceState;

return MOS_STATUS_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ class XRenderHal_Platform_Interface_Next : public XRenderHal_Platform_Interface,

MHW_SETPAR_DECL_HDR(COMPUTE_WALKER);

MHW_SETPAR_DECL_HDR(_3DSTATE_BINDING_TABLE_POOL_ALLOC);

protected:

PRENDERHAL_INTERFACE m_renderHal = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@ MOS_STATUS VpRenderCmdPacket::Prepare()
pStateBaseParams->dwIndirectObjectBufferSize = m_renderHal->pStateHeap->dwSizeGSH;
pStateBaseParams->presInstructionBuffer = &m_renderHal->pStateHeap->IshOsResource;
pStateBaseParams->dwInstructionBufferSize = m_renderHal->pStateHeap->dwSizeISH;
uint32_t heapMocs = m_renderHal->pOsInterface->pfnCachePolicyGetMemoryObject(MOS_HW_RESOURCE_USAGE_VP_INPUT_PICTURE_RENDER,
m_renderHal->pOsInterface->pfnGetGmmClientContext(m_renderHal->pOsInterface)).DwordValue;
pStateBaseParams->mocs4SurfaceState = heapMocs;
pStateBaseParams->mocs4GeneralState = heapMocs;
pStateBaseParams->mocs4DynamicState = heapMocs;
pStateBaseParams->mocs4InstructionCache = heapMocs;
pStateBaseParams->mocs4IndirectObjectBuffer = heapMocs;
pStateBaseParams->mocs4StatelessDataport = heapMocs;
}

MOS_ZeroMemory(&m_renderData, sizeof(KERNEL_PACKET_RENDER_DATA));
Expand Down

0 comments on commit d5f5df5

Please sign in to comment.