| 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_config_manager.h |
| 24 |
//! \brief Defines the dump configuration manager. |
| 25 |
//! \details The debug interface dumps configuration manager file which parse attributes. |
| 26 |
#ifndef __MEDIA_DEBUG_CONFIG_MANAGER_H__ |
| 27 |
#define __MEDIA_DEBUG_CONFIG_MANAGER_H__ |
| 28 |
#if USE_MEDIA_DEBUG_TOOL |
| 29 |
#include "media_debug_utils.h" |
| 30 |
#include "media_common_defs.h" |
| 31 |
#include "media_debug_interface.h" |
| 32 |
|
| 33 |
struct MediaKernelDumpConfig |
| 34 |
{ |
| 35 |
bool dumpDsh = false; |
| 36 |
bool dumpSsh = false; |
| 37 |
bool dumpIsh = false; |
| 38 |
bool dumpCurbe = false; |
| 39 |
bool dumpCmdBuffer = false; |
| 40 |
bool dump2ndLvlBatch = false; |
| 41 |
bool dumpInput = false; |
| 42 |
bool dumpOutput = false; |
| 43 |
}; |
| 44 |
|
| 45 |
struct MediaDbgCfg |
| 46 |
{ |
| 47 |
MediaDbgCfg() |
| 48 |
{ |
| 49 |
cmdAttribs[MediaDbgAttr::attrEnableFastDump] = 1; |
| 50 |
} |
| 51 |
|
| 52 |
int32_t frameIndex; |
| 53 |
std::map<std::string, int32_t> cmdAttribs; |
| 54 |
std::map<std::string, MediaKernelDumpConfig> kernelAttribs; |
| 55 |
std::vector<std::string> forceCmds; |
| 56 |
}; |
| 57 |
|
| 58 |
enum MediaDbgFunction |
| 59 |
{ |
| 60 |
MEDIA_FUNCTION_DEFAULT = 0, |
| 61 |
MEDIA_FUNCTION_ENCODE = 1, |
| 62 |
MEDIA_FUNCTION_DECODE = 2, |
| 63 |
MEDIA_FUNCTION_CENC_DECODE = 3, |
| 64 |
MEDIA_FUNCTION_VP = 4, |
| 65 |
}; |
| 66 |
|
| 67 |
class MediaDebugInterface; |
| 68 |
class CodechalDebugInterface; |
| 69 |
class VpDebugInterface; |
| 70 |
class MediaDebugConfigMgr |
| 71 |
{ |
| 72 |
public: |
| 73 |
MediaDebugConfigMgr(std::string outputFolderPath); |
| 74 |
virtual ~MediaDebugConfigMgr(); |
| 75 |
|
| 76 |
MOS_STATUS ParseConfig(MOS_CONTEXT_HANDLE mosCtx); |
| 77 |
MOS_STATUS DeleteCfgNode(uint32_t frameIdx); |
| 78 |
|
| 79 |
bool AttrIsEnabled(std::string attrName); |
| 80 |
|
| 81 |
protected: |
| 82 |
void GenerateDefaultConfig(std::string configFileName); |
| 83 |
void StoreDebugAttribs(std::string line, MediaDbgCfg *dbgCfg); |
| 84 |
void ParseKernelAttribs(std::string line, MediaDbgCfg *dbgCfg); |
| 85 |
bool KernelAttrEnabled(MediaKernelDumpConfig kernelConfig, std::string attrName); |
| 86 |
uint32_t GetFrameConfig(uint32_t frameIdx); |
| 87 |
|
| 88 |
virtual uint32_t GetDumpFrameNum() = 0; |
| 89 |
virtual std::string InitFileName(MediaDbgFunction mediaFunction) = 0; |
| 90 |
virtual MediaUserSettingSharedPtr GetUserSettingInstance() = 0; |
| 91 |
|
| 92 |
protected: |
| 93 |
MediaDbgFunction m_mediaFunction; |
| 94 |
std::string m_outputFolderPath; |
| 95 |
std::vector<MediaDbgCfg> m_debugFrameConfigs; |
| 96 |
MediaDbgCfg * m_debugAllConfigs = nullptr; |
| 97 |
MEDIA_CLASS_DEFINE_END(MediaDebugConfigMgr) |
| 98 |
}; |
| 99 |
|
| 100 |
#endif //USE_MEDIA_DEBUG_TOOL |
| 101 |
#endif /* __MEDIA_DEBUG_CONFIG_MANAGER_H__ */ |