Skip to content

Commit

Permalink
[Deode] VPL Trace event enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
chuanli1 authored and gfxVPLsdm committed Nov 12, 2024
1 parent 1501585 commit 5de4322
Show file tree
Hide file tree
Showing 12 changed files with 389 additions and 6 deletions.
14 changes: 14 additions & 0 deletions _studio/mfx_lib/decode/av1/src/mfx_av1_dec_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ mfxStatus VideoDECODEAV1::Reset(mfxVideoParam* par)
{
std::lock_guard<std::mutex> guard(m_guard);

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK_NULL_PTR1(par);

MFX_CHECK(m_is_init, MFX_ERR_NOT_INITIALIZED);
Expand Down Expand Up @@ -506,6 +509,8 @@ mfxStatus VideoDECODEAV1::Reset(mfxVideoParam* par)

m_decoder->SetInFrameRate(m_in_framerate);

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -700,6 +705,9 @@ mfxStatus VideoDECODEAV1::DecodeHeader(VideoCORE* core, mfxBitstream* bs, mfxVid

mfxStatus VideoDECODEAV1::GetVideoParam(mfxVideoParam *par)
{
TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK_NULL_PTR1(par);
MFX_CHECK(m_decoder, MFX_ERR_NOT_INITIALIZED);

Expand Down Expand Up @@ -758,14 +766,20 @@ mfxStatus VideoDECODEAV1::GetVideoParam(mfxVideoParam *par)
break;
}

TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}


mfxStatus VideoDECODEAV1::GetDecodeStat(mfxDecodeStat* stat)
{
TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0));

MFX_CHECK_NULL_PTR1(stat);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0, MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down
24 changes: 24 additions & 0 deletions _studio/mfx_lib/decode/h264/src/mfx_h264_dec_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ mfxStatus VideoDECODEH264::Reset(mfxVideoParam *par)

UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(par);
Expand Down Expand Up @@ -625,6 +628,8 @@ mfxStatus VideoDECODEH264::Reset(mfxVideoParam *par)
}
#endif //MFX_DEC_VIDEO_POSTPROCESS_DISABLE

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -673,6 +678,9 @@ mfxStatus VideoDECODEH264::GetVideoParam(mfxVideoParam *par)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(par);
Expand Down Expand Up @@ -799,6 +807,9 @@ mfxStatus VideoDECODEH264::GetVideoParam(mfxVideoParam *par)
}
}


TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -986,6 +997,8 @@ mfxStatus VideoDECODEH264::GetDecodeStat(mfxDecodeStat *stat)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(stat);
Expand All @@ -1007,6 +1020,9 @@ mfxStatus VideoDECODEH264::GetDecodeStat(mfxDecodeStat *stat)
m_stat.reserved[0] = m_pH264VideoDecoder->IsExistHeadersError() ? 1 : 0;

*stat = m_stat;

TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0, MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -1702,6 +1718,8 @@ mfxStatus VideoDECODEH264::GetPayload( mfxU64 *ts, mfxPayload *payload )
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(payload));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR3(ts, payload, payload->Data);
Expand Down Expand Up @@ -1729,6 +1747,8 @@ mfxStatus VideoDECODEH264::GetPayload( mfxU64 *ts, mfxPayload *payload )
*ts = MFX_TIME_STAMP_INVALID;
}

TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -1764,6 +1784,8 @@ mfxStatus VideoDECODEH264::SetSkipMode(mfxSkipMode mode)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(mode));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

int32_t test_num = 0;
Expand Down Expand Up @@ -1791,6 +1813,8 @@ mfxStatus VideoDECODEH264::SetSkipMode(mfxSkipMode mode)

m_pH264VideoDecoder->ChangeVideoDecodingSpeed(num);

TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(num ? MFX_WRN_VALUE_NOT_CHANGED : MFX_ERR_NONE));

return
test_num == num ? MFX_WRN_VALUE_NOT_CHANGED : MFX_ERR_NONE;
}
Expand Down
23 changes: 23 additions & 0 deletions _studio/mfx_lib/decode/h265/src/mfx_h265_dec_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ mfxStatus VideoDECODEH265::Reset(mfxVideoParam *par)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

