Last active
November 3, 2022 09:27
-
-
Save frantisekz/4932cf5b5b304163268c6c7386f61d0b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 15bec3a35578fea92fd9d3dd46f1f0960f4dd809 Mon Sep 17 00:00:00 2001 | |
From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com> | |
Date: Wed, 2 Nov 2022 18:15:59 +0100 | |
Subject: [PATCH] Disable patent-encumbered codecs | |
--- | |
.../linux/media_feature_flags_linux.cmake | 4 +-- | |
.../linux/Xe_M/ddi/media_libva_caps_dg2.cpp | 22 ++++++++++----- | |
.../linux/Xe_M/ddi/media_libva_caps_pvc.cpp | 13 ++++----- | |
.../Xe_M/ddi/media_libva_caps_xehp_sdv.cpp | 6 ++++ | |
.../linux/Xe_M/ddi/media_sku_wa_xe.cpp | 28 +++++++++---------- | |
.../linux/common/ddi/media_libva_caps.cpp | 14 +++++----- | |
.../linux/media_feature_flags_linux.cmake | 4 +-- | |
7 files changed, 52 insertions(+), 39 deletions(-) | |
diff --git a/media_driver/cmake/linux/media_feature_flags_linux.cmake b/media_driver/cmake/linux/media_feature_flags_linux.cmake | |
index acf3768..c3e20a1 100644 | |
--- a/media_driver/cmake/linux/media_feature_flags_linux.cmake | |
+++ b/media_driver/cmake/linux/media_feature_flags_linux.cmake | |
@@ -55,8 +55,8 @@ endif() | |
# features are always able to open | |
bs_set_if_undefined(AV1_Decode_Supported "yes") | |
-bs_set_if_undefined(AVC_Decode_Supported "yes") | |
-bs_set_if_undefined(HEVC_Decode_Supported "yes") | |
+bs_set_if_undefined(AVC_Decode_Supported "no") | |
+bs_set_if_undefined(HEVC_Decode_Supported "no") | |
bs_set_if_undefined(JPEG_Decode_Supported "yes") | |
bs_set_if_undefined(MPEG2_Decode_Supported "yes") | |
bs_set_if_undefined(VP8_Decode_Supported "yes") | |
diff --git a/media_driver/linux/Xe_M/ddi/media_libva_caps_dg2.cpp b/media_driver/linux/Xe_M/ddi/media_libva_caps_dg2.cpp | |
index 6eb73bf..b00131f 100644 | |
--- a/media_driver/linux/Xe_M/ddi/media_libva_caps_dg2.cpp | |
+++ b/media_driver/linux/Xe_M/ddi/media_libva_caps_dg2.cpp | |
@@ -98,6 +98,7 @@ VAStatus MediaLibvaCapsDG2::LoadAv1EncProfileEntrypoints() | |
VAStatus MediaLibvaCapsDG2::LoadAvcEncLpProfileEntrypoints() | |
{ | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
VAStatus status = VA_STATUS_SUCCESS; | |
#if defined(_AVC_ENCODE_VDENC_SUPPORTED) | |
@@ -277,13 +278,7 @@ VAStatus MediaLibvaCapsDG2::CheckEncodeResolution( | |
case VAProfileHEVCSccMain10: | |
case VAProfileHEVCSccMain444: | |
case VAProfileHEVCSccMain444_10: | |
- if (width > m_maxHevcEncWidth | |
- || width < (m_vdencActive ? m_hevcVDEncMinWidth : m_encMinWidth) | |
- || height > m_maxHevcEncHeight | |
- || height < (m_vdencActive ? m_hevcVDEncMinHeight : m_encMinHeight)) | |
- { | |
- return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; | |
- } | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
break; | |
case VAProfileVP9Profile0: | |
case VAProfileVP9Profile1: | |
@@ -325,6 +320,9 @@ VAStatus MediaLibvaCapsDG2::CheckEncRTFormat( | |
VAEntrypoint entrypoint, | |
VAConfigAttrib* attrib) | |
{ | |
+ if (IsAvcProfile(profile) || IsHevcProfile(profile)) { | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
+ } | |
DDI_CHK_NULL(attrib, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); | |
attrib->type = VAConfigAttribRTFormat; | |
if (profile == VAProfileJPEGBaseline) | |
@@ -390,6 +388,9 @@ VAStatus MediaLibvaCapsDG2::GetPlatformSpecificAttrib(VAProfile profile, | |
VAConfigAttribType type, | |
uint32_t *value) | |
{ | |
+ if (IsAvcProfile(profile) || IsHevcProfile(profile)) { | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
+ } | |
DDI_CHK_NULL(value, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); | |
VAStatus status = VA_STATUS_SUCCESS; | |
*value = VA_ATTRIB_NOT_SUPPORTED; | |
@@ -606,6 +607,10 @@ VAStatus MediaLibvaCapsDG2::CreateEncAttributes( | |
VAEntrypoint entrypoint, | |
AttribMap **attributeList) | |
{ | |
+ if (IsAvcProfile(profile) || IsHevcProfile(profile)) { | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
+ } | |
+ | |
if(IsVp8Profile(profile)) | |
{ | |
return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
@@ -1001,6 +1006,9 @@ VAStatus MediaLibvaCapsDG2::AddEncSurfaceAttributes( | |
VASurfaceAttrib *attribList, | |
uint32_t &numAttribs) | |
{ | |
+ if (IsAvcProfile(profile) || IsHevcProfile(profile)) { | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
+ } | |
DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); | |
if (profile == VAProfileAV1Profile0) | |
diff --git a/media_driver/linux/Xe_M/ddi/media_libva_caps_pvc.cpp b/media_driver/linux/Xe_M/ddi/media_libva_caps_pvc.cpp | |
index 9e794f8..6659978 100644 | |
--- a/media_driver/linux/Xe_M/ddi/media_libva_caps_pvc.cpp | |
+++ b/media_driver/linux/Xe_M/ddi/media_libva_caps_pvc.cpp | |
@@ -48,6 +48,7 @@ VAStatus MediaLibvaCapsPVC::LoadAv1DecProfileEntrypoints() | |
VAStatus MediaLibvaCapsPVC::LoadHevcEncLpProfileEntrypoints() | |
{ | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
DDI_CHK_NULL(m_mediaCtx, "nullptr m_mediaCtx", VA_STATUS_ERROR_INVALID_CONTEXT); | |
DDI_CHK_NULL(m_mediaCtx->pDrmBufMgr, "nullptr pDrmBufMgr", VA_STATUS_ERROR_INVALID_PARAMETER); | |
DDI_CHK_CONDITION(m_mediaCtx->pDrmBufMgr->has_full_vd == false, | |
@@ -147,13 +148,7 @@ VAStatus MediaLibvaCapsPVC::CheckEncodeResolution( | |
case VAProfileHEVCMain10: | |
case VAProfileHEVCMain444: | |
case VAProfileHEVCMain444_10: | |
- if (width > CODEC_8K_MAX_PIC_WIDTH | |
- || width < m_hevcVDEncMinWidth | |
- || height > CODEC_8K_MAX_PIC_HEIGHT | |
- || height < m_hevcVDEncMinHeight) | |
- { | |
- return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED; | |
- } | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
break; | |
default: | |
if (width > m_encMax4kWidth | |
@@ -174,6 +169,10 @@ VAStatus MediaLibvaCapsPVC::AddEncSurfaceAttributes( | |
VASurfaceAttrib *attribList, | |
uint32_t &numAttribs) | |
{ | |
+ if (IsAvcProfile(profile) || IsHevcProfile(profile)) { | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
+ } | |
+ | |
DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER); | |
if(entrypoint == VAEntrypointEncSliceLP) | |
diff --git a/media_driver/linux/Xe_M/ddi/media_libva_caps_xehp_sdv.cpp b/media_driver/linux/Xe_M/ddi/media_libva_caps_xehp_sdv.cpp | |
index 8c41dd8..9387aa2 100644 | |
--- a/media_driver/linux/Xe_M/ddi/media_libva_caps_xehp_sdv.cpp | |
+++ b/media_driver/linux/Xe_M/ddi/media_libva_caps_xehp_sdv.cpp | |
@@ -37,6 +37,9 @@ VAStatus MediaLibvaCapsXeHP::CheckEncodeResolution( | |
uint32_t width, | |
uint32_t height) | |
{ | |
+ if (IsAvcProfile(profile) || IsHevcProfile(profile)) { | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
+ } | |
VAStatus status = MediaLibvaCapsG12::CheckEncodeResolution(profile, width, height); | |
if (!m_vdencActive && (profile == VAProfileHEVCMain || profile == VAProfileHEVCMain10)) | |
@@ -57,6 +60,9 @@ VAStatus MediaLibvaCapsXeHP::GetPlatformSpecificAttrib(VAProfile profile, | |
VAConfigAttribType type, | |
uint32_t *value) | |
{ | |
+ if (IsAvcProfile(profile) || IsHevcProfile(profile)) { | |
+ return VA_STATUS_ERROR_UNSUPPORTED_PROFILE; | |
+ } | |
VAStatus status = MediaLibvaCapsG12::GetPlatformSpecificAttrib(profile, entrypoint, type, value); | |
if (entrypoint == VAEntrypointEncSlice || entrypoint == VAEntrypointFEI) | |
diff --git a/media_driver/linux/Xe_M/ddi/media_sku_wa_xe.cpp b/media_driver/linux/Xe_M/ddi/media_sku_wa_xe.cpp | |
index 70cd33c..ab08d3e 100644 | |
--- a/media_driver/linux/Xe_M/ddi/media_sku_wa_xe.cpp | |
+++ b/media_driver/linux/Xe_M/ddi/media_sku_wa_xe.cpp | |
@@ -52,19 +52,19 @@ typedef DeviceInfoFactory<LinuxDeviceInit> DeviceInit; | |
static struct LinuxCodecInfo XehpSdvCodecInfo = | |
{ | |
- .avcDecoding = 1, | |
+ .avcDecoding = 0, | |
.mpeg2Decoding = 1, | |
.vp8Decoding = 0, | |
.vc1Decoding = 0, | |
.jpegDecoding = 1, | |
.avcEncoding = 0, | |
.mpeg2Encoding = 0, | |
- .hevcDecoding = 1, | |
+ .hevcDecoding = 0, | |
.hevcEncoding = 0, | |
.jpegEncoding = 0, | |
.avcVdenc = 0, | |
.vp9Decoding = 1, | |
- .hevc10Decoding = 1, | |
+ .hevc10Decoding = 0, | |
.vp9b10Decoding = 1, | |
.hevc10Encoding = 0, | |
.hevc12Encoding = 0, | |
@@ -77,24 +77,24 @@ static struct LinuxCodecInfo XehpSdvCodecInfo = | |
static struct LinuxCodecInfo Dg2CodecInfo = | |
{ | |
- .avcDecoding = 1, | |
+ .avcDecoding = 0, | |
.mpeg2Decoding = 1, | |
.vp8Decoding = 0, | |
.vc1Decoding = 0, | |
.jpegDecoding = 1, | |
.avcEncoding = 0, | |
.mpeg2Encoding = 0, | |
- .hevcDecoding = 1, | |
+ .hevcDecoding = 0, | |
.hevcEncoding = 0, | |
.jpegEncoding = 1, | |
.avcVdenc = 1, | |
.vp9Decoding = 1, | |
- .hevc10Decoding = 1, | |
+ .hevc10Decoding = 0, | |
.vp9b10Decoding = 1, | |
.hevc10Encoding = 0, | |
.hevc12Encoding = 0, | |
.vp8Encoding = 0, | |
- .hevcVdenc = 1, | |
+ .hevcVdenc = 0, | |
.vp9Vdenc = 1, | |
.adv0Decoding = 1, | |
.adv1Decoding = 1, | |
@@ -102,30 +102,30 @@ static struct LinuxCodecInfo Dg2CodecInfo = | |
static struct LinuxCodecInfo PvcCodecInfo = | |
{ | |
- .avcDecoding = 1, | |
+ .avcDecoding = 0, | |
.mpeg2Decoding = 1, | |
.vp8Decoding = 0, | |
.vc1Decoding = 0, | |
.jpegDecoding = 1, | |
.avcEncoding = 0, | |
.mpeg2Encoding = 0, | |
- .hevcDecoding = 1, | |
+ .hevcDecoding = 0, | |
.hevcEncoding = 0, | |
#ifdef IGFX_PVC_ENABLE_NON_UPSTREAM | |
.jpegEncoding = 1, | |
- .avcVdenc = 1, | |
+ .avcVdenc = 0, | |
#else | |
.jpegEncoding = 0, | |
.avcVdenc = 0, | |
#endif | |
.vp9Decoding = 1, | |
- .hevc10Decoding = 1, | |
+ .hevc10Decoding = 0, | |
.vp9b10Decoding = 1, | |
.hevc10Encoding = 0, | |
.hevc12Encoding = 0, | |
.vp8Encoding = 0, | |
#ifdef IGFX_PVC_ENABLE_NON_UPSTREAM | |
- .hevcVdenc = 1, | |
+ .hevcVdenc = 0, | |
.vp9Vdenc = 1, | |
#else | |
.hevcVdenc = 0, | |
@@ -390,7 +390,7 @@ static bool InitTglMediaWaExt(struct GfxDeviceInfo *devInfo, | |
/*software wa to fix some corner hang cases for Scalability*/ | |
MEDIA_WR_WA(waTable, Wa_2209620131, 1); | |
- | |
+ | |
if (drvInfo->devId == 0x9A49 || | |
drvInfo->devId == 0x9AC9 || | |
drvInfo->devId == 0x9A60 || | |
@@ -685,7 +685,7 @@ static bool InitPvcMediaWa(struct GfxDeviceInfo *devInfo, | |
MEDIA_WR_WA(waTable, WaForceAllocateLML3, 0); | |
MEDIA_WR_WA(waTable, WaForceAllocateLML4, 0); | |
} | |
- | |
+ | |
if(userFeatureData.u32Data == 3) | |
{ | |
MEDIA_WR_WA(waTable, WaForceAllocateLML2, 0); | |
diff --git a/media_driver/linux/common/ddi/media_libva_caps.cpp b/media_driver/linux/common/ddi/media_libva_caps.cpp | |
index 365b295..471e586 100755 | |
--- a/media_driver/linux/common/ddi/media_libva_caps.cpp | |
+++ b/media_driver/linux/common/ddi/media_libva_caps.cpp | |
@@ -1279,7 +1279,7 @@ VAStatus MediaLibvaCaps::CreateVpAttributes( | |
VAStatus MediaLibvaCaps::LoadAvcDecProfileEntrypoints() | |
{ | |
VAStatus status = VA_STATUS_SUCCESS; | |
- | |
+ return status; | |
#ifdef _AVC_DECODE_SUPPORTED | |
AttribMap *attributeList = nullptr; | |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrAVCVLDLongDecoding) | |
@@ -1332,7 +1332,7 @@ VAStatus MediaLibvaCaps::LoadAvcDecProfileEntrypoints() | |
VAStatus MediaLibvaCaps::LoadAvcEncProfileEntrypoints() | |
{ | |
VAStatus status = VA_STATUS_SUCCESS; | |
- | |
+ return status; | |
#if defined (_AVC_ENCODE_VME_SUPPORTED) || defined (_AVC_ENCODE_VDENC_SUPPORTED) | |
AttribMap *attributeList = nullptr; | |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeAVC)) | |
@@ -1388,7 +1388,7 @@ VAStatus MediaLibvaCaps::LoadAvcEncProfileEntrypoints() | |
VAStatus MediaLibvaCaps::LoadAvcEncLpProfileEntrypoints() | |
{ | |
VAStatus status = VA_STATUS_SUCCESS; | |
- | |
+ return status; | |
#if defined (_AVC_ENCODE_VME_SUPPORTED) || defined (_AVC_ENCODE_VDENC_SUPPORTED) | |
AttribMap *attributeList = nullptr; | |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrEncodeAVCVdenc)) | |
@@ -1521,7 +1521,7 @@ VAStatus MediaLibvaCaps::LoadJpegEncProfileEntrypoints() | |
VAStatus MediaLibvaCaps::LoadVc1DecProfileEntrypoints() | |
{ | |
VAStatus status = VA_STATUS_SUCCESS; | |
- | |
+ return status; | |
#ifdef _VC1_DECODE_SUPPORTED | |
AttribMap *attributeList = nullptr; | |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrVC1VLDDecoding)) | |
@@ -1747,7 +1747,7 @@ VAStatus MediaLibvaCaps::LoadVp9EncProfileEntrypoints() | |
VAStatus MediaLibvaCaps::LoadHevcDecProfileEntrypoints() | |
{ | |
VAStatus status = VA_STATUS_SUCCESS; | |
- | |
+ return status; | |
#ifdef _HEVC_DECODE_SUPPORTED | |
if (MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrIntelHEVCVLDMainDecoding) | |
|| MEDIA_IS_SKU(&(m_mediaCtx->SkuTable), FtrHEVCVLDMainShortDecoding)) | |
@@ -1834,7 +1834,7 @@ VAStatus MediaLibvaCaps::LoadHevcEncProfileEntrypoints() | |
{ | |
VAStatus status = VA_STATUS_SUCCESS; | |
const uint8_t rcModeSize = (sizeof(m_encRcMode))/(sizeof(m_encRcMode[0])); | |
- | |
+ return status; | |
#if defined (_HEVC_ENCODE_VME_SUPPORTED) || defined (_HEVC_ENCODE_VDENC_SUPPORTED) | |
AttribMap *attributeList = nullptr; | |
@@ -3088,7 +3088,7 @@ VAStatus MediaLibvaCaps::QuerySurfaceAttributes( | |
MOS_FreeMemory(attribs); | |
return status; | |
} | |
- | |
+ | |
VAStatus MediaLibvaCaps::QueryDisplayAttributes( | |
VADisplayAttribute *attribList, | |
int32_t *numAttribs) | |
diff --git a/media_softlet/cmake/linux/media_feature_flags_linux.cmake b/media_softlet/cmake/linux/media_feature_flags_linux.cmake | |
index 0babcff..d1c8038 100644 | |
--- a/media_softlet/cmake/linux/media_feature_flags_linux.cmake | |
+++ b/media_softlet/cmake/linux/media_feature_flags_linux.cmake | |
@@ -55,8 +55,8 @@ endif() | |
# features are always able to open | |
bs_set_if_undefined(AV1_Decode_Supported "yes") | |
-bs_set_if_undefined(AVC_Decode_Supported "yes") | |
-bs_set_if_undefined(HEVC_Decode_Supported "yes") | |
+bs_set_if_undefined(AVC_Decode_Supported "no") | |
+bs_set_if_undefined(HEVC_Decode_Supported "no") | |
bs_set_if_undefined(JPEG_Decode_Supported "yes") | |
bs_set_if_undefined(MPEG2_Decode_Supported "yes") | |
bs_set_if_undefined(VP8_Decode_Supported "yes") | |
-- | |
2.38.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment