Skip to content

Commit

Permalink
[Media Common] [VP] Add etw trace for media copy info
Browse files Browse the repository at this point in the history
* Refine mediacopy trace and update etw manifest

* keep start/end trace for perf analysis

* update manifest

---------

Co-authored-by: gfxbot <[email protected]>
  • Loading branch information
2 people authored and intel-mediadev committed Sep 12, 2024
1 parent d4e9742 commit f31a212
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ MOS_STATUS BltState::CopyMainSurface(

BLT_CHK_NULL_RETURN(src);
BLT_CHK_NULL_RETURN(dst);
MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_START, nullptr, 0, nullptr, 0);

MOS_ZeroMemory(&bltStateParam, sizeof(BLT_STATE_PARAM));
bltStateParam.bCopyMainSurface = true;
Expand All @@ -148,7 +147,6 @@ MOS_STATUS BltState::CopyMainSurface(

BLT_CHK_STATUS_RETURN(SubmitCMD(&bltStateParam));

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
return MOS_STATUS_SUCCESS;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,6 @@ MOS_STATUS BltState_Xe_Hpm::CopyMainSurface(
BLT_CHK_NULL_RETURN(dst);
BLT_CHK_NULL_RETURN(src->pGmmResInfo);
BLT_CHK_NULL_RETURN(dst->pGmmResInfo);
MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_START, nullptr, 0, nullptr, 0);

MOS_ZeroMemory(&bltStateParam, sizeof(BLT_STATE_PARAM));
bltStateParam.bCopyMainSurface = true;
Expand All @@ -918,6 +917,5 @@ MOS_STATUS BltState_Xe_Hpm::CopyMainSurface(
BLT_CHK_STATUS_RETURN(SubmitCMD(&bltStateParam));
}

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
return MOS_STATUS_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ MOS_STATUS BltStateXe_Xpm::CopyMainSurface(

BLT_CHK_NULL_RETURN(src);
BLT_CHK_NULL_RETURN(dst);
MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_START, nullptr, 0, nullptr, 0);

MOS_ZeroMemory(&bltStateParam, sizeof(BLT_STATE_PARAM));
bltStateParam.bCopyMainSurface = true;
Expand All @@ -800,6 +799,5 @@ MOS_STATUS BltStateXe_Xpm::CopyMainSurface(

BLT_CHK_STATUS_RETURN(SubmitCMD(&bltStateParam));

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
return MOS_STATUS_SUCCESS;
}
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ MOS_STATUS BltStateXe_Xpm_Plus::CopyMainSurface(

BLT_CHK_NULL_RETURN(src);
BLT_CHK_NULL_RETURN(dst);
MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_START, nullptr, 0, nullptr, 0);

MOS_ZeroMemory(&bltStateParam, sizeof(BLT_STATE_PARAM));
bltStateParam.bCopyMainSurface = true;
Expand All @@ -635,7 +634,6 @@ MOS_STATUS BltStateXe_Xpm_Plus::CopyMainSurface(

BLT_CHK_STATUS_RETURN(SubmitCMD(&bltStateParam));

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
return MOS_STATUS_SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ MOS_STATUS BltStateNext::CopyMainSurface(
BLT_CHK_NULL_RETURN(dst);
BLT_CHK_NULL_RETURN(src->pGmmResInfo);
BLT_CHK_NULL_RETURN(dst->pGmmResInfo);
MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_START, nullptr, 0, nullptr, 0);

MOS_ZeroMemory(&BltStateNextParam, sizeof(BLT_STATE_PARAM));
BltStateNextParam.bCopyMainSurface = true;
Expand All @@ -667,7 +666,6 @@ MOS_STATUS BltStateNext::CopyMainSurface(
BLT_CHK_STATUS_RETURN(SubmitCMD(&BltStateNextParam));
}

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
return MOS_STATUS_SUCCESS;

}
Expand Down
25 changes: 25 additions & 0 deletions media_softlet/agnostic/common/shared/mediacopy/media_copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ MOS_STATUS MediaCopyBaseState::ValidateResource(const MOS_SURFACE &src, const MO
//!
MOS_STATUS MediaCopyBaseState::SurfaceCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst, MCPY_METHOD preferMethod)
{
MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_START, nullptr, 0, nullptr, 0);
MOS_STATUS eStatus = MOS_STATUS_SUCCESS;

MOS_SURFACE SrcResDetails, DstResDetails;
Expand Down Expand Up @@ -449,6 +450,29 @@ MOS_STATUS MediaCopyBaseState::SurfaceCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst,
MT_SURF_TILE_TYPE, DstResDetails.TileType,
MT_SURF_COMP_MODE, mcpyDst.CompressionMode);