m_globalTask = false;
Expand Down Expand Up @@ -434,6 +437,8 @@ mfxStatus VideoDECODEH265::Reset(mfxVideoParam *par)

MFX_CHECK(!isNeedChangeVideoParamWarning, MFX_WRN_INCOMPATIBLE_VIDEO_PARAM);

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -485,6 +490,9 @@ mfxStatus VideoDECODEH265::GetVideoParam(mfxVideoParam *par)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(par);
Expand Down Expand Up @@ -569,6 +577,8 @@ mfxStatus VideoDECODEH265::GetVideoParam(mfxVideoParam *par)
}
}

TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -765,6 +775,8 @@ mfxStatus VideoDECODEH265::GetDecodeStat(mfxDecodeStat *stat)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(stat);
Expand All @@ -783,6 +795,9 @@ mfxStatus VideoDECODEH265::GetDecodeStat(mfxDecodeStat *stat)
}

*stat = m_stat;

TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -1448,6 +1463,8 @@ mfxStatus VideoDECODEH265::GetPayload( mfxU64 *ts, mfxPayload *payload )
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(payload));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR3(ts, payload, payload->Data);
Expand Down Expand Up @@ -1477,6 +1494,8 @@ mfxStatus VideoDECODEH265::GetPayload( mfxU64 *ts, mfxPayload *payload )
*ts = MFX_TIME_STAMP_INVALID;
}

TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand All @@ -1500,6 +1519,8 @@ mfxStatus VideoDECODEH265::SetSkipMode(mfxSkipMode mode)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(mode));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

int32_t test_num = 0;
Expand All @@ -1526,6 +1547,8 @@ mfxStatus VideoDECODEH265::SetSkipMode(mfxSkipMode mode)

m_pH265VideoDecoder->ChangeVideoDecodingSpeed(num);

TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(test_num == num ? MFX_WRN_VALUE_NOT_CHANGED : MFX_ERR_NONE));

