From 647893d233066b3ca79bccb48de4c26867fb9a88 Mon Sep 17 00:00:00 2001 From: aidan2020sh Date: Fri, 24 Dec 2021 15:11:29 +0800 Subject: [PATCH 1/2] upstream ADLN this patch is used to upstream new platform ADLN support This patch was imported from iHD media-driver git server (https://github.com/intel/media-driver/commit/348e98e90d240deecd3040f3846a27e9bb6c3ac1) Upstream-status: Backport Signed-off-by: Lim Siew Hoon --- .../linux/gen12/ddi/media_libva_caps_g12.cpp | 6 + .../linux/gen12/ddi/media_sku_wa_g12.cpp | 47 ++++++++ .../linux/gen12/ddi/media_sysinfo_g12.cpp | 32 ++++++ .../media_interfaces_g12_adln.cpp | 106 ++++++++++++++++++ .../media_interfaces_g12_adln.h | 45 ++++++++ .../media_srcs.cmake | 49 ++++++++ media_driver/media_interface/media_srcs.cmake | 4 + 7 files changed, 289 insertions(+) create mode 100644 media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp create mode 100644 media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h create mode 100644 media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake diff --git a/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp b/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp index 1c47cb369..de6273089 100644 --- a/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp +++ b/media_driver/linux/gen12/ddi/media_libva_caps_g12.cpp @@ -2813,3 +2813,9 @@ static bool adlpRegistered = MediaLibvaCapsFactory((uint32_t)IGFX_ALDERLAKE_P); #endif +#ifdef IGFX_GEN12_ADLN_SUPPORTED +static bool adlnRegistered = MediaLibvaCapsFactory:: + RegisterCaps((uint32_t)IGFX_ALDERLAKE_N); +#endif + + diff --git a/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp b/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp index 88e03705e..8155d885d 100644 --- a/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp +++ b/media_driver/linux/gen12/ddi/media_sku_wa_g12.cpp @@ -587,6 +587,53 @@ static bool adlpDeviceRegister = DeviceInfoFactory:: #endif +#ifdef IGFX_GEN12_ADLN_SUPPORTED +static bool InitAdlnMediaSku(struct GfxDeviceInfo *devInfo, + MediaFeatureTable * skuTable, + struct LinuxDriverInfo * drvInfo) +{ + if (!InitTglMediaSku(devInfo, skuTable, drvInfo)) + { + return false; + } + + if (devInfo->eGTType == GTTYPE_GT0_5) + { + MEDIA_WR_SKU(skuTable, FtrGT0_5, 1); + } + + MEDIA_WR_SKU(skuTable, FtrAV1VLDLSTDecoding, 1); + MEDIA_WR_SKU(skuTable, FtrGucSubmission, 1); + + return true; +} + +static bool InitAdlnMediaWa(struct GfxDeviceInfo *devInfo, + MediaWaTable * waTable, + struct LinuxDriverInfo * drvInfo) +{ + if (!InitTglMediaWa(devInfo, waTable, drvInfo)) + { + return false; + } + + //ADL-N keeps below setting same as ADL-S/ADL-P + MEDIA_WR_WA(waTable, Wa_1409820462, 0); + + return true; +} + +static struct LinuxDeviceInit adlnDeviceInit = + { + .productFamily = IGFX_ALDERLAKE_N, + .InitMediaFeature = InitAdlnMediaSku, + .InitMediaWa = InitAdlnMediaWa, +}; + +static bool adlnDeviceRegister = DeviceInfoFactory:: + RegisterDevice(IGFX_ALDERLAKE_N, &adlnDeviceInit); + +#endif static struct LinuxDeviceInit tgllpDeviceInit = { diff --git a/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp b/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp index b3c402191..f68fe6665 100644 --- a/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp +++ b/media_driver/linux/gen12/ddi/media_sysinfo_g12.cpp @@ -460,6 +460,38 @@ static bool adlpGt2Device4626 = DeviceInfoFactory:: #endif +#ifdef IGFX_GEN12_ADLN_SUPPORTED +static struct GfxDeviceInfo adlnGt1Info = { + .platformType = PLATFORM_MOBILE, + .productFamily = IGFX_ALDERLAKE_N, + .displayFamily = IGFX_GEN12_CORE, + .renderFamily = IGFX_GEN12_CORE, + .eGTType = GTTYPE_GT1, + .L3CacheSizeInKb = 0, + .L3BankCount = 8, + .EUCount = 0, + .SliceCount = 0, + .SubSliceCount = 0, + .MaxEuPerSubSlice = 0, + .isLCIA = 0, + .hasLLC = 0, + .hasERAM = 0, + .InitMediaSysInfo = InitTglMediaSysInfo, + .InitShadowSku = InitTglShadowSku, + .InitShadowWa = InitTglShadowWa, +}; + +static bool adlnGt1Device46D0 = DeviceInfoFactory:: + RegisterDevice(0x46D0, &adlnGt1Info); + +static bool adlnGt1Device46D1 = DeviceInfoFactory:: + RegisterDevice(0x46D1, &adlnGt1Info); + +static bool adlnGt1Device46D2 = DeviceInfoFactory:: + RegisterDevice(0x46D2, &adlnGt1Info); +#endif + + static bool tgllpGt2Device9a40 = DeviceInfoFactory:: RegisterDevice(0x9A40, &tgllpGt2Info); diff --git a/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp new file mode 100644 index 000000000..089c8a51c --- /dev/null +++ b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.cpp @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2011-2022, Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +//! +//! \file media_interfaces_g12_adln.cpp + +//! \brief Helps with Gen12 ADL-N factory creation. +//! + +#include "media_interfaces_g12_adln.h" + +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; +extern template class MediaInterfacesFactory; + +static bool adlnRegisteredVphal = +MediaInterfacesFactory:: +RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + +static bool adlnRegisteredMhw = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + +#ifdef _MMC_SUPPORTED +static bool adlnRegisteredMmd = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); +#endif + +#define PLATFORM_INTEL_ADLN 24 +#define GENX_TGLLP 12 + +static bool adlnRegisteredNv12ToP010 = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + +static bool adlnRegisteredCodecHal = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + +static bool adlnRegisteredCMHal = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + + +MOS_STATUS CMHalInterfacesG12Adln::Initialize(CM_HAL_STATE *pCmState) +{ + if (pCmState == nullptr) + { + MHW_ASSERTMESSAGE("pCmState is nullptr.") + return MOS_STATUS_INVALID_PARAMETER; + } + + m_cmhalDevice = MOS_New(CMHal, pCmState); + if (m_cmhalDevice == nullptr) + { + MHW_ASSERTMESSAGE("Create CM Hal interfaces failed.") + return MOS_STATUS_NO_SPACE; + } + + m_cmhalDevice->SetGenPlatformInfo(PLATFORM_INTEL_ADLN, PLATFORM_INTEL_GT1, "TGLLP"); + uint32_t cisaIDs[] = { GENX_TGLLP }; + m_cmhalDevice->AddSupportedCisaIDs(cisaIDs, sizeof(cisaIDs)/sizeof(uint32_t)); + m_cmhalDevice->m_l3Plane = TGL_L3_PLANE; + m_cmhalDevice->m_l3ConfigCount = TGL_L3_CONFIG_NUM; + return MOS_STATUS_SUCCESS; +} + +static bool adlnRegisteredMosUtil = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + + +static bool adlnRegisteredRenderHal = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + +static bool adlnRegisteredDecodeHistogram = + MediaInterfacesFactory:: + RegisterHal((uint32_t)IGFX_ALDERLAKE_N); + diff --git a/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h new file mode 100644 index 000000000..a1f9c0d40 --- /dev/null +++ b/media_driver/media_interface/media_interfaces_m12_adln/media_interfaces_g12_adln.h @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2011-2022, Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ + +//! +//! \file media_interfaces_gen12_adln.h +//! \brief All interfaces used for Gen12 ADL-N that require factory creation +//! + +#ifndef __MEDIA_INTERFACES_G12_adln_H__ +#define __MEDIA_INTERFACES_G12_adln_H__ + + +#include "media_interfaces_g12_tgllp.h" +#include "renderhal_g12_base.h" + + +class CMHalInterfacesG12Adln : public CMHalDevice +{ +protected: + using CMHal = CM_HAL_G12_X; + MOS_STATUS Initialize( + CM_HAL_STATE *pCmState); +}; + +#endif // __MEDIA_INTERFACES_G12_adln_H__ + diff --git a/media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake b/media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake new file mode 100644 index 000000000..834c2298a --- /dev/null +++ b/media_driver/media_interface/media_interfaces_m12_adln/media_srcs.cmake @@ -0,0 +1,49 @@ +# Copyright (c) 2022, Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. + +set(TMP_SOURCES_ + ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_g12_adln.cpp +) + +set(TMP_HEADERS_ + ${CMAKE_CURRENT_LIST_DIR}/media_interfaces_g12_adln.h +) + +set(SOURCES_ + ${SOURCES_} + ${TMP_SOURCES_} +) + +set(HEADERS_ + ${HEADERS_} + ${TMP_HEADERS_} +) + +set(COMMON_SOURCES_ + ${COMMON_SOURCES_} + ${TMP_SOURCES_} +) + +set(COMMON_HEADERS_ + ${COMMON_HEADERS_} + ${TMP_HEADERS_} +) + +media_add_curr_to_include_path() diff --git a/media_driver/media_interface/media_srcs.cmake b/media_driver/media_interface/media_srcs.cmake index e4cb114d8..dfa7aa3f1 100644 --- a/media_driver/media_interface/media_srcs.cmake +++ b/media_driver/media_interface/media_srcs.cmake @@ -75,6 +75,10 @@ if(GEN12_ADLP) media_include_subdirectory(media_interfaces_m12_adlp) endif() +if(GEN12_ADLN) + media_include_subdirectory(media_interfaces_m12_adln) +endif() + if(XEHP_SDV) media_include_subdirectory(media_interfaces_xehp_sdv) endif() -- 2.34.1