Skip to content

Commit

Permalink
[VP] Enable Vebox physical engine id report
Browse files Browse the repository at this point in the history
Enable Vebox physical engine id report for multi-engines schedule
  • Loading branch information
LhGu authored and intel-mediadev committed Sep 24, 2024
1 parent 63066e5 commit a781e11
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 5 deletions.
25 changes: 25 additions & 0 deletions media_common/agnostic/common/hw/mhw_vebox.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
//!
#define MHW_MAX_VEBOX_STATES 16

//!
//! \brief Vebox engine class ID value from https://gfxspecs.intel.com/Predator/Home/Index/60421
//!
#define MHW_VEBOX_ENGINE_CLASS_ID 2

#define MHW_PI 3.14159265358979324f //!< Definition the const pi

//!
Expand Down Expand Up @@ -858,13 +863,27 @@ typedef struct _MHW_VEBOX_SURFACE_CNTL_PARAMS
MOS_RESOURCE_MMC_MODE CompressionMode;
} MHW_VEBOX_SURFACE_CNTL_PARAMS, *PMHW_VEBOX_SURFACE_CNTL_PARAMS;

//!
//! \brief VEBOX Engine ID data struct in accordance with CommandStreamEngineIDDefintionRegister
//!
typedef struct _MHW_VEBOX_ENGINE_DATA
{
uint32_t classId : 3;
uint32_t reserved1 : 1;
uint32_t instanceId : 6;
uint32_t reserved2 : 22;
} MHW_VEBOX_ENGINE_DATA, *PMHW_VEBOX_ENGINE_DATA;

//!
//! \brief VEBOX Heap State Structure
//!
typedef struct _MHW_VEBOX_HEAP_STATE
{
bool bBusy; // true if the state is in use (must sync before use)
uint32_t dwSyncTag; // Vebox heap state sync tag
#if (_DEBUG || _RELEASE_INTERNAL)
volatile MHW_VEBOX_ENGINE_DATA *engineData; // Pointer to EngineIDDefintion Register data
#endif
} MHW_VEBOX_HEAP_STATE, *PMHW_VEBOX_HEAP_STATE;

//!
Expand All @@ -882,6 +901,9 @@ typedef struct _MHW_VEBOX_HEAP
uint32_t uiCapturePipeStateOffset; // Capture Pipe state offset
uint32_t uiGammaCorrectionStateOffset; // Gamma Correction state offset
uint32_t uiHdrStateOffset; // Hdr State offset
#if (_DEBUG || _RELEASE_INTERNAL)
uint32_t uiEngineDataOffset; // Engine data Offset
#endif
uint32_t uiInstanceSize; // Size of single instance of VEBOX states
uint32_t uiStateHeapSize; // Total size of VEBOX States heap
PMHW_VEBOX_HEAP_STATE pStates; // Array of VEBOX Heap States
Expand Down Expand Up @@ -909,6 +931,9 @@ typedef struct
uint32_t uiCapturePipeStateSize; // Capture Pipe State Size (Gen8+)
uint32_t uiGammaCorrectionStateSize; // Gamma Correction State Size (Gen9+)
uint32_t uiHdrStateSize; // HDR State Size
#if (_DEBUG || _RELEASE_INTERNAL)
uint32_t uiEngineDataSize; // Engine data Size
#endif
} MHW_VEBOX_SETTINGS, *PMHW_VEBOX_SETTINGS;
typedef const MHW_VEBOX_SETTINGS CMHW_VEBOX_SETTINGS, *PCMHW_VEBOX_SETTINGS;

Expand Down
5 changes: 4 additions & 1 deletion media_softlet/agnostic/common/hw/mhw_vebox_cmdpar.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,10 @@ const MHW_VEBOX_SETTINGS g_Vebox_Settings =
MHW_PAGE_SIZE, //!< uiVertexTableSize
MHW_PAGE_SIZE, //!< uiCapturePipeStateSize
MHW_PAGE_SIZE * 2, //!< uiGammaCorrectionStateSize
MHW_PAGE_SIZE * 18 //!< uiHdrStateSize
MHW_PAGE_SIZE * 18, //!< uiHdrStateSize
#if (_DEBUG || _RELEASE_INTERNAL)
0 //!< uiEngineDataSize
#endif
};

