Skip to content

Commit

Permalink
[Decode] Enable engine id report for test
Browse files Browse the repository at this point in the history
Enable engine id report for decode tests and remove some duplicated mos interfaces
  • Loading branch information
LhGu authored and intel-mediadev committed Feb 11, 2025
1 parent 3bb6158 commit 9c9298c
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
#define __MEDIA_USER_FEATURE_VALUE_SIM_ENABLE "Simulation Enable"
#define __MEDIA_USER_FEATURE_VALUE_SIM_IN_USE "Simulation In Use"

#define __MEDIA_USER_FEATURE_VALUE_ENABLE_VDBOX_ID_REPORT "Enable VDBOX ID Report"
#define __MEDIA_USER_FEATURE_VALUE_ENABLE_VE_DEBUG_OVERRIDE "Enable VE Debug Override"
#define __MEDIA_USER_FEATURE_VALUE_FORCE_VDBOX "Force VDBOX"
#define __MEDIA_USER_FEATURE_VALUE_FORCE_VEBOX "Force VEBOX"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace decode {

DecodeAv1StatusReportXe2_Lpm_Base::DecodeAv1StatusReportXe2_Lpm_Base(
DecodeAllocator* allocator, bool enableRcs, PMOS_INTERFACE osInterface):
DecodeStatusReport(allocator, enableRcs)
DecodeStatusReport(allocator, enableRcs, osInterface)
{
DECODE_FUNC_CALL()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace decode {

DecodeAv1StatusReportXe3_Lpm_Base::DecodeAv1StatusReportXe3_Lpm_Base(
DecodeAllocator* allocator, bool enableRcs, PMOS_INTERFACE osInterface):
DecodeStatusReport(allocator, enableRcs)
DecodeStatusReport(allocator, enableRcs, osInterface)
{
DECODE_FUNC_CALL()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace decode {
class DecodeAllocator;
DecodeAv1StatusReportXe_Lpm_Plus_Base::DecodeAv1StatusReportXe_Lpm_Plus_Base(
DecodeAllocator* allocator, bool enableRcs, PMOS_INTERFACE osInterface):
DecodeStatusReport(allocator, enableRcs)
DecodeStatusReport(allocator, enableRcs, osInterface)
{
DECODE_FUNC_CALL()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ MOS_STATUS Av1DecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER*
DECODE_CHK_NULL(perfProfiler);
DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd(
(void*)m_av1Pipeline, m_osInterface, m_miItf, cmdBuffer));

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_statusReport && m_statusReport->IsVdboxIdReportEnabled())
{
StoreEngineId(cmdBuffer, decode::DecodeStatusReportType::CsEngineIdOffset_0);
}
#endif
return MOS_STATUS_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,12 @@ MOS_STATUS AvcDecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER *
DECODE_CHK_NULL(perfProfiler);
DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd(
(void *)m_avcPipeline, m_osInterface, m_miItf, cmdBuffer));

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_statusReport && m_statusReport->IsVdboxIdReportEnabled())
{
StoreEngineId(cmdBuffer, decode::DecodeStatusReportType::CsEngineIdOffset_0);
}
#endif
return MOS_STATUS_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,11 @@ MOS_STATUS HevcDecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER*
DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd((void *)m_hevcPipeline, m_osInterface, m_miItf, cmdBuffer));

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_statusReport && m_statusReport->IsVdboxIdReportEnabled())
{
DECODE_CHK_NULL(m_phase);
StoreEngineId(cmdBuffer, decode::DecodeStatusReportType::CsEngineIdOffset_0, m_phase->GetPipe());
}
if (m_osInterface->bNullHwIsEnabled)
{
DecodeNullHWProxyTestPkt *nullhwProxy = DecodeNullHWProxyTestPkt::Instance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,12 @@ MOS_STATUS JpegDecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER*
DECODE_CHK_NULL(perfProfiler);
DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd(
(void*)m_jpegPipeline, m_osInterface, m_miItf, cmdBuffer));

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_statusReport && m_statusReport->IsVdboxIdReportEnabled())
{
StoreEngineId(cmdBuffer, decode::DecodeStatusReportType::CsEngineIdOffset_0);
}
#endif
return MOS_STATUS_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,12 @@ MOS_STATUS Mpeg2DecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER
DECODE_CHK_NULL(perfProfiler);
DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd(
(void*)m_mpeg2Pipeline, m_osInterface, m_miItf, cmdBuffer));

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_statusReport && m_statusReport->IsVdboxIdReportEnabled())
{
StoreEngineId(cmdBuffer, decode::DecodeStatusReportType::CsEngineIdOffset_0);
}
#endif
return MOS_STATUS_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,18 @@ MOS_STATUS DecodePipeline::ReportVdboxIds(const DecodeStatusMfx& status)
{
DECODE_FUNC_CALL();

// report the VDBOX IDs to user feature
uint32_t vdboxIds = ReadUserFeature(m_userSettingPtr, "Used VDBOX ID", MediaUserSetting::Group::Sequence).Get<uint32_t>();
uint32_t vdboxIds = 0;
uint32_t reportedVdboxIds = 0;
// Must add MEDIA_USER_SETTING_INTERNAL_REPORT for different reading path.
ReadUserSettingForDebug(
m_userSettingPtr,
reportedVdboxIds,
"Used VDBOX ID",
MediaUserSetting::Group::Sequence,
0,
false,
MEDIA_USER_SETTING_INTERNAL_REPORT);
vdboxIds = reportedVdboxIds;
for (auto i = 0; i < csInstanceIdMax; i++)
{
CsEngineId csEngineId;
Expand All @@ -580,7 +590,7 @@ MOS_STATUS DecodePipeline::ReportVdboxIds(const DecodeStatusMfx& status)
}
}

