1 /* 2 * Copyright (c) 2020-2021, 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 mhw_itf.h 24 //! \brief MHW itf common defines 25 //! \details 26 //! 27 28 #ifndef __MHW_ITF_H__ 29 #define __MHW_ITF_H__ 30 31 #include "mhw_cmdpar.h" 32 #include "media_class_trace.h" 33 34 #if _MHW_HWCMDPARSER_SUPPORTED 35 #include "mhw_hwcmd_parser.h" 36 #endif 37 38 // [Macro Prefixes] | [Macro Suffixes] 39 // No Prefix: for external use | _T : type 40 // _ : for internal use | _F : function name 41 // __ : intermediate macros | _M : class member name 42 // only used by other | _DECL: declaration 43 // macros | _DEF : definition 44 45 #define __MHW_GETPAR_F(CMD) GETPAR_##CMD // function name to get the pointer to MHW command parameter 46 #define MHW_GETPAR_F(CMD) __MHW_GETPAR_F(CMD) // to support 2-level macro expanding 47 #define __MHW_GETSIZE_F(CMD) GETSIZE_##CMD // function name to get MHW command size in byte 48 #define MHW_GETSIZE_F(CMD) __MHW_GETSIZE_F(CMD) // to support 2-level macro expanding 49 #define __MHW_ADDCMD_F(CMD) ADDCMD_##CMD // function name to add command 50 #define MHW_ADDCMD_F(CMD) __MHW_ADDCMD_F(CMD) // to support 2-level macro expanding 51 #define __MHW_SETCMD_F(CMD) SETCMD_##CMD // function name to set command data 52 53 #define __MHW_GETPAR_DECL(CMD) _MHW_PAR_T(CMD) & MHW_GETPAR_F(CMD)() 54 #define __MHW_GETSIZE_DECL(CMD) size_t MHW_GETSIZE_F(CMD)() const 55 #define __MHW_ADDCMD_DECL(CMD) MOS_STATUS MHW_ADDCMD_F(CMD)(PMOS_COMMAND_BUFFER cmdBuf, PMHW_BATCH_BUFFER batchBuf = nullptr) 56 #define __MHW_SETCMD_DECL(CMD) MOS_STATUS __MHW_SETCMD_F(CMD)() 57 58 #define _MHW_CMD_ALL_DEF_FOR_ITF(CMD) \ 59 public: \ 60 virtual __MHW_GETPAR_DECL(CMD) = 0; \ 61 virtual __MHW_GETSIZE_DECL(CMD) = 0; \ 62 virtual __MHW_ADDCMD_DECL(CMD) = 0; \ 63 \ 64 protected: \ 65 virtual __MHW_SETCMD_DECL(CMD) { return MOS_STATUS_SUCCESS; } 66 67 #endif // __MHW_DEF_H__ 68