enum MHW_VEBOX_INDEX
Expand Down
62 changes: 59 additions & 3 deletions media_softlet/agnostic/common/hw/mhw_vebox_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ class Impl : public Itf, public mhw::Impl

if (m_veboxHeap)
{
#if (_DEBUG || _RELEASE_INTERNAL)
ReportVeboxId();
#endif
if (!Mos_ResourceIsNull(&m_veboxHeap->DriverResource))
{
if (m_veboxHeap->pLockedDriverResourceMem)
Expand Down Expand Up @@ -273,7 +276,13 @@ class Impl : public Itf, public mhw::Impl

m_veboxHeap->uiHdrStateOffset = uiOffset;
uiOffset += m_veboxSettings.uiHdrStateSize;

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_veboxIdReportEnabled)
{
m_veboxHeap->uiEngineDataOffset = uiOffset;
uiOffset += m_veboxSettings.uiEngineDataSize;
}
#endif
m_veboxHeap->uiInstanceSize = uiOffset;

// Appending VeboxHeap sync data after all vebox heap instances
Expand Down Expand Up @@ -570,8 +579,24 @@ class Impl : public Itf, public mhw::Impl
pVeboxHeap->uiNextState = (pVeboxHeap->uiNextState + 1) %
(m_veboxSettings.uiNumInstances);

//Clean the memory of current veboxheap to avoid the history states
uiOffset = pVeboxHeap->uiCurState * pVeboxHeap->uiInstanceSize;
#if (_DEBUG || _RELEASE_INTERNAL)
if (m_veboxIdReportEnabled)
{
if (pVeboxCurState->engineData && MHW_VEBOX_ENGINE_CLASS_ID ==(*pVeboxCurState->engineData).classId)
{
// Record old engine instance id before memory clearance when reusing heap state
m_usedVeboxID |= 1 << (*pVeboxCurState->engineData).instanceId;
}
if (nullptr == pVeboxCurState->engineData)
{
pVeboxCurState->engineData =
(MHW_VEBOX_ENGINE_DATA*)(pVeboxHeap->pLockedDriverResourceMem + uiOffset +
pVeboxHeap->uiEngineDataOffset);
}
}
#endif
//Clean the memory of current veboxheap to avoid the history states
MOS_ZeroMemory(pVeboxHeap->pLockedDriverResourceMem + uiOffset, pVeboxHeap->uiInstanceSize);

return eStatus;
Expand Down Expand Up @@ -864,6 +889,34 @@ class Impl : public Itf, public mhw::Impl

return eStatus;
}

bool IsVeboxIdReportEnabled() override
{
return m_veboxIdReportEnabled;
}

MOS_STATUS ReportVeboxId() override
{
if (m_veboxIdReportEnabled)
{
MHW_CHK_NULL_RETURN(m_veboxHeap);
MHW_CHK_NULL_RETURN(m_veboxHeap->pStates);
for (uint32_t index = 0; index < m_veboxSettings.uiNumInstances; index++)
{
const MHW_VEBOX_HEAP_STATE &curInstance = m_veboxHeap->pStates[index];
if (curInstance.engineData && MHW_VEBOX_ENGINE_CLASS_ID == (*curInstance.engineData).classId)
{
m_usedVeboxID |= 1 << (*curInstance.engineData).instanceId;
}
}
ReportUserSettingForDebug(
m_userSettingPtr,
__MEDIA_USER_FEATURE_VALUE_USED_VEBOX_ID,
m_usedVeboxID,
MediaUserSetting::Group::Sequence);
}
return MOS_STATUS_SUCCESS;
}
#endif

