1 /*===================== begin_copyright_notice ================================== 2 3 # Copyright (c) 2021, Intel Corporation 4 5 # Permission is hereby granted, free of charge, to any person obtaining a 6 # copy of this software and associated documentation files (the "Software"), 7 # to deal in the Software without restriction, including without limitation 8 # the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 # and/or sell copies of the Software, and to permit persons to whom the 10 # Software is furnished to do so, subject to the following conditions: 11 12 # The above copyright notice and this permission notice shall be included 13 # in all copies or substantial portions of the Software. 14 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 # OTHER DEALINGS IN THE SOFTWARE. 22 23 ======================= end_copyright_notice ==================================*/ 24 //! 25 //! \file media_interfaces_pvc.h 26 //! \brief All interfaces used for pvc that require factory creation 27 //! 28 29 #ifndef __MEDIA_INTERFACES_PVC_H__ 30 #define __MEDIA_INTERFACES_PVC_H__ 31 32 #include "media_interfaces_mhw.h" 33 #include "media_interfaces_mhw_next.h" 34 #include "media_interfaces_codechal.h" 35 #include "media_interfaces_mmd.h" 36 #include "media_interfaces_mcpy.h" 37 #include "media_interfaces_cmhal.h" 38 #include "media_interfaces_mosutil.h" 39 #include "media_interfaces_vphal.h" 40 #include "media_interfaces_renderhal.h" 41 #include "media_interfaces_nv12top010.h" 42 #include "media_interfaces_decode_histogram.h" 43 44 #include "mhw_cp_interface.h" 45 #include "mhw_mi_xe_xpm_base.h" 46 #include "mhw_render_xe_hpc.h" 47 #include "mhw_sfc_xe_xpm.h" 48 #include "mhw_state_heap_xe_xpm.h" 49 #include "mhw_vebox_xe_xpm.h" 50 #include "mhw_vdbox_mfx_xe_xpm.h" 51 #include "mhw_vdbox_hcp_impl_legacy_xe_xpm_plus.h" 52 #include "mhw_vdbox_avp_xe_xpm.h" 53 #include "mhw_vdbox_huc_xe_xpm_plus.h" 54 #include "mhw_vdbox_avp_g12_X.h" 55 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 56 #include "mhw_vdbox_vdenc_xe_xpm_plus.h" 57 #include "mhw_vdbox_vdenc_xe_xpm_plus_ext.h" 58 #else 59 #include "mhw_vdbox_vdenc_g12_X.h" 60 #endif 61 #include "renderhal_memdecomp.h" 62 #include "mhw_blt_xe_hpc.h" 63 #include "vphal_xe_xpm_plus.h" 64 #include "media_copy_xe_xpm_plus.h" 65 #include "codechal_hw_xe_xpm_plus.h" 66 67 #ifdef _AVC_DECODE_SUPPORTED 68 #include "decode_avc_pipeline_adapter_m12.h" 69 #endif 70 71 #ifdef _HEVC_DECODE_SUPPORTED 72 #include "decode_hevc_pipeline_adapter_m12.h" 73 #endif 74 75 #ifdef _JPEG_DECODE_SUPPORTED 76 #include "decode_jpeg_pipeline_adapter_m12.h" 77 #endif 78 79 #ifdef _MPEG2_DECODE_SUPPORTED 80 #include "decode_mpeg2_pipeline_adapter_m12.h" 81 #endif 82 83 #ifdef _VC1_DECODE_SUPPORTED 84 #include "codechal_decode_vc1_xe_xpm.h" 85 #endif 86 87 #ifdef _VP8_DECODE_SUPPORTED 88 #include "codechal_decode_vp8_g12.h" 89 #endif 90 91 #ifdef _VP9_DECODE_SUPPORTED 92 #include "decode_vp9_pipeline_adapter_m12.h" 93 #endif 94 95 #ifdef _AV1_DECODE_SUPPORTED 96 #include "decode_av1_pipeline_adapter_g12.h" 97 #endif 98 99 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 100 #ifdef _JPEG_ENCODE_SUPPORTED 101 #include "codechal_encode_jpeg_g12.h" 102 #endif 103 104 #include "codechal_encode_csc_ds_xe_xpm.h" 105 #include "codechal_encode_csc_ds_mdf_xe_xpm.h" 106 107 #ifdef _HEVC_ENCODE_VME_SUPPORTED 108 #include "codechal_encode_hevc_g12.h" 109 #include "codechal_encode_hevc_mbenc_xe_xpm.h" 110 #include "codechal_encode_csc_ds_mdf_g12.h" 111 #endif 112 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED 113 #include "codechal_vdenc_hevc_xe_xpm.h" 114 #ifdef _APOGEIOS_SUPPORTED 115 #include "encode_hevc_vdenc_pipeline_adapter_xe_xpm_plus.h" 116 #endif 117 #endif 118 119 #ifdef _AVC_ENCODE_VDENC_SUPPORTED 120 #include "codechal_vdenc_avc_xe_xpm_plus.h" 121 #endif 122 123 #include "codechal_memdecomp_g11_icl.h" 124 125 #ifdef _VP9_ENCODE_VDENC_SUPPORTED 126 #include "codechal_vdenc_vp9_g12.h" 127 #include "codechal_vdenc_vp9_xe_hpm.h" 128 #endif 129 130 #include "codechal_encoder_unsupported.h" 131 #endif 132 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 133 #include "cm_hal_xe_xpm.h" 134 #endif 135 #include "vphal_xe_xpm.h" 136 #include "renderhal_xe_hpc.h" 137 #include "media_user_settings_mgr_g12_plus.h" 138 139 #include "codechal_decode_histogram.h" 140 141 class MhwInterfacesPvc : public MhwInterfaces 142 { 143 public: 144 MhwVdboxAvpInterface *m_avpInterface = nullptr; 145 146 using Mi = MhwMiInterfaceXe_Xpm_Base; 147 using Cp = MhwCpInterface; 148 using Render = MhwRenderInterfaceXe_Hpc; 149 using Sfc = MhwSfcInterfaceXe_Xpm; 150 using StateHeap = MHW_STATE_HEAP_INTERFACE_XE_XPM; 151 using Mfx = MhwVdboxMfxInterfaceXe_Xpm; 152 using Hcp = MhwVdboxHcpInterfaceXe_Xpm_PLUS; 153 using Avp = MhwVdboxAvpInterfaceXe_Xpm; 154 using Huc = MhwVdboxHucInterfaceXe_Xpm_Plus; 155 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 156 using Vdenc = MhwVdboxVdencInterfaceG12ExtPvc; 157 #else 158 using Vdenc = MhwVdboxVdencInterfaceG12X; 159 #endif 160 using Vebox = MhwVeboxInterfaceXe_Xpm; 161 using Blt = MhwBltInterfaceXe_Hpc; 162 163 MOS_STATUS Initialize( 164 CreateParams params, 165 PMOS_INTERFACE osInterface); 166 167 }; 168 169 class MhwInterfacesPvc_Next : public MhwInterfacesNext 170 { 171 public: 172 using Mi = MhwMiInterfaceXe_Xpm_Base; 173 using Cp = MhwCpInterface; 174 using Render = MhwRenderInterfaceXe_Hpc; 175 using Sfc = MhwSfcInterfaceXe_Xpm; 176 using StateHeap = MHW_STATE_HEAP_INTERFACE_XE_XPM; 177 using Mfx = MhwVdboxMfxInterfaceXe_Xpm; 178 using Hcp = MhwVdboxHcpInterfaceXe_Xpm_PLUS; 179 using Huc = MhwVdboxHucInterfaceXe_Xpm_Plus; 180 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 181 using Vdenc = MhwVdboxVdencInterfaceG12ExtPvc; 182 #else 183 using Vdenc = MhwVdboxVdencInterfaceG12X; 184 #endif 185 using Vebox = MhwVeboxInterfaceXe_Xpm; 186 using Blt = MhwBltInterfaceXe_Hpc; 187 188 MOS_STATUS Initialize( 189 CreateParams params, 190 PMOS_INTERFACE osInterface); 191 192 //! 193 //! \brief Destroys all created MHW interfaces 194 //! \details If the HAL creation fails, this is used for cleanup 195 //! 196 virtual void Destroy(); 197 }; 198 199 class MmdDeviceXe_Xpm_Plus : public MmdDevice 200 { 201 public: 202 using Mmd = MediaRenderDecompState; 203 MOS_STATUS Initialize( 204 PMOS_INTERFACE osInterface, 205 MhwInterfaces *mhwInterfaces); 206 207 MhwInterfaces* CreateMhwInterface( 208 PMOS_INTERFACE osInterface); 209 }; 210 211 class McpyDeviceXe_Xpm_Plus : public McpyDevice 212 { 213 public: 214 using Mcpy = MediaCopyStateXe_Xpm_Plus; 215 MOS_STATUS Initialize( 216 PMOS_INTERFACE osInterface, 217 MhwInterfaces *mhwInterfaces); 218 219 MhwInterfaces* CreateMhwInterface( 220 PMOS_INTERFACE osInterface); 221 }; 222 223 class Nv12ToP010DeviceXe_Xpm_Plus : public Nv12ToP010Device 224 { 225 public: 226 227 MOS_STATUS Initialize( 228 PMOS_INTERFACE osInterface); 229 }; 230 231 class CodechalDecodeInterfacesXe_Xpm_Plus 232 { 233 public: 234 #ifdef _AVC_DECODE_SUPPORTED 235 using Avc = DecodeAvcPipelineAdapterM12; 236 #endif 237 #ifdef _HEVC_DECODE_SUPPORTED 238 using Hevc = DecodeHevcPipelineAdapterM12; 239 #endif 240 #ifdef _JPEG_DECODE_SUPPORTED 241 using Jpeg = DecodeJpegPipelineAdapterM12; 242 #endif 243 #ifdef _MPEG2_DECODE_SUPPORTED 244 using Mpeg2 = DecodeMpeg2PipelineAdapterM12; 245 #endif 246 #ifdef _VC1_DECODE_SUPPORTED 247 using Vc1 = CodechalDecodeVc1Xe_Xpm; 248 #endif 249 #ifdef _VP8_DECODE_SUPPORTED 250 using Vp8 = CodechalDecodeVp8G12; 251 #endif 252 #ifdef _VP9_DECODE_SUPPORTED 253 using Vp9 = DecodeVp9PipelineAdapterG12; 254 #endif 255 #ifdef _AV1_DECODE_SUPPORTED 256 using Av1 = DecodeAv1PipelineAdapterG12; 257 #endif 258 }; 259 260 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 261 class CodechalEncodeInterfacesXe_Xpm_Plus 262 { 263 public: 264 using CscDs = CodechalEncodeCscDsXe_Xpm; 265 using CscDsMdf = CodechalEncodeCscDsMdfXe_Xpm; 266 #ifdef _VP9_ENCODE_VDENC_SUPPORTED 267 using Vp9 = CodechalVdencVp9StateXe_Xpm; 268 #endif 269 #ifdef _JPEG_ENCODE_SUPPORTED 270 using Jpeg = CodechalEncodeJpegStateG12; 271 #endif 272 #ifdef _MPEG2_ENCODE_VME_SUPPORTED 273 using Mpeg2 = CodechalEncoderStateUnsupported; 274 #endif 275 #ifdef _HEVC_ENCODE_VME_SUPPORTED 276 using HevcEnc = CodechalEncHevcStateG12; 277 using HevcMbenc = CodecHalHevcMbencXe_Xpm; 278 #endif 279 #ifdef _HEVC_ENCODE_VDENC_SUPPORTED 280 using HevcVdenc = CodechalVdencHevcStateXe_Xpm; 281 #endif 282 #ifdef _AVC_ENCODE_VME_SUPPORTED 283 using AvcEnc = CodechalEncoderStateUnsupported; 284 #endif 285 #ifdef _AVC_ENCODE_VDENC_SUPPORTED 286 using AvcVdenc = CodechalVdencAvcStateXe_Xpm_Plus; 287 #endif 288 }; 289 #endif 290 291 class CodechalInterfacesXe_Xpm_Plus : public CodechalDevice 292 { 293 public: 294 using Decode = CodechalDecodeInterfacesXe_Xpm_Plus; 295 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 296 using Encode = CodechalEncodeInterfacesXe_Xpm_Plus; 297 #endif 298 using Hw = CodechalHwInterfaceXe_Xpm_Plus; 299 300 MOS_STATUS Initialize( 301 void *standardInfo, 302 void *settings, 303 MhwInterfaces *mhwInterfaces, 304 PMOS_INTERFACE osInterface) override; 305 306 private: 307 MOS_STATUS CreateCodecHalInterface(MhwInterfaces *mhwInterfaces, 308 CodechalHwInterface *&pHwInterface, 309 CodechalDebugInterface *&pDebugInterface, 310 PMOS_INTERFACE osInterface, 311 CODECHAL_FUNCTION CodecFunction, 312 bool disableScalability); 313 314 MOS_STATUS CreateCodecHalInterface(MhwInterfaces *mhwInterfaces, 315 MhwInterfacesNext *&pMhwInterfacesNext, 316 CodechalHwInterface *&pHwInterface, 317 CodechalDebugInterface *&pDebugInterface, 318 PMOS_INTERFACE osInterface, 319 CODECHAL_FUNCTION CodecFunction, 320 bool disableScalability); 321 }; 322 323 #define PVC_L3_CONFIG_COUNT 6 324 // 4KB per Way for Pvc, two Way per section 325 static const L3ConfigRegisterValues PVC_L3_PLANES[PVC_L3_CONFIG_COUNT] = 326 { // Rest R/W RO UTC CB Sum (in KB) 327 {0x00000200, 0, 0, 0}, // 512 0 0 0 0 512 328 {0xC0000000, 0x40000000, 0, 0}, // 384 0 0 128 0 512 329 {0xF0000000, 0x00000080, 0, 0}, // 480 0 0 0 32 512 330 {0x80000000, 0x80000000, 0, 0}, // 256 0 0 256 0 512 331 {0x40000000, 0x00000080, 0, 0}, // 0 128 352 0 32 512 332 {0x80000000, 0x70000080, 0, 0}, // 256 0 0 224 32 512 333 }; 334 335 #ifdef IGFX_PVC_ENABLE_NON_UPSTREAM 336 class CMHalInterfacesXe_Xpm_Plus : public CMHalDevice 337 { 338 protected: 339 using CMHal = CmHalXe_Xpm; 340 MOS_STATUS Initialize( 341 CM_HAL_STATE *pCmState); 342 }; 343 #endif 344 345 class MosUtilDeviceXe_Xpm_Plus : public MosUtilDevice 346 { 347 public: 348 using MosUtil = MediaUserSettingsMgr_Xe_M_base; 349 350 MOS_STATUS Initialize(); 351 }; 352 353 class VphalInterfacesXe_Xpm_Plus : public VphalDevice 354 { 355 public: 356 using VphalState = VphalStateXe_Xpm_Plus; 357 358 MOS_STATUS Initialize( 359 PMOS_INTERFACE osInterface, 360 PMOS_CONTEXT osDriverContext, 361 bool bInitVphalState, 362 MOS_STATUS *eStatus); 363 }; 364 365 class RenderHalInterfacesXe_Hpc : public RenderHalDevice 366 { 367 protected: 368 using XRenderHal = XRenderHal_Interface_Xe_Hpc; 369 MOS_STATUS Initialize(); 370 }; 371 372 class DecodeHistogramDeviceXe_Xpm_Plus : public DecodeHistogramDevice 373 { 374 public: 375 using DecodeHistogramG12 = CodechalDecodeHistogram; 376 377 MOS_STATUS Initialize( 378 CodechalHwInterface *hwInterface, 379 PMOS_INTERFACE osInterface); 380 }; 381 382 #endif // __MEDIA_INTERFACES_PVC_H__ 383