1 /* 2 * Copyright (c) 2019-2022, 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 mos_util_debug_specific.h 24 //! \brief 25 //! 26 //! 27 28 #ifndef __MOS_UTIL_DEBUG_SPECIFIC_H__ 29 #define __MOS_UTIL_DEBUG_SPECIFIC_H__ 30 31 #include "mos_defs.h" 32 33 #if MOS_MESSAGES_ENABLED 34 35 //! 36 //! \brief HLT file name template 37 //! 38 #define MOS_LOG_PATH_TEMPLATE "%s/igd_Pid%u_Tid%u.%s" 39 #define MOS_COMPONENT_NAME_DDI_STRING "[LIBVA]:" 40 #endif //MOS_MESSAGES_ENABLED 41 42 #define MOS_DIRECTORY_DELIMITER '/' 43 #define MOS_DEBUG_DEFAULT_OUTPUT_LOCATION "/data/codechal_dump/" 44 45 //! 46 //! \def MOS_CHK_NULL_WITH_HR(_compID, _subCompID, _ptr) 47 //! Check if \a _ptr == nullptr, if so assert and return an HRESULT error 48 //! 49 #define MOS_CHK_NULL_WITH_HR(_compID, _subCompID, _ptr) \ 50 { \ 51 if ((_ptr) == nullptr) \ 52 { \ 53 MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (nullptr) Pointer."); \ 54 hr = MOS_STATUS_NULL_POINTER; \ 55 goto finish; \ 56 } \ 57 } 58 59 #define MOS_CHK_NULL_WITH_HR_RETURN(_compID, _subCompID, _ptr) \ 60 { \ 61 if ((_ptr) == NULL) \ 62 { \ 63 MOS_ASSERTMESSAGE(_compID, _subCompID, "Invalid (NULL) Pointer."); \ 64 MT_ERR2(MT_ERR_NULL_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID); \ 65 return -1; \ 66 } \ 67 } 68 69 #define MOS_CHK_HR_RETURN(_compID, _subCompID, _stmt) \ 70 { \ 71 hr = (_stmt); \ 72 if (hr != 0) \ 73 { \ 74 return hr; \ 75 } \ 76 } 77 78 //! 79 //! \def MOS_CHK_STATUS_RETURN_HR(_compID, _subCompID, _stmt) 80 //! Check _stmt, assert and return an error for failure 81 //! 82 #define MOS_CHK_STATUS_RETURN_HR(_compID, _subCompID, _stmt) \ 83 { \ 84 MOS_STATUS stmtStatus = (MOS_STATUS)(_stmt); \ 85 if (stmtStatus != MOS_STATUS_SUCCESS) \ 86 { \ 87 MOS_ASSERTMESSAGE(_compID, _subCompID, "MOS returned error, eStatus = 0x%x", stmtStatus); \ 88 MT_ERR3(MT_ERR_MOS_STATUS_CHECK, MT_COMPONENT, _compID, MT_SUB_COMPONENT, _subCompID, MT_ERROR_CODE, stmtStatus); \ 89 return -1; \ 90 } \ 91 } 92 93 #endif //__MOS_UTIL_DEBUG_SPECIFIC_H__ 94 95