| 1 | /*===================== begin_copyright_notice ================================== |
| 2 | Copyright (c) 2026, 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 | ======================= end_copyright_notice ==================================*/ |
| 22 | //! |
| 23 | //! \file media_interfaces_nvls.cpp |
| 24 | |
| 25 | //! \brief Helps with NVL_Xe3G factory creation. |
| 26 | //! |
| 27 | |
| 28 | #include "media_interfaces_nvls.h" |
| 29 | #include "vp_pipeline_adapter_xe3p_lpm.h" |
| 30 | #include "vp_platform_interface_xe3p_lpm.h" |
| 31 | #include "vp_kernel_config_xe2_hpg.h" |
| 32 | |
| 33 | #include "mhw_mi_xe3p_lpm_impl.h" |
| 34 | #include "mhw_sfc_xe3p_lpm_impl.h" |
| 35 | #include "mhw_vebox_xe3p_lpm_impl.h" |
| 36 | #include "mhw_render_xe2_hpg_next_impl.h" |
| 37 | #include "mhw_blt_xe3p_lpm_impl.h" |
| 38 | #include "mhw_vdbox_hcp_impl_xe3p_lpm.h" |
| 39 | #include "mhw_vdbox_mfx_impl_xe3p_lpm.h" |
| 40 | #include "mhw_vdbox_vvcp_impl_xe3p_lpm.h" |
| 41 | #include "mhw_vdbox_avp_impl_xe3p_lpm.h" |
| 42 | #include "mhw_vdbox_huc_impl_xe3p_lpm.h" |
| 43 | |
| 44 | #ifdef _MEDIA_RESERVED |
| 45 | #include "mhw_vdbox_aqm_impl_xe3p_lpm.h" |
| 46 | #include "mhw_vdbox_vdenc_impl_xe3p_lpm.h" |
| 47 | #else |
| 48 | #include "mhw_vdbox_vdenc_impl_xe3_lpm.h" // Temporary WA for decode open source test. Remove after xe3p_lpm VDEnc is available. |
| 49 | #endif |
| 50 | #include "huc_kernel_source_xe3p_lpm_base.h" |
| 51 | |
| 52 | // VP9 Encode: Use VDEnc from xe3_lpm for VP9 encode. |
| 53 | #include "mhw_vdbox_vdenc_impl_xe3_lpm.h" |
| 54 | |
| 55 | #if defined(ENABLE_KERNELS) && !defined(_FULL_OPEN_SOURCE) |
| 56 | #include "igvpkrn_xe2_hpg.h" |
| 57 | #include "igvpkrn_xe2_hpg_cmfcpatch.h" |
| 58 | #include "igvpfc_common_xe2.h" |
| 59 | #include "igvpfc_fp_xe2.h" |
| 60 | #include "igvpfc_420PL3_input_xe2.h" |
| 61 | #include "igvpfc_420PL3_output_xe2.h" |
| 62 | #include "igvpfc_444PL3_input_xe2.h" |
| 63 | #include "igvpfc_444PL3_output_xe2.h" |
| 64 | #include "igvpfc_422HV_input_xe2.h" |
| 65 | #include "igvp3dlut_xe2.h" |
| 66 | #endif |
| 67 | |
| 68 | extern template class MediaFactory<uint32_t, CodechalDeviceNext>; |
| 69 | extern template class MediaFactory<uint32_t, VphalDevice>; |
| 70 | extern template class MediaFactory<uint32_t, RenderHalDevice>; |
| 71 | extern template class MediaFactory<uint32_t, MediaInterfacesHwInfoDevice>; |
| 72 | extern template class MediaFactory<uint32_t, HucKernelSourceDevice>; |
| 73 | extern template class MediaFactory<uint32_t, MhwInterfacesNext>; |
| 74 | |
| 75 | static bool nvlXe3GRegisteredVphal = |
| 76 | MediaFactory<uint32_t, VphalDevice>:: |
| 77 | Register<VphalInterfacesNvl_Xe3G>((uint32_t)IGFX_NVL_XE3G); |
| 78 | |
| 79 | MOS_STATUS VphalInterfacesNvl_Xe3G::Initialize( |
| 80 | PMOS_INTERFACE osInterface, |
| 81 | bool bInitVphalState, |
| 82 | MOS_STATUS * eStatus, |
| 83 | bool clearViewMode) |
| 84 | { |
| 85 | vp::VpPlatformInterface* vpPlatformInterface = MOS_New(vp::VpPlatformInterfacsXe3P_Lpm, osInterface); |
| 86 | if (nullptr == vpPlatformInterface) |
| 87 | { |
| 88 | *eStatus = MOS_STATUS_NULL_POINTER; |
| 89 | return *eStatus; |
| 90 | } |
| 91 | |
| 92 | InitPlatformKernelBinary(vpPlatformInterface); |
| 93 | |
| 94 | if (!bInitVphalState) |
| 95 | { |
| 96 | m_vpPipeline = MOS_New(vp::VpPipeline, osInterface); |
| 97 | if (nullptr == m_vpPipeline) |
| 98 | { |
| 99 | MOS_Delete(vpPlatformInterface); |
| 100 | MOS_OS_CHK_NULL_RETURN(m_vpPipeline); |
| 101 | } |
| 102 | m_vpPlatformInterface = vpPlatformInterface; |
| 103 | *eStatus = MOS_STATUS_SUCCESS; |
| 104 | return *eStatus; |
| 105 | } |
| 106 | |
| 107 | m_vpBase = MOS_New( |
| 108 | VpPipelineAdapterXe3P_Lpm, |
| 109 | osInterface, |
| 110 | *vpPlatformInterface, |
| 111 | *eStatus); |
| 112 | if (nullptr == m_vpBase) |
| 113 | { |
| 114 | MOS_Delete(vpPlatformInterface); |
| 115 | *eStatus = MOS_STATUS_NULL_POINTER; |
| 116 | return *eStatus; |
| 117 | } |
| 118 | m_isNextEnabled = true; |
| 119 | |
| 120 | return *eStatus; |
| 121 | } |
| 122 | |
| 123 | MOS_STATUS VphalInterfacesNvl_Xe3G::CreateVpPlatformInterface( |
| 124 | PMOS_INTERFACE osInterface, |
| 125 | MOS_STATUS * eStatus) |
| 126 | { |
| 127 | vp::VpPlatformInterface *vpPlatformInterface = MOS_New(vp::VpPlatformInterfacsXe3P_Lpm, osInterface); |
| 128 | if (nullptr == vpPlatformInterface) |
| 129 | { |
| 130 | *eStatus = MOS_STATUS_NULL_POINTER; |
| 131 | } |
| 132 | else |
| 133 | { |
| 134 | InitPlatformKernelBinary(vpPlatformInterface); |
| 135 | |
| 136 | m_vpPlatformInterface = vpPlatformInterface; |
| 137 | *eStatus = MOS_STATUS_SUCCESS; |
| 138 | } |
| 139 | return *eStatus; |
| 140 | } |
| 141 | |
| 142 | void VphalInterfacesNvl_Xe3G::InitPlatformKernelBinary( |
| 143 | vp::VpPlatformInterface *&vpPlatformInterface) |
| 144 | { |
| 145 | static vp::VpKernelConfigXe2_Hpg kernelConfig; |
| 146 | vpPlatformInterface->SetKernelConfig(&kernelConfig); |
| 147 | #if defined(ENABLE_KERNELS) && !defined(_FULL_OPEN_SOURCE) |
| 148 | vpPlatformInterface->SetVpFCKernelBinary( |
| 149 | IGVPKRN_XE2_HPG, |
| 150 | IGVPKRN_XE2_HPG_SIZE, |
| 151 | IGVPKRN_XE2_HPG_CMFCPATCH, |
| 152 | IGVPKRN_XE2_HPG_CMFCPATCH_SIZE); |
| 153 | // Need to SetOclKernelEnable in platform interface for ocl kernels |
| 154 | vpPlatformInterface->SetOclKernelEnable(); |
| 155 | AddVpNativeKernelEntryToListFc_commonXe2(*vpPlatformInterface); |
| 156 | AddVpNativeKernelEntryToListFc_fpXe2(*vpPlatformInterface); |
| 157 | AddVpNativeKernelEntryToListFc_444pl3_inputXe2(*vpPlatformInterface); |
| 158 | AddVpNativeKernelEntryToListFc_444pl3_outputXe2(*vpPlatformInterface); |
| 159 | AddVpNativeKernelEntryToListFc_420pl3_inputXe2(*vpPlatformInterface); |
| 160 | AddVpNativeKernelEntryToListFc_420pl3_outputXe2(*vpPlatformInterface); |
| 161 | AddVpNativeKernelEntryToList3dlutXe2(*vpPlatformInterface); |
| 162 | AddVpNativeKernelEntryToListFc_422hv_inputXe2(*vpPlatformInterface); |
| 163 | #endif |
| 164 | } |
| 165 | |
| 166 | |
| 167 | static bool nvlXe3GRegisteredMhwNext = |
| 168 | MediaFactory<uint32_t, MhwInterfacesNext>:: |
| 169 | Register<MhwInterfacesNvl_Xe3G>((uint32_t)IGFX_NVL_XE3G); |
| 170 | |
| 171 | MOS_STATUS MhwInterfacesNvl_Xe3G::Initialize( |
| 172 | CreateParams params, |
| 173 | PMOS_INTERFACE osInterface) |
| 174 | { |
| 175 | if (osInterface == nullptr) |
| 176 | { |
| 177 | MHW_ASSERTMESSAGE("The OS interface is not valid!"); |
| 178 | return MOS_STATUS_INVALID_PARAMETER; |
| 179 | } |
| 180 | m_osInterface = osInterface; |
| 181 | |
| 182 | auto gtSystemInfo = osInterface->pfnGetGtSystemInfo(osInterface); |
| 183 | if (gtSystemInfo == nullptr) |
| 184 | { |
| 185 | MHW_ASSERTMESSAGE("The OS interface is not valid!"); |
| 186 | return MOS_STATUS_INVALID_PARAMETER; |
| 187 | } |
| 188 | |
| 189 | if ((params.m_isCp == false) && (params.Flags.m_value == 0) && (params.m_isMos) == 0) |
| 190 | { |
| 191 | MHW_ASSERTMESSAGE("No MHW interfaces were requested for creation."); |
| 192 | return MOS_STATUS_INVALID_PARAMETER; |
| 193 | } |
| 194 | |
| 195 | //MHW_MI must always be created |
| 196 | auto ptr = std::make_shared<mhw::mi::xe3p_lpm::Impl>(osInterface); |
| 197 | m_miItf = std::static_pointer_cast<mhw::mi::Itf>(ptr); |
| 198 | |
| 199 | //For mos, need miInterface only |
| 200 | if(params.m_isMos) |
| 201 | { |
| 202 | return MOS_STATUS_SUCCESS; |
| 203 | } |
| 204 | |
| 205 | // MHW_CP must always be created |
| 206 | MOS_STATUS status; |
| 207 | m_cpInterface = osInterface->pfnCreateMhwCpInterface(osInterface); |
| 208 | MHW_MI_CHK_NULL(m_cpInterface); |
| 209 | ptr->SetCpInterface(m_cpInterface, m_miItf); |
| 210 | |
| 211 | InitializeRenderComponent(params, osInterface); |
| 212 | |
| 213 | if (params.Flags.m_sfc) |
| 214 | { |
| 215 | auto sfcPtr = std::make_shared<mhw::sfc::xe3p_lpm::Impl>(osInterface); |
| 216 | m_sfcItf = std::static_pointer_cast<mhw::sfc::Itf>(sfcPtr); |
| 217 | } |
| 218 | if (params.Flags.m_vebox) |
| 219 | { |
| 220 | auto veboxPtr = std::make_shared<mhw::vebox::xe3p_lpm::Impl>(osInterface); |
| 221 | m_veboxItf = std::static_pointer_cast<mhw::vebox::Itf>(veboxPtr); |
| 222 | } |
| 223 | |
| 224 | if (params.Flags.m_vdboxAll || params.Flags.m_mfx) |
| 225 | { |
| 226 | auto ptr = std::make_shared<mhw::vdbox::mfx::xe3p_lpm_base::xe3p_lpm::Impl>(osInterface, m_cpInterface); |
| 227 | m_mfxItf = std::static_pointer_cast<mhw::vdbox::mfx::Itf>(ptr); |
| 228 | } |
| 229 | if (params.Flags.m_vdboxAll || params.Flags.m_hcp) |
| 230 | { |
| 231 | m_hcpItf = std::make_shared<mhw::vdbox::hcp::xe3p_lpm_base::xe3p_lpm::Impl>(osInterface); |
| 232 | } |
| 233 | if (params.Flags.m_vdboxAll) |
| 234 | { |
| 235 | auto ptr = std::make_shared<mhw::vdbox::avp::xe3p_lpm_base::xe3p_lpm::Impl>(osInterface); |
| 236 | m_avpItf = std::static_pointer_cast<mhw::vdbox::avp::Itf>(ptr); |
| 237 | } |
| 238 | if (params.Flags.m_vdboxAll) |
| 239 | { |
| 240 | auto ptr = std::make_shared<mhw::vdbox::vvcp::xe3p_lpm_base::xe3p_lpm::Impl>(osInterface, m_cpInterface); |
| 241 | m_vvcpItf = std::static_pointer_cast<mhw::vdbox::vvcp::Itf>(ptr); |
| 242 | } |
| 243 | if (params.Flags.m_vdboxAll || params.Flags.m_huc) |
| 244 | { |
| 245 | auto ptr = std::make_shared<mhw::vdbox::huc::xe3p_lpm_base::xe3p_lpm::Impl>(osInterface, m_cpInterface); |
| 246 | m_hucItf = std::static_pointer_cast<mhw::vdbox::huc::Itf>(ptr); |
| 247 | } |
| 248 | #ifdef _MEDIA_RESERVED |
| 249 | if (params.Flags.m_vdboxAll) |
| 250 | { |
| 251 | auto ptr = std::make_shared<mhw::vdbox::aqm::xe3p_lpm_base::xe3p_lpm::Impl>(osInterface); |
| 252 | m_aqmItf = std::static_pointer_cast<mhw::vdbox::aqm::Itf>(ptr); |
| 253 | } |
| 254 | if (params.Flags.m_vdboxAll || params.Flags.m_vdenc) |
| 255 | { |
| 256 | auto ptr = std::make_shared<mhw::vdbox::vdenc::xe3p_lpm_base::xe3p_lpm::Impl>(osInterface); |
| 257 | m_vdencItf = std::static_pointer_cast<mhw::vdbox::vdenc::Itf>(ptr); |
| 258 | } |
| 259 | #else |
| 260 | // The xe3p_lpm vdenc is not yet available in the open source build. |
| 261 | // As a temporary workaround, the xe3_lpm vdenc is used for open source decode test. |
| 262 | // TODO: Remove this workaround once the xe3p_lpm vdenc is ready in open source. |
| 263 | if (params.Flags.m_vdboxAll || params.Flags.m_vdenc) |
| 264 | { |
| 265 | auto ptr = std::make_shared<mhw::vdbox::vdenc::xe3_lpm_base::xe3_lpm::Impl>(osInterface); |
| 266 | m_vdencItf = std::static_pointer_cast<mhw::vdbox::vdenc::Itf>(ptr); |
| 267 | } |
| 268 | #endif |
| 269 | if (params.Flags.m_blt) |
| 270 | { |
| 271 | auto bltptr = std::make_shared<mhw::blt::xe3p_lpm::Impl>(osInterface); |
| 272 | m_bltItf = std::static_pointer_cast<mhw::blt::Itf>(bltptr); |
| 273 | } |
| 274 | |
| 275 | return MOS_STATUS_SUCCESS; |
| 276 | } |
| 277 | |
| 278 | void MhwInterfacesNvl_Xe3G::InitializeRenderComponent( |
| 279 | CreateParams params, |
| 280 | PMOS_INTERFACE osInterface) |
| 281 | { |
| 282 | if (params.Flags.m_render) |
| 283 | { |
| 284 | auto renderPtr = std::make_shared<mhw::render::xe2_hpg_next::Impl>(osInterface); |
| 285 | m_renderItf = std::static_pointer_cast<mhw::render::Itf>(renderPtr); |
| 286 | } |
| 287 | if (params.Flags.m_stateHeap) |
| 288 | { |
| 289 | m_stateHeapInterface = |
| 290 | MOS_New(StateHeap, osInterface, params.m_heapMode); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | static bool nvlXe3GRegisteredCodecHal = |
| 295 | MediaFactory<uint32_t, CodechalDeviceNext>:: |
| 296 | Register<CodechalInterfacesXe3P_Lpm>((uint32_t)IGFX_NVL_XE3G); |
| 297 | |
| 298 | MOS_STATUS CodechalInterfacesXe3P_Lpm::Initialize( |
| 299 | void * standardInfo, |
| 300 | void * settings, |
| 301 | MhwInterfacesNext *mhwInterfaces, |
| 302 | PMOS_INTERFACE osInterface) |
| 303 | { |
| 304 | if (standardInfo == nullptr || |
| 305 | mhwInterfaces == nullptr || |
| 306 | osInterface == nullptr) |
| 307 | { |
| 308 | CODECHAL_PUBLIC_ASSERTMESSAGE("CodecHal device is not valid!"); |
| 309 | return MOS_STATUS_INVALID_PARAMETER; |
| 310 | } |
| 311 | |
| 312 | // This part should be moved back to media_intefaces.cpp for softlet build |
| 313 | PCODECHAL_STANDARD_INFO info = ((PCODECHAL_STANDARD_INFO)standardInfo); |
| 314 | CODECHAL_FUNCTION CodecFunction = info->CodecFunction; |
| 315 | |
| 316 | #ifdef _VP9_ENCODE_VDENC_SUPPORTED // VP9 Encode: Use VDEnc from xe3_lpm for VP9 encode. |
| 317 | if (mhwInterfaces != nullptr && info->Mode == CODECHAL_ENCODE_MODE_VP9) |
| 318 | { |
| 319 | auto ptr = std::make_shared<mhw::vdbox::vdenc::xe3_lpm_base::xe3_lpm::Impl>(osInterface); |
| 320 | mhwInterfaces->m_vdencItf = std::dynamic_pointer_cast<mhw::vdbox::vdenc::Itf>(ptr); |
| 321 | CODECHAL_PUBLIC_CHK_NULL_RETURN(mhwInterfaces->m_vdencItf); |
| 322 | } |
| 323 | #endif |
| 324 | |
| 325 | bool disableScalability = true; |
| 326 | |
| 327 | auto hwInterface = MOS_New(Hw, osInterface, CodecFunction, mhwInterfaces, disableScalability); |
| 328 | |
| 329 | if (hwInterface == nullptr) |
| 330 | { |
| 331 | CODECHAL_PUBLIC_ASSERTMESSAGE("hwInterface is not valid!"); |
| 332 | return MOS_STATUS_NO_SPACE; |
| 333 | } |
| 334 | hwInterface->pfnCreateDecodeSinglePipe = decode::DecodeScalabilitySinglePipeNext::CreateDecodeSinglePipe; |
| 335 | hwInterface->pfnCreateDecodeMultiPipe = decode::DecodeScalabilityMultiPipeNext::CreateDecodeMultiPipe; |
| 336 | |
| 337 | #if USE_CODECHAL_DEBUG_TOOL |
| 338 | CodechalDebugInterface *debugInterface = MOS_New(CodechalDebugInterface); |
| 339 | if (debugInterface == nullptr) |
| 340 | { |
| 341 | MOS_Delete(hwInterface); |
| 342 | CODECHAL_PUBLIC_ASSERTMESSAGE("debugInterface is not valid!"); |
| 343 | return MOS_STATUS_NO_SPACE; |
| 344 | } |
| 345 | if (debugInterface->Initialize(hwInterface, CodecFunction) != MOS_STATUS_SUCCESS) |
| 346 | { |
| 347 | MOS_Delete(hwInterface); |
| 348 | MOS_Delete(debugInterface); |
| 349 | CODECHAL_PUBLIC_ASSERTMESSAGE("Debug interface creation failed!"); |
| 350 | return MOS_STATUS_INVALID_PARAMETER; |
| 351 | } |
| 352 | #else |
| 353 | CodechalDebugInterface *debugInterface = nullptr; |
| 354 | #endif // USE_CODECHAL_DEBUG_TOOL |
| 355 | |
| 356 | auto release_func = [&]() |
| 357 | { |
| 358 | MOS_Delete(hwInterface); |
| 359 | #if USE_CODECHAL_DEBUG_TOOL |
| 360 | MOS_Delete(debugInterface); |
| 361 | #endif // USE_CODECHAL_DEBUG_TOOL |
| 362 | }; |
| 363 | |
| 364 | if (CodecHalIsDecode(CodecFunction)) |
| 365 | { |
| 366 | #ifdef _MPEG2_DECODE_SUPPORTED |
| 367 | if (info->Mode == CODECHAL_DECODE_MODE_MPEG2IDCT || |
| 368 | info->Mode == CODECHAL_DECODE_MODE_MPEG2VLD) |
| 369 | { |
| 370 | m_codechalDevice = MOS_New(Decode::Mpeg2, hwInterface, debugInterface); |
| 371 | } |
| 372 | else |
| 373 | #endif |
| 374 | #ifdef _VC1_DECODE_SUPPORTED |
| 375 | if (info->Mode == CODECHAL_DECODE_MODE_VC1IT || |
| 376 | info->Mode == CODECHAL_DECODE_MODE_VC1VLD) |
| 377 | { |
| 378 | CODECHAL_PUBLIC_ASSERTMESSAGE("NVL doesn't support VC1!"); |
| 379 | } |
| 380 | else |
| 381 | #endif |
| 382 | #ifdef _AVC_DECODE_SUPPORTED |
| 383 | if (info->Mode == CODECHAL_DECODE_MODE_AVCVLD) |
| 384 | { |
| 385 | m_codechalDevice = MOS_New(Decode::Avc, hwInterface, debugInterface); |
| 386 | } |
| 387 | else |
| 388 | #endif |
| 389 | #ifdef _JPEG_DECODE_SUPPORTED |
| 390 | if (info->Mode == CODECHAL_DECODE_MODE_JPEG) |
| 391 | { |
| 392 | m_codechalDevice = MOS_New(Decode::Jpeg, hwInterface, debugInterface); |
| 393 | } |
| 394 | else |
| 395 | #endif |
| 396 | #ifdef _VP8_DECODE_SUPPORTED |
| 397 | if (info->Mode == CODECHAL_DECODE_MODE_VP8VLD) |
| 398 | { |
| 399 | m_codechalDevice = MOS_New(Decode::Vp8, hwInterface, debugInterface); |
| 400 | } |
| 401 | else |
| 402 | #endif |
| 403 | #ifdef _HEVC_DECODE_SUPPORTED |
| 404 | if (info->Mode == CODECHAL_DECODE_MODE_HEVCVLD) |
| 405 | { |
| 406 | m_codechalDevice = MOS_New(Decode::Hevc, hwInterface, debugInterface); |
| 407 | } |
| 408 | else |
| 409 | #endif |
| 410 | #ifdef _VP9_DECODE_SUPPORTED |
| 411 | if (info->Mode == CODECHAL_DECODE_MODE_VP9VLD) |
| 412 | { |
| 413 | m_codechalDevice = MOS_New(Decode::Vp9, hwInterface, debugInterface); |
| 414 | } |
| 415 | else |
| 416 | #endif |
| 417 | #ifdef _AV1_DECODE_SUPPORTED |
| 418 | if (info->Mode == CODECHAL_DECODE_MODE_AV1VLD) |
| 419 | { |
| 420 | m_codechalDevice = MOS_New(Decode::Av1, hwInterface, debugInterface); |
| 421 | } |
| 422 | else |
| 423 | #endif |
| 424 | #ifdef _VVC_DECODE_SUPPORTED |
| 425 | if (info->Mode == CODECHAL_DECODE_MODE_VVCVLD) //VVC |
| 426 | { |
| 427 | m_codechalDevice = MOS_New(Decode::Vvc, hwInterface, debugInterface); |
| 428 | } |
| 429 | else |
| 430 | #endif |
| 431 | { |
| 432 | CODECHAL_PUBLIC_ASSERTMESSAGE("Decode mode requested invalid!"); |
| 433 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 434 | } |
| 435 | |
| 436 | if (m_codechalDevice == nullptr) |
| 437 | { |
| 438 | CODECHAL_PUBLIC_ASSERTMESSAGE("Decoder device creation failed!"); |
| 439 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_NO_SPACE, release_func); |
| 440 | } |
| 441 | } |
| 442 | else if (CodecHalIsEncode(CodecFunction)) |
| 443 | { |
| 444 | #if defined(_AVC_ENCODE_VDENC_SUPPORTED) && defined(_MEDIA_RESERVED) |
| 445 | if (info->Mode == CODECHAL_ENCODE_MODE_AVC) |
| 446 | { |
| 447 | if (CodecHalUsesVdencEngine(info->CodecFunction)) |
| 448 | { |
| 449 | m_codechalDevice = MOS_New(EncodeAvcVdencPipelineAdapterXe3P_Lpm, hwInterface, debugInterface); |
| 450 | if (m_codechalDevice == nullptr) |
| 451 | { |
| 452 | CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); |
| 453 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 454 | } |
| 455 | return MOS_STATUS_SUCCESS; |
| 456 | } |
| 457 | } |
| 458 | else |
| 459 | #endif |
| 460 | #if defined(_VP9_ENCODE_VDENC_SUPPORTED) |
| 461 | if (info->Mode == CODECHAL_ENCODE_MODE_VP9) |
| 462 | { |
| 463 | m_codechalDevice = MOS_New(EncodeVp9VdencPipelineAdapterXe3p_Lpm_Base, hwInterface, debugInterface); |
| 464 | if (m_codechalDevice == nullptr) |
| 465 | { |
| 466 | CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); |
| 467 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 468 | } |
| 469 | return MOS_STATUS_SUCCESS; |
| 470 | } |
| 471 | else |
| 472 | #endif |
| 473 | #if defined(_JPEG_ENCODE_SUPPORTED) |
| 474 | if (info->Mode == CODECHAL_ENCODE_MODE_JPEG) |
| 475 | { |
| 476 | m_codechalDevice = MOS_New(EncodeJpegPipelineAdapterXe3P_Lpm_Base, hwInterface, debugInterface); |
| 477 | if (m_codechalDevice == nullptr) |
| 478 | { |
| 479 | CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); |
| 480 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 481 | } |
| 482 | return MOS_STATUS_SUCCESS; |
| 483 | } |
| 484 | else |
| 485 | #endif |
| 486 | #if defined(_AV1_ENCODE_VDENC_SUPPORTED) && defined(_MEDIA_RESERVED) |
| 487 | if (info->Mode == codechalEncodeModeAv1) |
| 488 | { |
| 489 | if (CodecHalUsesVdencEngine(info->CodecFunction)) |
| 490 | { |
| 491 | m_codechalDevice = MOS_New(EncodeAv1VdencPipelineAdapterXe3P_Lpm, hwInterface, debugInterface); |
| 492 | if (m_codechalDevice == nullptr) |
| 493 | { |
| 494 | CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); |
| 495 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 496 | } |
| 497 | return MOS_STATUS_SUCCESS; |
| 498 | } |
| 499 | else |
| 500 | { |
| 501 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 502 | } |
| 503 | } |
| 504 | else |
| 505 | #endif |
| 506 | #if defined(_HEVC_ENCODE_VDENC_SUPPORTED) && defined(_MEDIA_RESERVED) |
| 507 | if (info->Mode == CODECHAL_ENCODE_MODE_HEVC) |
| 508 | { |
| 509 | if (CodecHalUsesVdencEngine(info->CodecFunction)) |
| 510 | { |
| 511 | m_codechalDevice = MOS_New(EncodeHevcVdencPipelineAdapterXe3P_Lpm_Base, hwInterface, debugInterface); |
| 512 | if (m_codechalDevice == nullptr) |
| 513 | { |
| 514 | CODECHAL_PUBLIC_ASSERTMESSAGE("Encode state creation failed!"); |
| 515 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 516 | } |
| 517 | return MOS_STATUS_SUCCESS; |
| 518 | } |
| 519 | } |
| 520 | else |
| 521 | #endif |
| 522 | { |
| 523 | CODECHAL_PUBLIC_ASSERTMESSAGE("Unsupported encode function requested."); |
| 524 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 525 | } |
| 526 | } |
| 527 | else |
| 528 | { |
| 529 | CODECHAL_PUBLIC_ASSERTMESSAGE("Unsupported codec function requested."); |
| 530 | CODECHAL_PUBLIC_CHK_STATUS_WITH_DESTROY_RETURN(MOS_STATUS_INVALID_PARAMETER, release_func); |
| 531 | } |
| 532 | |
| 533 | return MOS_STATUS_SUCCESS; |
| 534 | } |
| 535 | |
| 536 | static bool nvlXe3GRegisteredRenderHal = |
| 537 | MediaFactory<uint32_t, RenderHalDevice>:: |
| 538 | Register<RenderHalInterfacesNvl_Xe3G>((uint32_t)IGFX_NVL_XE3G); |
| 539 | |
| 540 | MOS_STATUS RenderHalInterfacesNvl_Xe3G::Initialize() |
| 541 | { |
| 542 | m_renderhalDevice = MOS_New(XRenderHal); |
| 543 | if (m_renderhalDevice == nullptr) |
| 544 | { |
| 545 | MHW_ASSERTMESSAGE("Create Render Hal interfaces failed.") |
| 546 | return MOS_STATUS_NO_SPACE; |
| 547 | } |
| 548 | return MOS_STATUS_SUCCESS; |
| 549 | } |
| 550 | |
| 551 | #define IP_VERSION_XE3P_LPM 0x1700 |
| 552 | static bool nvlXe3GRegisteredHwInfo = |
| 553 | MediaFactory<uint32_t, MediaInterfacesHwInfoDevice>::Register<MediaInterfacesHwInfoDeviceXe3P_Lpm>((uint32_t)IGFX_NVL_XE3G); |
| 554 | |
| 555 | MOS_STATUS MediaInterfacesHwInfoDeviceXe3P_Lpm::Initialize(PLATFORM platform) |
| 556 | { |
| 557 | m_hwInfo.SetDeviceInfo(IP_VERSION_XE3P_LPM, platform.usRevId); |
| 558 | return MOS_STATUS_SUCCESS; |
| 559 | } |
| 560 | |
| 561 | static bool nvlXe3GRegisteredMcpy = |
| 562 | MediaFactory<uint32_t, McpyDeviceNext>:: |
| 563 | Register<McpyDeviceXe3P_Lpm_Base>((uint32_t)IGFX_NVL_XE3G); |
| 564 | |
| 565 | static bool nvlXe3GRegisteredHucKernelSource = |
| 566 | MediaFactory<uint32_t, HucKernelSourceDevice>:: |
| 567 | Register<HucKernelSourceDeviceXe3P_Lpm>((uint32_t)IGFX_NVL_XE3G); |
| 568 | |
| 569 | MOS_STATUS HucKernelSourceDeviceXe3P_Lpm::Initialize() |
| 570 | { |
| 571 | m_hucKernelSource = &HucKernelSourceXe3P_Lpm_Base::GetInstance(); |
| 572 | return MOS_STATUS_SUCCESS; |
| 573 | } |