From b5958fdc74630516df24c0374aaae498174018f0 Mon Sep 17 00:00:00 2001 From: Xu_Colan Date: Sat, 14 Sep 2024 10:16:00 +0800 Subject: [PATCH] [Media Common] [VP] Refine and add etw trace for Media Copy 1. Remove start/end in copymain surface and move it to upper layer surface copy 2. add copy info trace --- .../shared/mediacopy/media_blt_copy.cpp | 2 - .../mediacopy/media_blt_copy_xe_hpm.cpp | 2 - .../mediacopy/media_blt_copy_xe_xpm_base.cpp | 2 - .../mediacopy/media_blt_copy_xe_xpm_plus.cpp | 2 - .../shared/mediacopy/media_blt_copy_next.cpp | 2 - .../common/shared/mediacopy/media_copy.cpp | 25 +++++++++++++ .../mmc/media_mem_decompression_next.cpp | 37 +++++++++++++++++++ 7 files changed, 62 insertions(+), 10 deletions(-) diff --git a/media_driver/agnostic/common/shared/mediacopy/media_blt_copy.cpp b/media_driver/agnostic/common/shared/mediacopy/media_blt_copy.cpp index 862f7e9ab01..8cac3d07485 100644 --- a/media_driver/agnostic/common/shared/mediacopy/media_blt_copy.cpp +++ b/media_driver/agnostic/common/shared/mediacopy/media_blt_copy.cpp @@ -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; @@ -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; } diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_blt_copy_xe_hpm.cpp b/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_blt_copy_xe_hpm.cpp index 3d807d26329..2fd0c7d6ea1 100644 --- a/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_blt_copy_xe_hpm.cpp +++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_HPM/shared/mediacopy/media_blt_copy_xe_hpm.cpp @@ -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; @@ -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; } \ No newline at end of file diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_blt_copy_xe_xpm_base.cpp b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_blt_copy_xe_xpm_base.cpp index 77a1f80924c..bfc87f1b2c7 100644 --- a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_blt_copy_xe_xpm_base.cpp +++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_base/shared/mediacopy/media_blt_copy_xe_xpm_base.cpp @@ -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; @@ -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; } \ No newline at end of file diff --git a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_blt_copy_xe_xpm_plus.cpp b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_blt_copy_xe_xpm_plus.cpp index f1b3115dfbf..a3c868fe3cd 100644 --- a/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_blt_copy_xe_xpm_plus.cpp +++ b/media_driver/media_softlet/agnostic/Xe_M/Xe_XPM_plus/shared/mediacopy/media_blt_copy_xe_xpm_plus.cpp @@ -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; @@ -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; } diff --git a/media_softlet/agnostic/common/shared/mediacopy/media_blt_copy_next.cpp b/media_softlet/agnostic/common/shared/mediacopy/media_blt_copy_next.cpp index cf3eec24405..c96291245f1 100644 --- a/media_softlet/agnostic/common/shared/mediacopy/media_blt_copy_next.cpp +++ b/media_softlet/agnostic/common/shared/mediacopy/media_blt_copy_next.cpp @@ -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; @@ -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; } diff --git a/media_softlet/agnostic/common/shared/mediacopy/media_copy.cpp b/media_softlet/agnostic/common/shared/mediacopy/media_copy.cpp index aefe31b6169..2b4d526d727 100644 --- a/media_softlet/agnostic/common/shared/mediacopy/media_copy.cpp +++ b/media_softlet/agnostic/common/shared/mediacopy/media_copy.cpp @@ -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; @@ -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, @@ -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; } diff --git a/media_softlet/agnostic/common/shared/mmc/media_mem_decompression_next.cpp b/media_softlet/agnostic/common/shared/mmc/media_mem_decompression_next.cpp index 3c42ec31f68..bca302d1877 100644 --- a/media_softlet/agnostic/common/shared/mmc/media_mem_decompression_next.cpp +++ b/media_softlet/agnostic/common/shared/mmc/media_mem_decompression_next.cpp @@ -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) { @@ -267,6 +281,29 @@ MOS_STATUS MediaMemDeCompNext::MediaMemoryCopy(PMOS_RESOURCE inputResource, PMOS MOS_GPU_CONTEXT_VEBOX, false); +#if (_DEBUG || _RELEASE_INTERNAL) && !defined(LINUX) + TRACEDATA_MEDIACOPY eventData = {0}; + TRACEDATA_MEDIACOPY_INIT( + eventData, + inputResource->AllocationInfo.m_AllocationHandle, + sourceSurface.dwWidth, + sourceSurface.dwHeight, + sourceSurface.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(&sourceSurface, &targetSurface)); MOS_TraceEventExt(EVENT_MEDIA_COPY, EVENT_TYPE_END, nullptr, 0, nullptr, 0);