Skip to content

Commit

Permalink
[VP] APO Mos: GpuContextMgrNext /GpuContextSpecificNext
Browse files Browse the repository at this point in the history
1.Create Gpucontext via GpuContextMgrNext
2.init cmd buffer manager and create gpu context manager
3.use memory manager to do map/unmap/bind/unbind
4. moscallback go to apo path
  • Loading branch information
sudhanshusemwal authored and intel-mediadev committed Jan 23, 2025
1 parent 498e4e9 commit cb7fd5e
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 48 deletions.
2 changes: 1 addition & 1 deletion media_driver/agnostic/common/os/mos_os_virtualengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ MOS_STATUS Mos_VirtualEngineInterface_Initialize(
MOS_OS_CHK_STATUS(Mos_Specific_VirtualEngine_SinglePipe_Initialize(pVEInterf, pVEInitParms));
}

if (pOsInterface->apoMosEnabled)
if (pOsInterface->apoMosEnabled || pOsInterface->apoMosForLegacyRuntime)
{
MOS_OS_CHK_NULL(pOsInterface->osStreamState);
if (pVEInitParms->bScalabilitySupported)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ MOS_STATUS DecodeScalabilityMultiPipeNext::GetCmdBuffer(PMOS_COMMAND_BUFFER cmdB
auto &scdryCmdBuffer = m_secondaryCmdBuffers[secondaryIdx];
SCALABILITY_CHK_STATUS_RETURN(m_osInterface->pfnGetCommandBuffer(m_osInterface, &scdryCmdBuffer, bufIdx));

if (m_osInterface->apoMosEnabled)
if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime)
{
SCALABILITY_CHK_NULL_RETURN(m_osInterface->osStreamState);
SCALABILITY_CHK_NULL_RETURN(m_osInterface->osStreamState->virtualEngineInterface);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,7 @@ MOS_STATUS EncodeScalabilityMultiPipe::GetCmdBuffer(PMOS_COMMAND_BUFFER cmdBuffe
SCALABILITY_CHK_STATUS_RETURN(m_osInterface->pfnGetCommandBuffer(m_osInterface, &m_primaryCmdBuffer, 0));
uint32_t bufIdxPlus1 = m_currentPipe + 1; //Make CMD buffer one next to one.
m_osInterface->pfnGetCommandBuffer(m_osInterface, &m_secondaryCmdBuffer[bufIdxPlus1 - 1], bufIdxPlus1);

if (m_osInterface->apoMosEnabled)
if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime)
{
int32_t submissionType = IsFirstPipe() ? SUBMISSION_TYPE_MULTI_PIPE_MASTER : SUBMISSION_TYPE_MULTI_PIPE_SLAVE;
if (IsLastPipe())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ MOS_STATUS FrameTrackerProducer::Initialize(MOS_INTERFACE *osInterface)
&m_resource));

// RegisterResource will be called in AddResourceToHWCmd. It is not allowed to be called by hal explicitly
if (!m_osInterface->apoMosEnabled)
if (!m_osInterface->apoMosEnabled && !m_osInterface->apoMosForLegacyRuntime)
{
MHW_CHK_STATUS_RETURN(
m_osInterface->pfnRegisterResource(m_osInterface, &m_resource, true, true));
Expand Down
23 changes: 0 additions & 23 deletions media_softlet/agnostic/common/os/mos_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1952,29 +1952,6 @@ class MosInterface
bool scalableMode,
PMOS_VIRTUALENGINE_HINT_PARAMS *hintParams);

//!
//! \brief Set Virtual Engine Submission Type
//!
//! \details [Virtual Engine Interface] Set submission type for the provided cmd buffer
//! \details Caller: Hal (Scalability) only
//! \details Set submission type as per cmd buffer hint parameter. Must be set before submission.
//! Submission type is to set cmd buffer (primary or secondary) property to indicate
//! which pipe it belongs. See MOS_SUBMISSION_TYPE.
//!
//! \param [in] streamState
//! Handle of Os Stream State
//! \param [out] cmdBuf
//! Handle of cmd buffer to set submission type
//! \param [in] type
//! Submission type to set
//! \return MOS_STATUS
//! MOS_STATUS_SUCCESS if success, else fail reason
//!
static MOS_STATUS SetVeSubmissionType(
MOS_STREAM_HANDLE streamState,
COMMAND_BUFFER_HANDLE cmdBuf,
MOS_SUBMISSION_TYPE type);

//!
//! \brief Get Adapter BDF
//! \details [System info Interface] Get Adapter BDF
Expand Down
2 changes: 1 addition & 1 deletion media_softlet/agnostic/common/os/mos_os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ MOS_STATUS Mos_InitOsInterface(
MediaUserSetting::Group::Device);
#endif

if (pOsInterface->apoMosEnabled)
if (pOsInterface->apoMosEnabled || pOsInterface->apoMosForLegacyRuntime)
{
pOsInterface->osStreamState->osCpInterface = pOsInterface->osCpInterface;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ MOS_STATUS MediaContext::SearchContext(MediaFunction func, T params, uint32_t& i
MOS_OS_CHK_STATUS_RETURN(m_osInterface->pfnSetGpuContextHandle(m_osInterface, curAttribute.gpuContext, curAttribute.ctxForLegacyMos));
// set legacy MOS ve interface to current reused scalability state's ve interface
m_osInterface->pVEInterf = curAttribute.scalabilityState->m_veInterface;
if (m_osInterface->apoMosEnabled)
if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime)
{
if (curAttribute.scalabilityState->m_veState)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ MOS_STATUS MediaScalability::VerifySpaceAvailable(uint32_t requestedSize, uint32

MOS_STATUS MediaScalability::Destroy()
{
if (m_osInterface->apoMosEnabled)
if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime)
{
if (m_veState)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ MOS_STATUS VpScalabilityMultiPipeNext::Initialize(const MediaScalabilityOption &
veInitParms.ucNumOfSdryCmdBufSets = m_maxCmdBufferSetsNum;
veInitParms.ucMaxNumPipesInUse = vpScalabilityOption->GetMaxMultiPipeNum();
veInitParms.ucMaxNumOfSdryCmdBufInOneFrame = veInitParms.ucMaxNumPipesInUse;
if (m_osInterface->apoMosEnabled)

if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime)
{
SCALABILITY_CHK_NULL_RETURN(m_osInterface->osStreamState);
m_osInterface->osStreamState->component = COMPONENT_VPCommon;
Expand Down Expand Up @@ -177,7 +178,7 @@ MOS_STATUS VpScalabilityMultiPipeNext::Initialize(const MediaScalabilityOption &
#if (_DEBUG || _RELEASE_INTERNAL)
if (m_osInterface->bEnableDbgOvrdInVE)
{
if (m_osInterface->apoMosEnabled)
if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime)
{
for (uint32_t i = 0; i < m_osInterface->pfnGetVeEngineCount(m_osInterface->osStreamState); i++)
{
Expand Down Expand Up @@ -244,7 +245,7 @@ MOS_STATUS VpScalabilityMultiPipeNext::Destroy()
}
else
{
if (!m_osInterface->apoMosEnabled)
if (!m_osInterface->apoMosEnabled && !m_osInterface->apoMosForLegacyRuntime)
{
if (MOS_VE_SUPPORTED(m_osInterface))
{
Expand Down Expand Up @@ -384,7 +385,7 @@ MOS_STATUS VpScalabilityMultiPipeNext::GetCmdBuffer(PMOS_COMMAND_BUFFER cmdBuffe
m_osInterface->pfnGetCommandBuffer(m_osInterface, &m_secondaryCmdBuffers[bufIdx], bufIdxPlus1);
}

if (m_osInterface->apoMosEnabled)
if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime)
{
int32_t submissionType = IsFirstPipe() ? SUBMISSION_TYPE_MULTI_PIPE_MASTER : SUBMISSION_TYPE_MULTI_PIPE_SLAVE;
if (IsLastPipe())
Expand Down Expand Up @@ -499,7 +500,7 @@ MOS_STATUS VpScalabilityMultiPipeNext::SubmitCmdBuffer(PMOS_COMMAND_BUFFER cmdBu

m_attrReady = false;

if (m_osInterface->apoMosEnabled || (m_veInterface && m_veInterface->pfnVESetHintParams != nullptr))
if (m_osInterface->apoMosEnabled || m_osInterface->apoMosForLegacyRuntime|| (m_veInterface && m_veInterface->pfnVESetHintParams != nullptr))
{
SCALABILITY_CHK_STATUS_RETURN(SetHintParams());
SCALABILITY_CHK_STATUS_RETURN(PopulateHintParams(&m_primaryCmdBuffer));
Expand Down
12 changes: 0 additions & 12 deletions media_softlet/linux/common/os/mos_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3102,18 +3102,6 @@ MOS_STATUS MosInterface::GetVeHintParams(
return streamState->virtualEngineInterface->GetHintParams(scalableMode, hintParams);
}

MOS_STATUS MosInterface::SetVeSubmissionType(
MOS_STREAM_HANDLE streamState,
COMMAND_BUFFER_HANDLE cmdBuf,
MOS_SUBMISSION_TYPE type)
{
MOS_OS_CHK_NULL_RETURN(cmdBuf);
MOS_OS_CHK_NULL_RETURN(streamState);
MOS_OS_CHK_NULL_RETURN(streamState->virtualEngineInterface);

return streamState->virtualEngineInterface->SetSubmissionType(cmdBuf, type);
}

#if _DEBUG || _RELEASE_INTERNAL

uint8_t MosInterface::GetVeEngineCount(
Expand Down

0 comments on commit cb7fd5e

Please sign in to comment.