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