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 cp_interfaces.h 24 //! \brief Defines base class for CP interfaces 25 //! 26 27 #ifndef _CP_INTERFACES_H_ 28 #define _CP_INTERFACES_H_ 29 30 #include <stdint.h> 31 #include <va/va.h> 32 #include "cp_factory.h" 33 #include "codechal_secure_decode_interface.h" 34 #include "mhw_cp_interface.h" 35 #include "mos_os_cp_interface_specific.h" 36 #ifndef WDDM_LINUX 37 #include "media_libva_cp_interface.h" 38 #include "media_libva_caps_cp_interface.h" 39 #else 40 class DdiCpInterface; 41 class MediaLibvaCaps; 42 class MediaLibvaCapsCpInterface; 43 struct DDI_MEDIA_CONTEXT; 44 #endif 45 #include "cp_streamout_interface.h" 46 #include "decodecp_interface.h" 47 48 #define CP_INTERFACE 1 49 50 //! 51 //! \class DdiMediaProtected 52 //! \brief Ddi media protected 53 //! 54 class CpInterfaces 55 { 56 public: 57 //! 58 //! \brief Constructor 59 //! CpInterfaces()60 CpInterfaces() {} 61 62 //! 63 //! \brief Destructor 64 //! ~CpInterfaces()65 virtual ~CpInterfaces() {} 66 67 //! 68 //! \brief Create CodechalSecureDeocde Object 69 //! Must use Delete_SecureDecodeInterface to delete created Object to avoid ULT Memory Leak errors 70 //! 71 //! \param [in] codechalSettings 72 //! CodechalSetting* 73 //! \param [in] codechalSettings 74 //! CodechalHwInterface* 75 //! 76 //! \return CodechalSecureDecodeInterface* 77 //! Return CP Wrapper Object 78 //! 79 virtual CodechalSecureDecodeInterface* Create_SecureDecodeInterface( 80 CodechalSetting * codechalSettings, 81 CodechalHwInterface *hwInterfaceInput) = 0; 82 83 //! 84 //! \brief Delete the CodechalSecureDecodeInterface Object 85 //! 86 //! \param [in] pInterface 87 //! CodechalSecureDecodeInterface* 88 //! 89 virtual void Delete_SecureDecodeInterface(CodechalSecureDecodeInterface *pInterface) = 0; 90 91 //! 92 //! \brief Create MhwCpInterface Object 93 //! Must use Delete_MhwCpInterface to delete created Object to avoid ULT Memory Leak errors 94 //! 95 //! \param [in] osInterface 96 //! PMOS_INTERFACE 97 //! 98 //! \return MhwCpInterface* 99 //! Return CP Wrapper Object 100 //! 101 virtual MhwCpInterface* Create_MhwCpInterface(PMOS_INTERFACE osInterface) = 0; 102 103 //! 104 //! \brief Delete the MhwCpInterface Object 105 //! 106 //! \param [in] pInterface 107 //! MhwCpInterface* 108 //! 109 virtual void Delete_MhwCpInterface(MhwCpInterface *pInterface) = 0; 110 111 //! 112 //! \brief Create MosCpInterface Object 113 //! Must use Delete_MosCpInterface to delete created Object to avoid ULT Memory Leak errors 114 //! 115 //! \param [in] pvOsInterface 116 //! void* 117 //! \param [in] pInterface 118 //! MosCpInterface* 119 //! 120 //! \return MosCpInterface* 121 //! Return CP Wrapper Object 122 //! 123 virtual MosCpInterface* Create_MosCpInterface(void* pvOsInterface) = 0; 124 125 //! 126 //! \brief Delete the MosCpInterface Object 127 //! 128 //! \param [in] pInterface 129 //! MosCpInterface* 130 //! 131 virtual void Delete_MosCpInterface(MosCpInterface* pInterface) = 0; 132 133 //! 134 //! \brief Create DdiCpInterface Object 135 //! Must use Delete_DdiCpInterface to delete created Object to avoid ULT Memory Leak errors 136 //! 137 //! \param [in] mosCtx 138 //! MOS_CONTEXT& 139 //! \param [in] pInterface 140 //! DdiCpInterface* 141 //! 142 //! \return DdiCpInterface* 143 //! Return CP Wrapper Object 144 //! 145 virtual DdiCpInterface* Create_DdiCpInterface(MOS_CONTEXT& mosCtx) = 0; 146 147 //! 148 //! \brief Delete the DdiCpInterface Object 149 //! 150 //! \param [in] pInterface 151 //! DdiCpInterface* 152 //! 153 virtual void Delete_DdiCpInterface(DdiCpInterface* pInterface) = 0; 154 155 //! 156 //! \brief Create MediaLibvaCapsCpInterface Object 157 //! Must use Delete_MediaLibvaCapsCpInterface to delete created Object to avoid ULT Memory Leak errors 158 //! 159 //! \param [in] mediaCtx 160 //! DDI_MEDIA_CONTEXT* 161 //! \param [in] mediaCaps 162 //! MediaLibvaCaps* 163 //! 164 //! \return MediaLibvaCapsCpInterface* 165 //! Return CP Wrapper Object 166 //! 167 virtual MediaLibvaCapsCpInterface* Create_MediaLibvaCapsCpInterface( 168 DDI_MEDIA_CONTEXT *mediaCtx, 169 MediaLibvaCaps *mediaCaps) = 0; 170 171 //! 172 //! \brief Delete the MediaLibvaCapsCpInterface Object 173 //! 174 //! \param [in] pInterface 175 //! MediaLibvaCapsCpInterface* 176 //! 177 virtual void Delete_MediaLibvaCapsCpInterface(MediaLibvaCapsCpInterface* pInterface) = 0; 178 179 //! 180 //! \brief Create DecodeCpInterface Object 181 //! Must use Delete_DecodeCpInterface to delete created Object to avoid ULT Memory Leak errors 182 //! 183 //! \param [in] codechalSettings 184 //! CodechalSetting* 185 //! \param [in] hwInterfaceInput 186 //! CodechalHwInterface* 187 //! 188 //! \return DecodeCpInterface* 189 //! Return CP Wrapper Object 190 //! 191 virtual DecodeCpInterface *Create_DecodeCpInterface( 192 CodechalSetting * codechalSettings, 193 MhwCpInterface *cpInterface, 194 PMOS_INTERFACE osInterface) = 0; 195 196 //! 197 //! \brief Delete the DecodeCpInterface Object 198 //! 199 //! \param [in] pInterface 200 //! DecodeCpInterface 201 //! 202 virtual void Delete_DecodeCpInterface(DecodeCpInterface *pInterface) = 0; 203 204 MEDIA_CLASS_DEFINE_END(CpInterfaces) 205 }; 206 207 typedef CpFactoryWithoutArgs<CpInterfaces> CpInterfacesFactory; 208 209 #endif /* _CP_INTERFACES_H_ */ 210