MFX_CHECK(test_num != num, MFX_WRN_VALUE_NOT_CHANGED);
return MFX_ERR_NONE;
}
Expand Down
20 changes: 20 additions & 0 deletions _studio/mfx_lib/decode/mjpeg/src/mfx_mjpeg_dec_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ mfxStatus VideoDECODEMJPEG::QueryImplsDescription(

mfxStatus VideoDECODEMJPEG::Reset(mfxVideoParam *par)
{
TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(par);
Expand Down Expand Up @@ -347,6 +350,8 @@ mfxStatus VideoDECODEMJPEG::Reset(mfxVideoParam *par)
MFX_RETURN(MFX_WRN_PARTIAL_ACCELERATION);
}

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -624,6 +629,8 @@ mfxStatus VideoDECODEMJPEG::QueryIOSurfInternal(VideoCORE *core, mfxVideoParam *

mfxStatus VideoDECODEMJPEG::GetDecodeStat(mfxDecodeStat *stat)
{
TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0));

if (!m_isInit)
MFX_RETURN(MFX_ERR_NOT_INITIALIZED);

Expand All @@ -633,6 +640,9 @@ mfxStatus VideoDECODEMJPEG::GetDecodeStat(mfxDecodeStat *stat)
decoder->m_stat.NumError = 0;

*stat = decoder->m_stat;

TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(stat ? stat->NumFrame : 0, MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -909,15 +919,19 @@ mfxStatus VideoDECODEMJPEG::GetUserData(mfxU8 *ud, mfxU32 *sz, mfxU64 *ts)

mfxStatus VideoDECODEMJPEG::GetPayload( mfxU64 *ts, mfxPayload *payload )
{
TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(payload));
if (!m_isInit)
MFX_RETURN(MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR3(ts, payload, payload->Data);
TRACE_EVENT(MFX_TRACE_API_DECODE_GETPAYLOAD_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_UNSUPPORTED));

MFX_RETURN(MFX_ERR_UNSUPPORTED);
}

mfxStatus VideoDECODEMJPEG::SetSkipMode(mfxSkipMode mode)
{
TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(mode));
// check error(s)
if (!m_isInit)
{
Expand Down Expand Up @@ -947,6 +961,7 @@ mfxStatus VideoDECODEMJPEG::SetSkipMode(mfxSkipMode mode)
m_skipRate = 0;
break;
}
TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;

Expand Down Expand Up @@ -1422,6 +1437,9 @@ VideoDECODEMJPEGBase::VideoDECODEMJPEGBase()

mfxStatus VideoDECODEMJPEGBase::GetVideoParam(mfxVideoParam *par, UMC::MJPEGVideoDecoderBaseMFX * mjpegDecoder)
{
TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

mfxExtJPEGQuantTables* jpegQT = (mfxExtJPEGQuantTables*) mfx::GetExtBuffer( par->ExtParam, par->NumExtParam, MFX_EXTBUFF_JPEG_QT );
mfxExtJPEGHuffmanTables* jpegHT = (mfxExtJPEGHuffmanTables*) mfx::GetExtBuffer( par->ExtParam, par->NumExtParam, MFX_EXTBUFF_JPEG_HUFFMAN );

Expand All @@ -1444,6 +1462,8 @@ mfxStatus VideoDECODEMJPEGBase::GetVideoParam(mfxVideoParam *par, UMC::MJPEGVide
return ConvertUMCStatusToMfx(umcRes);
}

TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down
18 changes: 18 additions & 0 deletions _studio/mfx_lib/decode/vp9/src/mfx_vp9_dec_decode_hw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ mfxStatus VideoDECODEVP9_HW::Reset(mfxVideoParam *par)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(par);
Expand Down Expand Up @@ -580,6 +583,8 @@ mfxStatus VideoDECODEVP9_HW::Reset(mfxVideoParam *par)
(mfxF64) m_vPar.mfx.FrameInfo.FrameRateExtD / m_vPar.mfx.FrameInfo.FrameRateExtN : (mfxF64) 1 / 30;
m_index = 0;

TRACE_EVENT(MFX_TRACE_API_DECODE_RESET_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -773,6 +778,9 @@ mfxStatus VideoDECODEVP9_HW::GetVideoParam(mfxVideoParam *par)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(par ? par->mfx.FrameInfo.Width : 0,
par ? par->mfx.FrameInfo.Height : 0, par ? par->mfx.CodecId : 0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(par);
Expand All @@ -795,11 +803,15 @@ mfxStatus VideoDECODEVP9_HW::GetVideoParam(mfxVideoParam *par)
}
#endif

TRACE_EVENT(MFX_TRACE_API_DECODE_GETVIDEOPARAM_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

mfxStatus VideoDECODEVP9_HW::GetDecodeStat(mfxDecodeStat *pStat)
{
TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

MFX_CHECK_NULL_PTR1(pStat);
Expand All @@ -809,6 +821,8 @@ mfxStatus VideoDECODEVP9_HW::GetDecodeStat(mfxDecodeStat *pStat)

*pStat = m_stat;

TRACE_EVENT(MFX_TRACE_API_DECODE_GETSTAT_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(pStat ? pStat->NumFrame : 0));

return MFX_ERR_NONE;
}

Expand Down Expand Up @@ -849,8 +863,12 @@ mfxStatus VideoDECODEVP9_HW::SetSkipMode(mfxSkipMode /*mode*/)
{
UMC::AutomaticUMCMutex guard(m_mGuard);

TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_START, TR_KEY_MFX_API, make_event_data(0));

MFX_CHECK(m_isInit, MFX_ERR_NOT_INITIALIZED);

TRACE_EVENT(MFX_TRACE_API_DECODE_SETSKIPMODE_TASK, EVENT_TYPE_END, TR_KEY_MFX_API, make_event_data(MFX_ERR_NONE));

return MFX_ERR_NONE;
}

Expand Down
Loading

0 comments on commit 5de4322

Please sign in to comment.