1 /* 2 * Copyright (c) 2020, Intel Corporation 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included 12 * in all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20 * OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 //! 23 //! \file media_debug_utils.h 24 //! \brief Defines the debug interface utilities shared by all of Media. 25 //! \details The debug interface dumps output from Media based on in input config file. 26 //! 27 #ifndef __MEDIA_DEBUG_UTILS_H__ 28 #define __MEDIA_DEBUG_UTILS_H__ 29 30 #if USE_MEDIA_DEBUG_TOOL 31 #include <string> 32 #include <map> 33 #include <vector> 34 #include "mos_defs.h" 35 #include "media_class_trace.h" 36 37 namespace MediaDbgAttr 38 { 39 //Common Attr 40 static const char *attrDumpBufferInBinary = "DumpBufferInBinary"; 41 static const char *attrDumpToThreadFolder = "DumpToThreadFolder"; 42 static const char *attrDumpCmdBufInBinary = "DumpCmdBufInBinary"; 43 static const char *attrEnableFastDump = "EnableFastDump"; 44 45 //Codec Attr 46 static const char *attrPicParams = "PicParams"; 47 static const char *attrSubsetsParams = "SubsetsParams"; 48 static const char *attrFeiPicParams = "FeiPicParams"; 49 static const char *attrMvcExtPicParams = "MvcExtPicParams"; 50 static const char *attrSegmentParams = "SegmentParams"; 51 static const char *attrSlcParams = "SlcParams"; 52 static const char *attrMbParams = "MbParams"; 53 static const char *attrIqParams = "IqParams"; 54 static const char *attrSeqParams = "SeqParams"; 55 static const char *attrVuiParams = "VuiParams"; 56 static const char *attrDecodeBitstream = "DecodeBitstream"; // Decode Bitstream 57 static const char *attrBitstream = "Bitstream"; // Encode Bitstream 58 static const char *attrStreamOut = "StreamOut"; 59 static const char *attrStreamIn = "StreamIn"; 60 static const char *attrResidualDifference = "ResidualDifference"; 61 static const char *attrDeblocking = "Deblocking"; 62 static const char *attrMvData = "MvData"; 63 static const char *attrVc1Bitplane = "Vc1Bitplane"; 64 static const char *attrCoefProb = "CoefProb"; 65 static const char *attrSegId = "SegId"; 66 static const char *attrHucRegions = "HucRegions"; 67 static const char *attrHuCDmem = "HucDmem"; 68 static const char *attrCmdBufferMfx = "CmdBufferMfx"; 69 static const char *attr2ndLvlBatchMfx = "2ndLvlBatchMfx"; 70 static const char *attrSurfaceInfo = "SurfaceInfo"; 71 static const char *attrDelayForDumpOutput = "DelayForDumpOutput"; 72 static const char *attrDecodeOutputSurface = "DecodeOutputSurface"; 73 static const char *attrDecodeCompSurface = "DumpCompressedSurface"; 74 static const char *attrDecodeAuxSurface = "DumpAuxsurface"; 75 static const char *attrDecodeBltOutput = "DumpBltOutput"; 76 static const char *attrSfcOutputSurface = "SfcOutputSurface"; 77 static const char *attrSfcBuffers = "SfcBuffers"; 78 static const char *attrDecodeReferenceSurfaces = "DecodeReferenceSurfaces"; // Decode Reference Surfaces 79 static const char *attrReferenceSurfaces = "ReferenceSurfaces"; // Encode Reference Surfaces 80 static const char *attrEncodeRawInputSurface = "EncodeRawInputSurface"; 81 static const char *attrReconstructedSurface = "ReconstructedSurface"; 82 static const char *attrPakInput = "PakInput"; 83 static const char *attrPakOutput = "PakOutput"; 84 static const char *attrUpsamlingInput = "UpsamplingInput"; 85 static const char *attrResidualSurface = "ResidualSurface"; 86 static const char *attrStCoeff = "StCoeff"; 87 static const char *attrCoeffPredCs = "CoeffPredCs"; 88 static const char *attrMbRecord = "MbRecord"; 89 static const char *attrOverwriteCommands = "OverwriteCommands"; 90 static const char *attrHuffmanTbl = "HuffmanTbl"; 91 static const char *attrScanParams = "ScanParams"; 92 static const char *attrDriverUltDump = "DriverUltDump"; 93 94 static const char *attrDumpEncodePar = "DumpEncodePar"; 95 static const char *attrForceCmdDumpLvl = "ForceCmdDumpLvl"; 96 static const char *attrForceCurbeDumpLvl = "ForceCurbeDumpLvl"; 97 static const char *attrForceYUVDumpWithMemcpy = "ForceYUVDumpWithMemcpy"; 98 static const char *attrDisableSwizzleForDumps = "DisableSwizzleForDumps"; 99 static const char *attrVdencOutput = "VdencOutput"; 100 static const char *attrDecodeProcParams = "DecodeProcParams"; 101 static const char *attrFrameState = "FrameState"; 102 static const char *attrCUStreamout = "CUStreamout"; 103 static const char *attrBrcPakStats = "BrcPakStats"; 104 static const char *attrImageState = "ImageState"; 105 static const char *attrSliceSizeStreamout = "SliceSizeStreamout"; 106 static const char *attrCoeffProb = "PakHwCoeffProbs"; 107 static const char *attrStatusReport = "StatusReport"; 108 static const char *attrPakObjStreamout = "PakObjStreamOut"; 109 static const char *attrTileBasedStats = "TileBasedStats"; 110 static const char *attrROISurface = "ROIInput"; 111 static const char *attrHuCStitchDataBuf = "HuCStitchDataBuffer"; 112 static const char *attrInitSWScoreboard = "InitSWScoreboard"; 113 static const char *attrSfcHistogram = "SfcHistogram"; 114 static const char *attrFilmGrain = "FilmGrain"; 115 static const char *attrQualityReport = "QualityReport"; 116 117 static const char *attrAlfData = "AlfData"; 118 static const char *attrLmcsData = "LmcsData"; 119 static const char *attrTileParams = "TileParams"; 120 static const char *attrSubpicParams = "SubpicParams"; 121 static const char *attrSliceStruct = "SliceStruct"; 122 static const char *attrRplStruct = "RplStruct"; 123 124 // MD5 attributes 125 static const char *attrMD5HashEnable = "MD5HasEnable"; 126 static const char *attrMD5FlushInterval = "MD5FlushInterval"; 127 static const char *attrMD5PicWidth = "MD5PicWidth"; 128 static const char *attrMD5PicHeight = "MD5PicHeight"; 129 // kernel attributes 130 static const char *attrDsh = "DSH"; 131 static const char *attrIsh = "ISH"; 132 static const char *attrSsh = "SSH"; 133 static const char *attrCurbe = "Curbe"; 134 static const char *attrCmdBuffer = "CmdBuffer"; 135 static const char *attr2ndLvlBatch = "2ndLvlBath"; 136 static const char *attrInput = "Input"; 137 static const char *attrOutput = "Output"; 138 }; 139 140 namespace MediaDbgFieldType 141 { 142 static const char *topField = "_Top"; 143 static const char *botField = "_Bot"; 144 static const char *frame = "_Frame"; 145 }; // namespace MediaDbgFieldType 146 147 namespace MediaDbgExtType 148 { 149 static const char *dat = ".dat"; 150 static const char *txt = ".txt"; 151 static const char *par = ".par"; 152 static const char *y = ".Y"; 153 static const char *uv = ".UV"; 154 static const char *yuv = ".yuv"; 155 static const char *yuy2 = ".yuy2"; 156 static const char *uyvy = ".uyvy"; 157 }; // namespace MediaDbgExtType 158 159 namespace MediaDbgSurfaceType 160 { 161 static const char *yuv444 = "_yuv444"; 162 static const char *yuv411 = "_yuv411"; 163 static const char *yuv420 = "_yuv420"; 164 static const char *yuv400 = "_yuv400"; 165 static const char *yuv422h2y = "_yuv422h_2y"; 166 static const char *yuv422v2y = "_yuv422v_2y"; 167 static const char *yuv422h4y = "_yuv422h_4y"; 168 static const char *yuv422v4y = "_yuv422v_4y"; 169 static const char *yuy2422 = "_yuy2422"; 170 static const char *uyvy422 = "_uyvy422"; 171 }; 172 173 namespace MediaDbgBufferType 174 { 175 static const char *bufCmd = "CmdBuf"; 176 static const char *buf2ndLvl = "2ndLvl"; 177 static const char *bufCurbe = "Curbe"; 178 static const char *bufISH = "ISH"; 179 static const char *bufDSH = "DSH"; 180 static const char *bufSSH = "SSH"; 181 static const char *bufSeqParams = "SeqParams"; 182 static const char *bufPicParams = "PicParams"; 183 static const char *bufSlcParams = "SlcParams"; 184 static const char *bufSubsetsParams = "SubsetsParams"; 185 static const char *bufVuiParams = "VuiParams"; 186 static const char *bufBitstream = "Bitstream"; 187 static const char *bufFeiPicParams = "FeiPicParams"; 188 static const char *bufMadRead = "MADRead"; 189 static const char *bufMadWrite = "MADWrite"; 190 static const char *bufSegmentParams = "SegmentParams"; 191 static const char *bufIqParams = "IqParams"; 192 static const char *bufHuffmanTbl = "HuffmanTbl"; 193 static const char *bufScanParams = "ScanParams"; 194 static const char *bufMvcPicParams = "MvcPicParams"; 195 static const char *bufMbParams = "MbParams"; 196 static const char *bufDecProcParams = "DecProcParams"; 197 static const char *bufHucRegion = "HucRegion"; 198 static const char *bufHucDmem = "HucDmem"; 199 static const char *bufEncodePar = "EncodePar"; 200 static const char *bufAlfData = "AlfData"; 201 static const char *bufLmcsData = "LmcsData"; 202 static const char *bufTileParams = "TileParams"; 203 static const char *bufSubpicParams = "SubpicParams"; 204 static const char *bufSliceStruct = "SliceStruct"; 205 static const char *bufRplStruct = "RplStruct"; 206 }; // namespace MediaDbgBufferType 207 208 //------------------------------------------------------------------------------ 209 // Macros specific to MOS_OS_SUBCOMP_DEBUG sub-comp 210 //------------------------------------------------------------------------------ 211 #define MEDIA_DEBUG_ASSERT(_expr) \ 212 MOS_ASSERT(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _expr) 213 214 #define MEDIA_DEBUG_ASSERTMESSAGE(_message, ...) \ 215 MOS_ASSERTMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__) 216 217 #define MEDIA_DEBUG_NORMALMESSAGE(_message, ...) \ 218 MOS_NORMALMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__) 219 220 #define MEDIA_DEBUG_VERBOSEMESSAGE(_message, ...) \ 221 MOS_VERBOSEMESSAGE(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _message, ##__VA_ARGS__) 222 223 #define MEDIA_DEBUG_FUNCTION_ENTER \ 224 MOS_FUNCTION_ENTER(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF) 225 226 #define MEDIA_DEBUG_CHK_STATUS(_stmt) \ 227 MOS_CHK_STATUS_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _stmt) 228 229 #define MEDIA_DEBUG_CHK_STATUS_MESSAGE(_stmt, _message, ...) \ 230 MOS_CHK_STATUS_MESSAGE_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _stmt, _message, ##__VA_ARGS__) 231 232 #define MEDIA_DEBUG_CHK_NULL(_ptr) \ 233 MOS_CHK_NULL_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr) 234 235 #define MEDIA_DEBUG_CHK_NULL_NO_STATUS(_ptr) \ 236 MOS_CHK_NULL_NO_STATUS_RETURN(MOS_COMPONENT_OS, MOS_SUBCOMP_SELF, _ptr) 237 238 #define MEDIA_DEBUG_CODECHAL_DUMP_OUTPUT_FOLDER "\\codechaldump\\" 239 #define MEDIA_DEBUG_VPHAL_DUMP_OUTPUT_FOLDER "\\vphaldump\\" 240 241 #endif //USE_MEDIA_DEBUG_TOOL 242 #endif /* __MEDIA_DEBUG_UTILS_H__ */ 243