#if (_DEBUG || _RELEASE_INTERNAL) && !defined(LINUX)
TRACEDATA_MEDIACOPY eventData = {0};
TRACEDATA_MEDIACOPY_INIT(
eventData,
src->AllocationInfo.m_AllocationHandle,
SrcResDetails.dwWidth,
SrcResDetails.dwHeight,
SrcResDetails.Format,
*((int64_t *)&src->pGmmResInfo->GetResFlags().Gpu),
*((int64_t *)&src->pGmmResInfo->GetResFlags().Info),
src->pGmmResInfo->GetSetCpSurfTag(0, 0),
dst->AllocationInfo.m_AllocationHandle,
DstResDetails.dwWidth,
DstResDetails.dwHeight,
DstResDetails.Format,
*((int64_t *)&dst->pGmmResInfo->GetResFlags().Gpu),
*((int64_t *)&dst->pGmmResInfo->GetResFlags().Info),
dst->pGmmResInfo->GetSetCpSurfTag(0, 0)
);

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_INFO, &eventData, sizeof(eventData), nullptr, 0);
#endif

MCPY_CHK_STATUS_RETURN(PreCheckCpCopy(mcpySrc, mcpyDst, preferMethod));

MCPY_CHK_STATUS_RETURN(CapabilityCheck(SrcResDetails.Format,
Expand All @@ -461,6 +485,7 @@ MOS_STATUS MediaCopyBaseState::SurfaceCopy(PMOS_RESOURCE src, PMOS_RESOURCE dst,

MCPY_CHK_STATUS_RETURN(TaskDispatch(mcpySrc, mcpyDst, mcpyEngine));

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
return eStatus;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ MOS_STATUS MediaMemDeCompNext::MemoryDecompress(PMOS_RESOURCE targetResource)
{
VPHAL_MEMORY_DECOMP_CHK_NULL_RETURN(m_renderMutex);
MosUtilities::MosLockMutex(m_renderMutex);

#if (_DEBUG || _RELEASE_INTERNAL) && !defined(LINUX)
TRACEDATA_MEDIA_MEM_DECOMP eventData = {0};
TRACEDATA_MEDIA_MEM_DECOMP_INIT(
eventData,
targetResource->AllocationInfo.m_AllocationHandle,
targetSurface.dwWidth,
targetSurface.dwHeight,
targetSurface.Format,
*((int64_t *)&targetResource->pGmmResInfo->GetResFlags().Gpu),
*((int64_t *)&targetResource->pGmmResInfo->GetResFlags().Info)
);
MOS_TraceEventExt(EVENT_DDI_MEDIA_MEM_DECOMP_CALLBACK, EVENT_TYPE_INFO, &eventData, sizeof(eventData), nullptr, 0);
#endif
eStatus = RenderDecompCMD(&targetSurface);
if (eStatus != MOS_STATUS_SUCCESS)
{
Expand Down Expand Up @@ -267,7 +281,30 @@ MOS_STATUS MediaMemDeCompNext::MediaMemoryCopy(PMOS_RESOURCE inputResource, PMOS
MOS_GPU_CONTEXT_VEBOX,
false);

VPHAL_MEMORY_DECOMP_CHK_STATUS_RETURN(RenderDoubleBufferDecompCMD(&sourceSurface, &targetSurface));
#if (_DEBUG || _RELEASE_INTERNAL) && !defined(LINUX)
TRACEDATA_MEDIACOPY eventData = {0};
TRACEDATA_MEDIACOPY_INIT(
eventData,
inputResource->AllocationInfo.m_AllocationHandle,
targetSurface.dwWidth,
targetSurface.dwHeight,
targetSurface.Format,
*((int64_t *)&inputResource->pGmmResInfo->GetResFlags().Gpu),
*((int64_t *)&inputResource->pGmmResInfo->GetResFlags().Info),
inputResource->pGmmResInfo->GetSetCpSurfTag(0, 0),
outputResource->AllocationInfo.m_AllocationHandle,
targetSurface.dwWidth,
targetSurface.dwHeight,
targetSurface.Format,
*((int64_t *)&outputResource->pGmmResInfo->GetResFlags().Gpu),
*((int64_t *)&outputResource->pGmmResInfo->GetResFlags().Info),
outputResource->pGmmResInfo->GetSetCpSurfTag(0, 0)

);
MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_INFO, &eventData, sizeof(eventData), nullptr, 0);
#endif

VPHAL_MEMORY_DECOMP_CHK_STATUS_RETURN(RenderDoubleBufferDecompCMD(&targetSurface, &targetSurface));

MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);
return eStatus;
Expand Down

0 comments on commit f31a212

Please sign in to comment.