if (vdboxIds != 0)
if (vdboxIds != reportedVdboxIds)
{
WriteUserFeature(__MEDIA_USER_FEATURE_VALUE_VDBOX_ID_USED, vdboxIds, m_osInterface->pOsContext);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ namespace decode {
m_osInterface(osInterface)
{
m_sizeOfReport = sizeof(DecodeStatusReportData);
#if (_DEBUG || _RELEASE_INTERNAL)
if (osInterface && osInterface->pfnGetUserSettingInstance)
{
auto userSetting = osInterface->pfnGetUserSettingInstance(osInterface);
ReadUserSettingForDebug(
userSetting,
m_enableVdboxIdReport,
__MEDIA_USER_FEATURE_VALUE_ENABLE_VDBOX_ID_REPORT,
MediaUserSetting::Group::Device);
}
#endif
}

DecodeStatusReport::~DecodeStatusReport()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace decode {
class DecodeStatusReport : public MediaStatusReport
{
public:
DecodeStatusReport(DecodeAllocator *alloc, bool enableRcs, PMOS_INTERFACE osInterface = nullptr);
DecodeStatusReport(DecodeAllocator *alloc, bool enableRcs, PMOS_INTERFACE osInterface);
virtual ~DecodeStatusReport();

//!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,13 @@ MOS_STATUS Vp9DecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER*
DECODE_CHK_NULL(perfProfiler);
DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd(
(void*)m_vp9Pipeline, m_osInterface, m_miItf, cmdBuffer));

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_statusReport && m_statusReport->IsVdboxIdReportEnabled())
{
DECODE_CHK_NULL(m_phase);
StoreEngineId(cmdBuffer, decode::DecodeStatusReportType::CsEngineIdOffset_0, m_phase->GetPipe());
}
#endif
return MOS_STATUS_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,12 @@ MOS_STATUS VvcDecodePkt::StartStatusReport(uint32_t srType, MOS_COMMAND_BUFFER*
DECODE_CHK_NULL(perfProfiler);
DECODE_CHK_STATUS(perfProfiler->AddPerfCollectStartCmd(
(void *)m_vvcPipeline, m_osInterface, m_miItf, cmdBuffer));

#if (_DEBUG || _RELEASE_INTERNAL)
if (m_statusReport && m_statusReport->IsVdboxIdReportEnabled())
{
StoreEngineId(cmdBuffer, decode::DecodeStatusReportType::CsEngineIdOffset_0);
}
#endif
return MOS_STATUS_SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions media_softlet/agnostic/common/hw/mhw_mmio_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ static constexpr uint32_t CS_GENERAL_PURPOSE_REGISTER11_HI_OFFSET
static constexpr uint32_t CS_GENERAL_PURPOSE_REGISTER12_LO_OFFSET = 0x2660;
static constexpr uint32_t CS_GENERAL_PURPOSE_REGISTER12_HI_OFFSET = 0x2664;
static constexpr uint32_t CS_PREDICATE_RESULT2 = 0x23BC;
static constexpr uint32_t CS_ENGINE_ID_OFFSET = 0x1C008C;

// Vebox register offsets
// Used in Commen MI
Expand Down
7 changes: 7 additions & 0 deletions media_softlet/agnostic/common/os/mos_user_setting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,13 @@ MOS_STATUS MosUserSetting::InitUserSettingForDebug(MediaUserSettingSharedPtr use
true,
USER_SETTING_CONFIG_PERMANENT_PATH);//"If enabled, specify this is in pre-si simulation/emulation mode."

DeclareUserSettingKeyForDebug(
userSettingPtr,
__MEDIA_USER_FEATURE_VALUE_ENABLE_VDBOX_ID_REPORT,
MediaUserSetting::Group::Device,
0,
true); //"Enable Vdbox physical engine id report"

DeclareUserSettingKeyForDebug(
userSettingPtr,
__MEDIA_USER_FEATURE_VALUE_FORCE_VDBOX,
Expand Down
9 changes: 9 additions & 0 deletions media_softlet/agnostic/common/shared/packet/media_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ class MediaPacket
return "";
}

#if (_DEBUG || _RELEASE_INTERNAL)
//!
//! \brief Store engine id data
//! \return MOS_STATUS
//! MOS_STATUS_SUCCESS if success, else fail
//!
MOS_STATUS StoreEngineId(MOS_COMMAND_BUFFER *cmdBuffer, uint32_t statusReportType, uint8_t curPipe = 0, uint32_t csEngineIdReg = CS_ENGINE_ID_OFFSET);
#endif

protected:

//!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,27 @@ MOS_STATUS MediaPacket::SetEndTagNext(
MEDIA_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_STORE_DATA_IMM)(cmdBuffer));

return MOS_STATUS_SUCCESS;
}
}

