Skip to content

Commit

Permalink
[Decode] Fix MediaUL dumping issue
Browse files Browse the repository at this point in the history
MediaUL full test issue fix
  • Loading branch information
chuanli1 authored and intel-mediadev committed Jan 8, 2024
1 parent 32b7f55 commit 9a03376
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 13 deletions.
38 changes: 37 additions & 1 deletion media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ MOS_STATUS CodechalDecodeAvc::InitPicMhwParams(
&dstSurface));

m_debugInterface->m_refIndex = frameId;
std::string refSurfName = "RefSurf" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex));
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex)) + "]";
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpYUVSurface(
&dstSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down Expand Up @@ -1606,6 +1606,42 @@ MOS_STATUS CodechalDecodeAvc::InitPicMhwParams(
picMhwParams->AvcDirectmodeParams.bPicIdRemappingInUse = m_picIdRemappingInUse;
picMhwParams->AvcDirectmodeParams.presMvcDummyDmvBuffer = &(m_resMvcDummyDmvBuffer[(m_avcPicParams->seq_fields.direct_8x8_inference_flag) ? 1 : 0]);

CODECHAL_DEBUG_TOOL(

CODEC_REF_LIST * *refList;
MHW_MI_CHK_NULL(refList = (CODEC_REF_LIST **)picMhwParams->AvcDirectmodeParams.avcRefList);

for (auto i = 0; i < CODEC_MAX_NUM_REF_FRAME; i++)
{
if (picMhwParams->AvcDirectmodeParams.pAvcPicIdx[i].bValid)
{
uint8_t idx = picMhwParams->AvcDirectmodeParams.pAvcPicIdx[i].ucPicIdx;
uint8_t picID = picMhwParams->AvcDirectmodeParams.bPicIdRemappingInUse ? i : refList[idx]->ucFrameId;
uint8_t mvIdx = refList[idx]->ucDMVIdx[0];

if (&picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[i] != nullptr)
{
// dump Reference mvdata
std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(i);
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpBuffer(
&picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[mvIdx],
CodechalDbgAttr::attrMvData,
mvBufDumpName.c_str(),
m_avcDmvBufferSize));
}
}
}

if (&picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[picMhwParams->AvcDirectmodeParams.ucAvcDmvIdx])
{
// dump Current mvdata
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpBuffer(
&picMhwParams->AvcDirectmodeParams.presAvcDmvBuffers[picMhwParams->AvcDirectmodeParams.ucAvcDmvIdx],
CodechalDbgAttr::attrMvData,
"DEC_Cur_MV_",
m_avcDmvBufferSize));
});

return eStatus;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ MOS_STATUS CodechalDecodeMpeg2::DecodeStateLevel()
&dstSurface));

m_debugInterface->m_refIndex = (uint16_t)i;
std::string refSurfName = "RefSurf" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex));
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex)) + "]";
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpYUVSurface(
&dstSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3497,7 +3497,7 @@ MOS_STATUS CodechalDecodeVc1::DecodeStateLevel()
&dstSurface));

m_debugInterface->m_refIndex = (uint16_t)i;
std::string refSurfName = "RefSurf" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex));
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex)) + "]";
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpYUVSurface(
&dstSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,7 @@ MOS_STATUS CodechalDecodeHevcG12::SendPictureLongFormat()
m_osInterface,
&dstSurface));

std::string refSurfDumpName = "RefSurf_" + std::to_string(n);
std::string refSurfDumpName = "RefSurf[" + std::to_string(n) + "]";
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpYUVSurface(
&dstSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ MOS_STATUS CodechalDecodeMpeg2G12::DecodeStateLevel()
&dstSurface));

m_debugInterface->m_refIndex = (uint16_t)i;
std::string refSurfName = "RefSurf" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex));
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex)) + "]";
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpYUVSurface(
&dstSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ MOS_STATUS CodechalDecodeVc1G12::DecodeStateLevel()
&dstSurface));

