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_cmdpar.h 24 //! \brief MHW cmdpar common defines 25 //! \details 26 //! 27 28 #ifndef __MHW_CMDPAR_H__ 29 #define __MHW_CMDPAR_H__ 30 31 #include <memory> 32 33 // [Macro Prefixes] | [Macro Suffixes] 34 // No Prefix: for external use | _T : type 35 // _ : for internal use | _F : function name 36 // __ : intermediate macros | _M : class member name 37 // only used by other | _DECL: declaration 38 // macros | _DEF : definition 39 40 #define __MHW_PAR_T(CMD) CMD##_PAR // MHW command parameter type 41 #define _MHW_PAR_T(CMD) __MHW_PAR_T(CMD) // to support 2-level macro expanding 42 #define __MHW_PAR_ALIAS_T(CMD) CMD##_PAR_ALIAS // MHW command parameter type alias, to avoid compile error 43 44 #define __MHW_SETPAR_F(CMD) SETPAR_##CMD // function name to set MHW command parameters 45 #define MHW_SETPAR_F(CMD) __MHW_SETPAR_F(CMD) // to support 2-level macro expanding 46 47 #define __MHW_SETPAR_COMMON_DECL(CMD) MHW_SETPAR_F(CMD)(__MHW_PAR_ALIAS_T(CMD) ¶ms) const 48 49 // CodecHal uses it to define set MHW params functions in header file 50 #define MHW_SETPAR_DECL_HDR(CMD) MOS_STATUS __MHW_SETPAR_COMMON_DECL(CMD) override 51 52 // CodecHal uses it to define set MHW params functions in source file 53 #define MHW_SETPAR_DECL_SRC(CMD, CLASS) MOS_STATUS CLASS::__MHW_SETPAR_COMMON_DECL(CMD) 54 55 #define _MHW_SETPAR_DEF(CMD) \ 56 using __MHW_PAR_ALIAS_T(CMD) = _MHW_PAR_T(CMD); \ 57 virtual MOS_STATUS __MHW_SETPAR_COMMON_DECL(CMD) \ 58 { \ 59 return MOS_STATUS_SUCCESS; \ 60 } 61 62 #endif // __MHW_CMDPAR_H__ 63