#if (_DEBUG || _RELEASE_INTERNAL)
MOS_STATUS MediaPacket::StoreEngineId(MOS_COMMAND_BUFFER *cmdBuffer, uint32_t statusReportType, uint8_t curPipe, uint32_t csEngineIdReg)
{
MEDIA_CHK_NULL_RETURN(m_miItf);
MEDIA_CHK_NULL_RETURN(m_statusReport);

MOS_RESOURCE* osResource = nullptr;
uint32_t offset = 0;

auto &par = m_miItf->MHW_GETPAR_F(MI_STORE_REGISTER_MEM)();
par = {};

MEDIA_CHK_STATUS_RETURN(m_statusReport->GetAddress(statusReportType, osResource, offset));
par.presStoreBuffer = osResource;
par.dwOffset = offset + curPipe * sizeof(uint32_t);
par.dwRegister = csEngineIdReg;

MEDIA_CHK_STATUS_RETURN(m_miItf->MHW_ADDCMD_F(MI_STORE_REGISTER_MEM)(cmdBuffer));

return MOS_STATUS_SUCCESS;
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ class MediaStatusReport
//!
uint32_t GetSubmittedCount() const { return m_submittedCount; }

#if (_DEBUG || _RELEASE_INTERNAL)
//!
//! \brief Is Vdbox physical id reporting enabled
//! \return m_enableVdboxIdReport
//!
uint32_t IsVdboxIdReportEnabled()
{
return m_enableVdboxIdReport;
}
#endif
//!
//! \brief Get completed count of status report.
//! \return The content of m_completedCount
Expand Down Expand Up @@ -201,6 +211,9 @@ class MediaStatusReport

StatusBufAddr *m_statusBufAddr = nullptr;

#if (_DEBUG || _RELEASE_INTERNAL)
bool m_enableVdboxIdReport = false;
#endif
std::recursive_mutex m_lock;
std::vector<MediaStatusReportObserver *> m_completeObservers;
MEDIA_CLASS_DEFINE_END(MediaStatusReport)
Expand Down

0 comments on commit 9c9298c

Please sign in to comment.