m_debugInterface->m_refIndex = (uint16_t)i;
std::string refSurfName = "RefSurf" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex));
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(m_debugInterface->m_refIndex)) + "]";
CODECHAL_DECODE_CHK_STATUS_RETURN(m_debugInterface->DumpYUVSurface(
&dstSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ namespace decode{
avcDirectmodeParams.avcRefList = (void**)refFrames.m_refList;
avcDirectmodeParams.bPicIdRemappingInUse = m_avcBasicFeature->m_picIdRemappingInUse;

CODECHAL_DEBUG_TOOL(DECODE_CHK_STATUS(DumpResources(avcDirectmodeParams, curMvBuffer->size)));

return MOS_STATUS_SUCCESS;
}

Expand Down Expand Up @@ -578,6 +580,38 @@ namespace decode{
return MOS_STATUS_SUCCESS;
}

MOS_STATUS AvcDecodePicPktXe_M_Base::DumpResources(MHW_VDBOX_AVC_DIRECTMODE_PARAMS &avcDirectmodeParams, uint32_t mvBufferSize)
{
DECODE_FUNC_CALL();

CodechalDebugInterface *debugInterface = m_avcPipeline->GetDebugInterface();
for (auto n = 0; n < CODEC_AVC_MAX_NUM_REF_FRAME; n++)
{
if (m_avcBasicFeature->m_refFrames.m_avcPicIdx[n].bValid)
{
if (&avcDirectmodeParams.presAvcDmvBuffers[n+1] != nullptr)
{
std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(n);
DECODE_CHK_STATUS(debugInterface->DumpBuffer(
&avcDirectmodeParams.presAvcDmvBuffers[n+1],
CodechalDbgAttr::attrMvData,
mvBufDumpName.c_str(),
mvBufferSize));
}
}
}

if (&avcDirectmodeParams.presAvcDmvBuffers[0] != nullptr)
{
DECODE_CHK_STATUS(debugInterface->DumpBuffer(
&avcDirectmodeParams.presAvcDmvBuffers[0],
CodechalDbgAttr::attrMvData,
"DEC_Cur_MV_",
mvBufferSize));
}
return MOS_STATUS_SUCCESS;
}

#endif

}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ namespace decode
//! \return MOS_STATUS
//! MOS_STATUS_SUCCESS if success, else fail reason
//!
MOS_STATUS DumpResources(MHW_VDBOX_PIPE_BUF_ADDR_PARAMS& pipeBufAddrParams);
MOS_STATUS DumpResources(MHW_VDBOX_PIPE_BUF_ADDR_PARAMS &pipeBufAddrParams);

MOS_STATUS DumpResources(MHW_VDBOX_AVC_DIRECTMODE_PARAMS &avcDirectmodeParams, uint32_t mvBufferSize);

#ifdef _DECODE_PROCESSING_SUPPORTED
DecodeDownSamplingFeature *m_downSamplingFeature = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ MOS_STATUS HevcDecodePicPktXe_M_Base::DumpResources(
refSurface.OsResource = *(pipeBufAddrParams.presReferences[i]);
DECODE_CHK_STATUS(CodecHalGetResourceInfo(m_osInterface, &refSurface));

std::string refSurfDumpName = "RefSurf_" + std::to_string(i);
std::string refSurfDumpName = "RefSurf[" + std::to_string(i) + "]";
DECODE_CHK_STATUS(debugInterface->DumpYUVSurface(
&refSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ namespace decode{
MOS_ZeroMemory(&refSurface, sizeof(MOS_SURFACE));
refSurface.OsResource = *(pipeBufAddrParams.m_references[n + lastFrame]);
DECODE_CHK_STATUS(m_allocator->GetSurfaceInfo(&refSurface));
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(n + lastFrame)) + "]";
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(n)) + "]";
DECODE_CHK_STATUS(debugInterface->DumpYUVSurface(
&refSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ namespace decode{
MOS_ZeroMemory(&refSurface, sizeof(MOS_SURFACE));
refSurface.OsResource = *(par.refs[n + lastFrame]);
DECODE_CHK_STATUS(m_allocator->GetSurfaceInfo(&refSurface));
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(n + lastFrame)) + "]";
std::string refSurfName = "RefSurf[" + std::to_string(static_cast<uint32_t>(n)) + "]";
DECODE_CHK_STATUS(debugInterface->DumpYUVSurface(
&refSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ MHW_SETPAR_DECL_SRC(MFX_AVC_DIRECTMODE_STATE, AvcDecodePicPkt)
params.avcRefList = (void **)refFrames.m_refList;
params.bPicIdRemappingInUse = m_avcBasicFeature->m_picIdRemappingInUse;

CODECHAL_DEBUG_TOOL(DECODE_CHK_STATUS(DumpResources(curMvBuffer->size)));

return MOS_STATUS_SUCCESS;
}

Expand Down Expand Up @@ -621,13 +623,15 @@ MOS_STATUS AvcDecodePicPkt::AddAllCmds_MFX_QM_STATE(PMOS_COMMAND_BUFFER cmdBuffe
}

#if USE_CODECHAL_DEBUG_TOOL
MOS_STATUS AvcDecodePicPkt::DumpResources() const
MOS_STATUS AvcDecodePicPkt::DumpResources(uint32_t mvBufferSize) const
{
DECODE_FUNC_CALL();

CodechalDebugInterface *debugInterface = m_avcPipeline->GetDebugInterface();

auto &par = m_mfxItf->MHW_GETPAR_F(MFX_PIPE_BUF_ADDR_STATE)();
auto &mvParam = m_mfxItf->MHW_GETPAR_F(MFX_AVC_DIRECTMODE_STATE)();

for (auto n = 0; n < CODEC_AVC_MAX_NUM_REF_FRAME; n++)
{
if (m_avcBasicFeature->m_refFrames.m_avcPicIdx[n].bValid)
Expand All @@ -641,9 +645,28 @@ MOS_STATUS AvcDecodePicPkt::DumpResources() const
&destSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
refSurfName.c_str()));

if (&mvParam.presAvcDmvBuffers[n+1] != nullptr)
{
std::string mvBufDumpName = "_DEC_Ref_MV_" + std::to_string(n);
DECODE_CHK_STATUS(debugInterface->DumpBuffer(
&mvParam.presAvcDmvBuffers[n+1],
CodechalDbgAttr::attrMvData,
mvBufDumpName.c_str(),
mvBufferSize));
}
}
}

if (&mvParam.presAvcDmvBuffers[0] != nullptr)
{
DECODE_CHK_STATUS(debugInterface->DumpBuffer(
&mvParam.presAvcDmvBuffers[0],
CodechalDbgAttr::attrMvData,
"DEC_Cur_MV_",
mvBufferSize));
}

return MOS_STATUS_SUCCESS;
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class AvcDecodePicPkt : public DecodeSubPacket, public mhw::vdbox::mfx::Itf::Par
//! \return MOS_STATUS
//! MOS_STATUS_SUCCESS if success, else fail reason
//!
MOS_STATUS DumpResources() const;
MOS_STATUS DumpResources(uint32_t mvBufferSize) const;

#ifdef _DECODE_PROCESSING_SUPPORTED
DecodeDownSamplingFeature *m_downSamplingFeature = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ namespace decode
refSurface.OsResource = *(pipeBufAddrParams.presReferences[i]);
DECODE_CHK_STATUS(CodecUtilities::CodecHalGetResourceInfo(m_osInterface, &refSurface));

std::string refSurfDumpName = "RefSurf_" + std::to_string(i);
std::string refSurfDumpName = "RefSurf[" + std::to_string(i) + "]";
DECODE_CHK_STATUS(debugInterface->DumpYUVSurface(
&refSurface,
CodechalDbgAttr::attrDecodeReferenceSurfaces,
Expand Down

0 comments on commit 9a03376

Please sign in to comment.