MOS_STATUS VeboxAdjustBoundary(
Expand Down Expand Up @@ -1044,7 +1097,10 @@ class Impl : public Itf, public mhw::Impl
MHW_VEBOX_GAMUT_PARAMS m_veboxGamutParams = {};

int m_veboxHeapInUse = 0;

#if (_DEBUG || _RELEASE_INTERNAL)
bool m_veboxIdReportEnabled = false;
uint32_t m_usedVeboxID = 0;
#endif
MEDIA_CLASS_DEFINE_END(mhw__vebox__Impl)
};
} // namespace render
Expand Down
4 changes: 4 additions & 0 deletions media_softlet/agnostic/common/hw/mhw_vebox_itf.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ class Itf
virtual MOS_STATUS Add1DLutState(void *&surface, PMHW_1DLUT_PARAMS p1DLutParams) = 0;

virtual MOS_STATUS AddFP16State(PMHW_FP16_PARAMS pFP16Params) = 0;
#if (_DEBUG || _RELEASE_INTERNAL)
virtual bool IsVeboxIdReportEnabled() = 0;

virtual MOS_STATUS ReportVeboxId() = 0;
#endif
_VEBOX_CMD_DEF(_MHW_CMD_ALL_DEF_FOR_ITF);

MEDIA_CLASS_DEFINE_END(mhw__vebox__Itf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,9 @@ MOS_STATUS VpVeboxCmdPacket::RenderVeboxCmd(
VP_RENDER_CHK_STATUS_RETURN(pRenderHal->pRenderHalPltInterface->AddPerfCollectStartCmd(pRenderHal, pOsInterface, pCmdBufferInUse));

VP_RENDER_CHK_STATUS_RETURN(NullHW::StartPredicateNext(pOsInterface, m_miItf, pCmdBufferInUse));

#if (_DEBUG || _RELEASE_INTERNAL)
VP_RENDER_CHK_STATUS_RETURN(StoreCSEngineIdRegMem(pCmdBufferInUse, pVeboxHeap));
#endif
// Add compressible info of input/output surface to log
if (this->m_currentSurface && VeboxSurfaceStateCmdParams.pSurfOutput)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,14 @@ class VpVeboxCmdPacket : virtual public VpVeboxCmdPacketBase
{
return MOS_STATUS_SUCCESS;
}

virtual MOS_STATUS StoreCSEngineIdRegMem(
MOS_COMMAND_BUFFER *cmdBuffer,
const MHW_VEBOX_HEAP *veboxHeap)
{
return MOS_STATUS_SUCCESS;
}

#endif

protected:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,20 @@ MOS_STATUS VpUserSetting::InitVpUserSetting(MediaUserSettingSharedPtr userSettin
0,
true);

DeclareUserSettingKeyForDebug(
userSettingPtr,
__MEDIA_USER_FEATURE_VALUE_ENABLE_VEBOX_ID_REPORT,
MediaUserSetting::Group::Sequence,
0,
true);

DeclareUserSettingKeyForDebug(
userSettingPtr,
__MEDIA_USER_FEATURE_VALUE_USED_VEBOX_ID,
MediaUserSetting::Group::Sequence,
0,
true);

#endif

return MOS_STATUS_SUCCESS;
Expand Down
3 changes: 3 additions & 0 deletions media_softlet/agnostic/common/vp/hal/utils/vp_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ class Trace
#define __MEDIA_USER_FEATURE_VALUE_VP_L0_FC_REPORT "L0 FC Diff Report"

#define __MEDIA_USER_FEATURE_VALUE_ENABLE_VESFC_LINEAR_OUTPUT_BY_TILECONVERT "Enable VESFC Linearoutput By TileConvert"

#define __MEDIA_USER_FEATURE_VALUE_ENABLE_VEBOX_ID_REPORT "Enable VEBOX ID REPORT"
#define __MEDIA_USER_FEATURE_VALUE_USED_VEBOX_ID "USED VEBOX ID"
#endif //(_DEBUG || _RELEASE_INTERNAL)

class VpUtils
Expand Down

0 comments on commit a781e11

Please sign in to comment.