mirror of
git://git.yoctoproject.org/meta-intel.git
synced 2025-07-05 05:04:45 +02:00
libvpl-tools: backport list of bug fixed in sample
backport list code fixed for sample app from upstream: - 0001-Correct-va-attrib-for-vaapiallocator.patch - 0002-Enable-YUV400-JPEG-Enc-for-vaapi.patch - 0003-Enable-YUV400-JPEG-Enc-for-linux-vaapi-only.patch - 0004-Fix-rDRM-DMA-methods.patch - 0005-Force-allocator-to-use-DRM_PRIME-for-rDRM.patch - 0006-Enable-VVC-in-sample_decode.patch - 0007-Fix-X11-rendering-for-xe.patch - 0008-Fix-code-formatting.patch Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
This commit is contained in:
parent
3b4ab5676d
commit
945c5bbb80
|
@ -0,0 +1,44 @@
|
|||
From 7c3332337d030ec98b4ffeeeac50028b0875262f Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
|
||||
Date: Mon, 13 May 2024 17:07:20 +0800
|
||||
Subject: [PATCH 1/9] Correct va-attrib for vaapiallocator
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/54d7d459a918cd26deaa91a37d34b13c37779597]
|
||||
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
|
||||
---
|
||||
tools/legacy/sample_common/src/vaapi_allocator.cpp | 12 +++++++-----
|
||||
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_common/src/vaapi_allocator.cpp b/tools/legacy/sample_common/src/vaapi_allocator.cpp
|
||||
index e5a8823..db18e23 100644
|
||||
--- a/tools/legacy/sample_common/src/vaapi_allocator.cpp
|
||||
+++ b/tools/legacy/sample_common/src/vaapi_allocator.cpp
|
||||
@@ -245,11 +245,11 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest* request,
|
||||
if (VA_FOURCC_P208 != va_fourcc) {
|
||||
unsigned int format;
|
||||
|
||||
- attrib[attrCnt].type = VASurfaceAttribPixelFormat;
|
||||
- attrib[attrCnt].flags = VA_SURFACE_ATTRIB_SETTABLE;
|
||||
- attrib[attrCnt].value.type = VAGenericValueTypeInteger;
|
||||
- attrib[attrCnt].value.value.i = va_fourcc;
|
||||
- format = va_fourcc;
|
||||
+ attrib[attrCnt].type = VASurfaceAttribPixelFormat;
|
||||
+ attrib[attrCnt].flags = VA_SURFACE_ATTRIB_SETTABLE;
|
||||
+ attrib[attrCnt].value.type = VAGenericValueTypeInteger;
|
||||
+ attrib[attrCnt++].value.value.i = va_fourcc;
|
||||
+ format = va_fourcc;
|
||||
|
||||
if ((fourcc == MFX_FOURCC_VP8_NV12) ||
|
||||
((MFX_MEMTYPE_FROM_ENCODE & request->Type) && (fourcc == MFX_FOURCC_BGR4))) {
|
||||
@@ -257,6 +257,8 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest* request,
|
||||
* RGB32 for JPEG is required
|
||||
*/
|
||||
attrib[attrCnt].type = (VASurfaceAttribType)VASurfaceAttribUsageHint;
|
||||
+ attrib[attrCnt].flags = VA_SURFACE_ATTRIB_SETTABLE;
|
||||
+ attrib[attrCnt].value.type = VAGenericValueTypeInteger;
|
||||
attrib[attrCnt++].value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER;
|
||||
}
|
||||
else if (fourcc == MFX_FOURCC_VP8_MBDATA) {
|
||||
--
|
||||
2.43.2
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
From 1a064a36c164080a21f8d89409564c1812dea6af Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
|
||||
Date: Wed, 15 May 2024 09:51:53 +0800
|
||||
Subject: [PATCH 2/9] Enable YUV400 JPEG Enc for vaapi
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/747b66ce97c6ac5d17a8b8629eb22d790d802da3]
|
||||
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
|
||||
---
|
||||
.../legacy/sample_common/src/sample_utils.cpp | 2 +-
|
||||
.../sample_common/src/vaapi_allocator.cpp | 13 +++++++++++-
|
||||
.../sample_encode/src/pipeline_encode.cpp | 20 +++++++++----------
|
||||
.../sample_encode/src/sample_encode.cpp | 4 ----
|
||||
4 files changed, 22 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_common/src/sample_utils.cpp b/tools/legacy/sample_common/src/sample_utils.cpp
|
||||
index ddd783f..b2b67bf 100644
|
||||
--- a/tools/legacy/sample_common/src/sample_utils.cpp
|
||||
+++ b/tools/legacy/sample_common/src/sample_utils.cpp
|
||||
@@ -284,7 +284,7 @@ mfxStatus CSmplYUVReader::LoadNextFrame(mfxFrameSurface1* pSurface) {
|
||||
MFX_FOURCC_P010 == pInfo.FourCC || MFX_FOURCC_P210 == pInfo.FourCC ||
|
||||
MFX_FOURCC_P016 == pInfo.FourCC || MFX_FOURCC_I010 == pInfo.FourCC ||
|
||||
MFX_FOURCC_P016 == pInfo.FourCC || MFX_FOURCC_I010 == pInfo.FourCC ||
|
||||
- MFX_FOURCC_I420 == pInfo.FourCC) {
|
||||
+ MFX_FOURCC_I420 == pInfo.FourCC || MFX_FOURCC_YUV400 == pInfo.FourCC) {
|
||||
pitch = pData.Pitch;
|
||||
ptr = pData.Y + pInfo.CropX + pInfo.CropY * pData.Pitch;
|
||||
|
||||
diff --git a/tools/legacy/sample_common/src/vaapi_allocator.cpp b/tools/legacy/sample_common/src/vaapi_allocator.cpp
|
||||
index db18e23..8ee2408 100644
|
||||
--- a/tools/legacy/sample_common/src/vaapi_allocator.cpp
|
||||
+++ b/tools/legacy/sample_common/src/vaapi_allocator.cpp
|
||||
@@ -54,6 +54,8 @@ unsigned int ConvertMfxFourccToVAFormat(mfxU32 fourcc) {
|
||||
return VA_FOURCC_Y216;
|
||||
case MFX_FOURCC_Y416:
|
||||
return VA_FOURCC_Y416;
|
||||
+ case MFX_FOURCC_YUV400:
|
||||
+ return VA_FOURCC_Y800;
|
||||
|
||||
default:
|
||||
assert(!"unsupported fourcc");
|
||||
@@ -133,7 +135,8 @@ static mfxStatus GetVAFourcc(mfxU32 fourcc, unsigned int& va_fourcc) {
|
||||
(VA_FOURCC_Y210 != va_fourcc) && (VA_FOURCC_Y410 != va_fourcc) &&
|
||||
(VA_FOURCC_RGB565 != va_fourcc) && (VA_FOURCC_RGBP != va_fourcc) &&
|
||||
(VA_FOURCC_P016 != va_fourcc) && (VA_FOURCC_Y216 != va_fourcc) &&
|
||||
- (VA_FOURCC_Y416 != va_fourcc) && (VA_FOURCC_AYUV != va_fourcc))) {
|
||||
+ (VA_FOURCC_Y416 != va_fourcc) && (VA_FOURCC_AYUV != va_fourcc) &&
|
||||
+ (VA_FOURCC_Y800 != va_fourcc))) {
|
||||
return MFX_ERR_MEMORY_ALLOC;
|
||||
}
|
||||
|
||||
@@ -281,6 +284,9 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest* request,
|
||||
else if (fourcc == MFX_FOURCC_RGBP) {
|
||||
format = VA_RT_FORMAT_RGBP;
|
||||
}
|
||||
+ else if (fourcc == MFX_FOURCC_YUV400) {
|
||||
+ format = VA_RT_FORMAT_YUV400;
|
||||
+ }
|
||||
|
||||
va_res = m_libva->vaCreateSurfaces(m_dpy,
|
||||
format,
|
||||
@@ -486,6 +492,11 @@ mfxStatus vaapiFrameAllocator::LockFrame(mfxMemId mid, mfxFrameData* ptr) {
|
||||
}
|
||||
if (MFX_ERR_NONE == mfx_res) {
|
||||
switch (vaapi_mid->m_image.format.fourcc) {
|
||||
+ case MFX_FOURCC_YUV400:
|
||||
+ if (mfx_fourcc != vaapi_mid->m_image.format.fourcc)
|
||||
+ return MFX_ERR_LOCK_MEMORY;
|
||||
+ { ptr->Y = pBuffer + vaapi_mid->m_image.offsets[0]; }
|
||||
+ break;
|
||||
case VA_FOURCC_NV12:
|
||||
if (mfx_fourcc != vaapi_mid->m_image.format.fourcc)
|
||||
return MFX_ERR_LOCK_MEMORY;
|
||||
diff --git a/tools/legacy/sample_encode/src/pipeline_encode.cpp b/tools/legacy/sample_encode/src/pipeline_encode.cpp
|
||||
index 4476c49..cda607b 100644
|
||||
--- a/tools/legacy/sample_encode/src/pipeline_encode.cpp
|
||||
+++ b/tools/legacy/sample_encode/src/pipeline_encode.cpp
|
||||
@@ -50,6 +50,7 @@ msdk_tick time_get_frequency(void) {
|
||||
|
||||
mfxU16 FourCcBitDepth(mfxU32 fourCC) {
|
||||
switch (fourCC) {
|
||||
+ case MFX_FOURCC_YUV400:
|
||||
case MFX_FOURCC_NV12:
|
||||
case MFX_FOURCC_NV16:
|
||||
case MFX_FOURCC_YUY2:
|
||||
@@ -845,8 +846,8 @@ mfxStatus CEncodingPipeline::CheckHyperEncodeParams(mfxHyperMode hyperMode) {
|
||||
#endif
|
||||
|
||||
mfxU32 CEncodingPipeline::FileFourCC2EncFourCC(mfxU32 fcc) {
|
||||
- // File reader automatically converts I420, YV12, and YUV400 to NV12
|
||||
- if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12 || fcc == MFX_FOURCC_YUV400)
|
||||
+ // File reader automatically converts I420 and YV12 to NV12
|
||||
+ if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12)
|
||||
return MFX_FOURCC_NV12;
|
||||
else
|
||||
return fcc;
|
||||
@@ -1054,6 +1055,7 @@ mfxStatus CEncodingPipeline::AllocFrames() {
|
||||
|
||||
// prepare allocation requests
|
||||
EncRequest.NumFrameSuggested = EncRequest.NumFrameMin = nEncSurfNum;
|
||||
+
|
||||
MSDK_MEMCPY_VAR(EncRequest.Info, &(m_mfxEncParams.mfx.FrameInfo), sizeof(mfxFrameInfo));
|
||||
if (m_pmfxVPP) {
|
||||
EncRequest.Type |=
|
||||
@@ -1650,15 +1652,11 @@ mfxStatus CEncodingPipeline::Init(sInputParams* pParams) {
|
||||
|
||||
// FileReader can convert yv12->nv12 without vpp, when hw impl
|
||||
if (pParams->bUseHWLib) {
|
||||
- m_InputFourCC = ((pParams->FileInputFourCC == MFX_FOURCC_I420) ||
|
||||
- (pParams->FileInputFourCC == MFX_FOURCC_YUV400))
|
||||
- ? MFX_FOURCC_NV12
|
||||
- : pParams->FileInputFourCC;
|
||||
-
|
||||
- pParams->EncodeFourCC = ((pParams->EncodeFourCC == MFX_FOURCC_I420) ||
|
||||
- (pParams->EncodeFourCC == MFX_FOURCC_YUV400))
|
||||
- ? MFX_FOURCC_NV12
|
||||
- : pParams->EncodeFourCC;
|
||||
+ m_InputFourCC = (pParams->FileInputFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12
|
||||
+ : pParams->FileInputFourCC;
|
||||
+
|
||||
+ pParams->EncodeFourCC =
|
||||
+ (pParams->EncodeFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12 : pParams->EncodeFourCC;
|
||||
}
|
||||
else {
|
||||
m_InputFourCC = pParams->FileInputFourCC;
|
||||
diff --git a/tools/legacy/sample_encode/src/sample_encode.cpp b/tools/legacy/sample_encode/src/sample_encode.cpp
|
||||
index 0a65016..7c722ea 100644
|
||||
--- a/tools/legacy/sample_encode/src/sample_encode.cpp
|
||||
+++ b/tools/legacy/sample_encode/src/sample_encode.cpp
|
||||
@@ -94,10 +94,8 @@ void PrintHelp(char* strAppName, const char* strErrorMessage, ...) {
|
||||
#endif
|
||||
printf(
|
||||
" [-nv12|nv16|yuy2|uyvy|ayuv|rgb4|bgr4|p010|y210|y410|a2rgb10|p016|p210|y216|i010|i420] - input color format (by default YUV420 is expected).\n");
|
||||
-#if (defined(_WIN64) || defined(_WIN32))
|
||||
printf(
|
||||
" [-yuv400] - input color format is YUV400 (grayscale) and will be converted to NV12 for encoding (JPEG only).\n");
|
||||
-#endif
|
||||
printf(
|
||||
" [-msb10] - 10-bit color format is expected to have data in Most Significant Bits of words.\n (LSB data placement is expected by default).\n This option also disables data shifting during file reading.\n");
|
||||
printf(
|
||||
@@ -924,11 +922,9 @@ mfxStatus ParseInputString(char* strInput[], mfxU32 nArgNum, sInputParams* pPara
|
||||
else if (msdk_match(strInput[i], "-y410")) {
|
||||
pParams->FileInputFourCC = MFX_FOURCC_Y410;
|
||||
}
|
||||
-#if (defined(_WIN64) || defined(_WIN32))
|
||||
else if (msdk_match(strInput[i], "-yuv400")) {
|
||||
pParams->FileInputFourCC = MFX_FOURCC_YUV400;
|
||||
}
|
||||
-#endif
|
||||
else if (msdk_match(strInput[i], "-ec::p010")) {
|
||||
pParams->EncodeFourCC = MFX_FOURCC_P010;
|
||||
}
|
||||
--
|
||||
2.43.2
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
From a876f3bd8d31ae47e4f8148ec89edef1eb5dee5f Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
|
||||
Date: Wed, 12 Jun 2024 10:58:13 +0800
|
||||
Subject: [PATCH 3/9] Enable YUV400 JPEG Enc for linux vaapi only
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/ef82b8a608999e56a2449937d1fa4cbee274d9ab]
|
||||
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
|
||||
---
|
||||
.../sample_encode/src/pipeline_encode.cpp | 28 +++++++++++++++----
|
||||
.../sample_encode/src/sample_encode.cpp | 2 +-
|
||||
2 files changed, 23 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_encode/src/pipeline_encode.cpp b/tools/legacy/sample_encode/src/pipeline_encode.cpp
|
||||
index cda607b..b29dc29 100644
|
||||
--- a/tools/legacy/sample_encode/src/pipeline_encode.cpp
|
||||
+++ b/tools/legacy/sample_encode/src/pipeline_encode.cpp
|
||||
@@ -846,9 +846,15 @@ mfxStatus CEncodingPipeline::CheckHyperEncodeParams(mfxHyperMode hyperMode) {
|
||||
#endif
|
||||
|
||||
mfxU32 CEncodingPipeline::FileFourCC2EncFourCC(mfxU32 fcc) {
|
||||
- // File reader automatically converts I420 and YV12 to NV12
|
||||
- if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12)
|
||||
+ // File reader automatically converts I420, YV12 to NV12
|
||||
+ // On windows, YUV400 is automatically converts to NV12.
|
||||
+ if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12
|
||||
+#if (defined(_WIN64) || defined(_WIN32))
|
||||
+ || fcc == MFX_FOURCC_YUV400
|
||||
+#endif
|
||||
+ ) {
|
||||
return MFX_FOURCC_NV12;
|
||||
+ }
|
||||
else
|
||||
return fcc;
|
||||
}
|
||||
@@ -1652,11 +1658,21 @@ mfxStatus CEncodingPipeline::Init(sInputParams* pParams) {
|
||||
|
||||
// FileReader can convert yv12->nv12 without vpp, when hw impl
|
||||
if (pParams->bUseHWLib) {
|
||||
- m_InputFourCC = (pParams->FileInputFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12
|
||||
- : pParams->FileInputFourCC;
|
||||
+ m_InputFourCC = ((pParams->FileInputFourCC == MFX_FOURCC_I420)
|
||||
+#if (defined(_WIN64) || defined(_WIN32))
|
||||
+ || (pParams->FileInputFourCC == MFX_FOURCC_YUV400)
|
||||
+#endif
|
||||
+ )
|
||||
+ ? MFX_FOURCC_NV12
|
||||
+ : pParams->FileInputFourCC;
|
||||
|
||||
- pParams->EncodeFourCC =
|
||||
- (pParams->EncodeFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12 : pParams->EncodeFourCC;
|
||||
+ pParams->EncodeFourCC = ((pParams->EncodeFourCC == MFX_FOURCC_I420)
|
||||
+#if (defined(_WIN64) || defined(_WIN32))
|
||||
+ || (pParams->EncodeFourCC == MFX_FOURCC_YUV400)
|
||||
+#endif
|
||||
+ )
|
||||
+ ? MFX_FOURCC_NV12
|
||||
+ : pParams->EncodeFourCC;
|
||||
}
|
||||
else {
|
||||
m_InputFourCC = pParams->FileInputFourCC;
|
||||
diff --git a/tools/legacy/sample_encode/src/sample_encode.cpp b/tools/legacy/sample_encode/src/sample_encode.cpp
|
||||
index 7c722ea..ed142f5 100644
|
||||
--- a/tools/legacy/sample_encode/src/sample_encode.cpp
|
||||
+++ b/tools/legacy/sample_encode/src/sample_encode.cpp
|
||||
@@ -95,7 +95,7 @@ void PrintHelp(char* strAppName, const char* strErrorMessage, ...) {
|
||||
printf(
|
||||
" [-nv12|nv16|yuy2|uyvy|ayuv|rgb4|bgr4|p010|y210|y410|a2rgb10|p016|p210|y216|i010|i420] - input color format (by default YUV420 is expected).\n");
|
||||
printf(
|
||||
- " [-yuv400] - input color format is YUV400 (grayscale) and will be converted to NV12 for encoding (JPEG only).\n");
|
||||
+ " [-yuv400] - input color format is YUV400 (grayscale) and will be converted to NV12 for encoding (JPEG Windows only).\n");
|
||||
printf(
|
||||
" [-msb10] - 10-bit color format is expected to have data in Most Significant Bits of words.\n (LSB data placement is expected by default).\n This option also disables data shifting during file reading.\n");
|
||||
printf(
|
||||
--
|
||||
2.43.2
|
||||
|
294
recipes-multimedia/vpl/files/0004-Fix-rDRM-DMA-methods.patch
Normal file
294
recipes-multimedia/vpl/files/0004-Fix-rDRM-DMA-methods.patch
Normal file
|
@ -0,0 +1,294 @@
|
|||
From 61f75283da56105adca1d3034422ddac2bc88c18 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
|
||||
Date: Wed, 19 Jun 2024 21:08:14 +0800
|
||||
Subject: [PATCH 4/9] Fix rDRM DMA methods
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/0c12ef0fed3d2e8c8f017e6fa5bf74e55ec51412]
|
||||
|
||||
The commits also remove out libDRM intel bufmgr (i915) dependency
|
||||
where XE does not have the equivalent API. Tested i915 for both
|
||||
DRM_PRIME and KERNEL_DRM, both methods could work correctly.
|
||||
|
||||
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
|
||||
---
|
||||
.../sample_common/include/vaapi_utils.h | 2 +
|
||||
.../sample_common/include/vaapi_utils_drm.h | 2 +
|
||||
.../legacy/sample_common/src/vaapi_utils.cpp | 3 +-
|
||||
.../sample_common/src/vaapi_utils_drm.cpp | 159 ++++++++++--------
|
||||
4 files changed, 93 insertions(+), 73 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_common/include/vaapi_utils.h b/tools/legacy/sample_common/include/vaapi_utils.h
|
||||
index a3a8544..868dd0e 100644
|
||||
--- a/tools/legacy/sample_common/include/vaapi_utils.h
|
||||
+++ b/tools/legacy/sample_common/include/vaapi_utils.h
|
||||
@@ -281,6 +281,7 @@ public:
|
||||
typedef drm_intel_bufmgr* (*drm_intel_bufmgr_gem_init_type)(int fd, int batch_size);
|
||||
typedef int (*drm_intel_bo_gem_export_to_prime_type)(drm_intel_bo*, int*);
|
||||
typedef void (*drm_intel_bufmgr_destroy_type)(drm_intel_bufmgr*);
|
||||
+ typedef int (*drmPrimeFDToHandle_type)(int fd, int prime_fd, uint32_t* handle);
|
||||
|
||||
DrmIntel_Proxy();
|
||||
~DrmIntel_Proxy();
|
||||
@@ -290,6 +291,7 @@ public:
|
||||
__DECLARE(drm_intel_bo_unreference);
|
||||
__DECLARE(drm_intel_bufmgr_gem_init);
|
||||
__DECLARE(drm_intel_bufmgr_destroy);
|
||||
+ __DECLARE(drmPrimeFDToHandle);
|
||||
#if defined(X11_DRI3_SUPPORT)
|
||||
__DECLARE(drm_intel_bo_gem_export_to_prime);
|
||||
#endif
|
||||
diff --git a/tools/legacy/sample_common/include/vaapi_utils_drm.h b/tools/legacy/sample_common/include/vaapi_utils_drm.h
|
||||
index 78109aa..1ba6ea8 100644
|
||||
--- a/tools/legacy/sample_common/include/vaapi_utils_drm.h
|
||||
+++ b/tools/legacy/sample_common/include/vaapi_utils_drm.h
|
||||
@@ -130,6 +130,8 @@ private:
|
||||
mfxExtContentLightLevelInfo* contentLight,
|
||||
bool enableHDR);
|
||||
|
||||
+ uint32_t convertVaFourccToDrmFormat(uint32_t vaFourcc);
|
||||
+
|
||||
const MfxLoader::DRM_Proxy m_drmlib;
|
||||
const MfxLoader::DrmIntel_Proxy m_drmintellib;
|
||||
|
||||
diff --git a/tools/legacy/sample_common/src/vaapi_utils.cpp b/tools/legacy/sample_common/src/vaapi_utils.cpp
|
||||
index f01b07f..48a51b0 100644
|
||||
--- a/tools/legacy/sample_common/src/vaapi_utils.cpp
|
||||
+++ b/tools/legacy/sample_common/src/vaapi_utils.cpp
|
||||
@@ -136,7 +136,8 @@ DrmIntel_Proxy::DrmIntel_Proxy()
|
||||
SIMPLE_LOADER_FUNCTION(drm_intel_bo_gem_create_from_prime),
|
||||
SIMPLE_LOADER_FUNCTION(drm_intel_bo_unreference),
|
||||
SIMPLE_LOADER_FUNCTION(drm_intel_bufmgr_gem_init),
|
||||
- SIMPLE_LOADER_FUNCTION(drm_intel_bufmgr_destroy)
|
||||
+ SIMPLE_LOADER_FUNCTION(drm_intel_bufmgr_destroy),
|
||||
+ SIMPLE_LOADER_FUNCTION(drmPrimeFDToHandle)
|
||||
#if defined(X11_DRI3_SUPPORT)
|
||||
,
|
||||
SIMPLE_LOADER_FUNCTION(drm_intel_bo_gem_export_to_prime)
|
||||
diff --git a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
|
||||
index 7227588..44bc693 100644
|
||||
--- a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
|
||||
+++ b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include <drm_fourcc.h>
|
||||
+ #include <xf86drm.h>
|
||||
#include "i915_drm.h"
|
||||
#include "vaapi_utils_drm.h"
|
||||
|
||||
@@ -211,7 +212,6 @@ drmRenderer::drmRenderer(int fd, mfxI32 monitorType)
|
||||
m_crtc(),
|
||||
m_connectorProperties(),
|
||||
m_crtcProperties(),
|
||||
- m_bufmgr(NULL),
|
||||
m_overlay_wrn(true),
|
||||
m_bSentHDR(false),
|
||||
m_bHdrSupport(false),
|
||||
@@ -257,11 +257,6 @@ drmRenderer::~drmRenderer() {
|
||||
m_drmlib.drmModeFreeCrtc(m_crtc);
|
||||
m_drmlib.drmModeFreeObjectProperties(m_connectorProperties);
|
||||
m_drmlib.drmModeFreeObjectProperties(m_crtcProperties);
|
||||
-
|
||||
- if (m_bufmgr) {
|
||||
- m_drmintellib.drm_intel_bufmgr_destroy(m_bufmgr);
|
||||
- m_bufmgr = NULL;
|
||||
- }
|
||||
}
|
||||
|
||||
drmModeObjectPropertiesPtr drmRenderer::getProperties(int fd, int objectId, int32_t objectTypeId) {
|
||||
@@ -752,36 +747,75 @@ int drmRenderer::drmSendHdrMetaData(mfxExtMasteringDisplayColourVolume* displayC
|
||||
return 0;
|
||||
}
|
||||
|
||||
+uint32_t drmRenderer::convertVaFourccToDrmFormat(uint32_t vaFourcc) {
|
||||
+ switch (vaFourcc) {
|
||||
+ case VA_FOURCC_ARGB:
|
||||
+ return DRM_FORMAT_ARGB8888;
|
||||
+ case VA_FOURCC_NV12:
|
||||
+ return DRM_FORMAT_NV12;
|
||||
+ #if defined(DRM_LINUX_P010_SUPPORT)
|
||||
+ case VA_FOURCC_P010:
|
||||
+ return DRM_FORMAT_P010;
|
||||
+ #endif
|
||||
+
|
||||
+ default:
|
||||
+ printf("unsupported fourcc\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void* drmRenderer::acquire(mfxMemId mid) {
|
||||
- vaapiMemId* vmid = (vaapiMemId*)mid;
|
||||
+ vaapiMemId* vmid = (vaapiMemId*)mid;
|
||||
+
|
||||
uint32_t fbhandle = 0;
|
||||
+ uint32_t handles[4], pitches[4], offsets[4], flags = 0;
|
||||
+ uint64_t modifiers[4];
|
||||
+ int ret;
|
||||
+
|
||||
+ MSDK_ZERO_MEMORY(handles);
|
||||
+ MSDK_ZERO_MEMORY(pitches);
|
||||
+ MSDK_ZERO_MEMORY(offsets);
|
||||
+ MSDK_ZERO_MEMORY(modifiers);
|
||||
|
||||
if (vmid->m_buffer_info.mem_type == VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME) {
|
||||
- if (!m_bufmgr) {
|
||||
- m_bufmgr = m_drmintellib.drm_intel_bufmgr_gem_init(m_fd, 4096);
|
||||
- if (!m_bufmgr)
|
||||
- return NULL;
|
||||
- }
|
||||
+ uint32_t bo_handle;
|
||||
|
||||
- drm_intel_bo* bo =
|
||||
- m_drmintellib.drm_intel_bo_gem_create_from_prime(m_bufmgr,
|
||||
- (int)vmid->m_buffer_info.handle,
|
||||
- vmid->m_buffer_info.mem_size);
|
||||
- if (!bo)
|
||||
+ ret = m_drmintellib.drmPrimeFDToHandle(m_fd, (int)vmid->m_buffer_info.handle, &bo_handle);
|
||||
+ if (ret)
|
||||
return NULL;
|
||||
|
||||
- int ret = m_drmlib.drmModeAddFB(m_fd,
|
||||
- vmid->m_image.width,
|
||||
- vmid->m_image.height,
|
||||
- 24,
|
||||
- 32,
|
||||
- vmid->m_image.pitches[0],
|
||||
- bo->handle,
|
||||
- &fbhandle);
|
||||
- if (ret) {
|
||||
- return NULL;
|
||||
+ for (uint32_t i = 0; i < vmid->m_image.num_planes; i++) {
|
||||
+ pitches[i] = vmid->m_image.pitches[i];
|
||||
+ offsets[i] = vmid->m_image.offsets[i];
|
||||
+ handles[i] = bo_handle;
|
||||
+
|
||||
+ if (VA_FOURCC_NV12 == vmid->m_fourcc
|
||||
+ #if defined(DRM_LINUX_P010_SUPPORT)
|
||||
+ || VA_FOURCC_P010 == vmid->m_fourcc
|
||||
+ #endif
|
||||
+ ) {
|
||||
+ flags = DRM_MODE_FB_MODIFIERS;
|
||||
+ modifiers[i] = I915_FORMAT_MOD_Y_TILED;
|
||||
+ if (m_bRequiredTiled4) {
|
||||
+ #if defined(DRM_LINUX_MODIFIER_TILED4_SUPPORT)
|
||||
+ modifiers[i] = I915_FORMAT_MOD_4_TILED;
|
||||
+ #endif
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- m_drmintellib.drm_intel_bo_unreference(bo);
|
||||
+
|
||||
+ ret = m_drmlib.drmModeAddFB2WithModifiers(m_fd,
|
||||
+ vmid->m_image.width,
|
||||
+ vmid->m_image.height,
|
||||
+ convertVaFourccToDrmFormat(vmid->m_fourcc),
|
||||
+ handles,
|
||||
+ pitches,
|
||||
+ offsets,
|
||||
+ modifiers,
|
||||
+ &fbhandle,
|
||||
+ flags);
|
||||
+ if (ret)
|
||||
+ return NULL;
|
||||
}
|
||||
else if (vmid->m_buffer_info.mem_type == VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM) {
|
||||
struct drm_gem_open flink_open;
|
||||
@@ -793,62 +827,42 @@ void* drmRenderer::acquire(mfxMemId mid) {
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
- uint32_t handles[4], pitches[4], offsets[4], pixel_format, flags = 0;
|
||||
- uint64_t modifiers[4];
|
||||
-
|
||||
- memset(&handles, 0, sizeof(handles));
|
||||
- memset(&pitches, 0, sizeof(pitches));
|
||||
- memset(&offsets, 0, sizeof(offsets));
|
||||
- memset(&modifiers, 0, sizeof(modifiers));
|
||||
-
|
||||
- handles[0] = flink_open.handle;
|
||||
- pitches[0] = vmid->m_image.pitches[0];
|
||||
- offsets[0] = vmid->m_image.offsets[0];
|
||||
+ for (uint32_t i = 0; i < vmid->m_image.num_planes; i++) {
|
||||
+ pitches[i] = vmid->m_image.pitches[i];
|
||||
+ offsets[i] = vmid->m_image.offsets[i];
|
||||
+ handles[i] = flink_open.handle;
|
||||
|
||||
- if (VA_FOURCC_NV12 == vmid->m_fourcc
|
||||
+ if (VA_FOURCC_NV12 == vmid->m_fourcc
|
||||
#if defined(DRM_LINUX_P010_SUPPORT)
|
||||
- || VA_FOURCC_P010 == vmid->m_fourcc
|
||||
+ || VA_FOURCC_P010 == vmid->m_fourcc
|
||||
#endif
|
||||
- ) {
|
||||
- pixel_format = DRM_FORMAT_NV12;
|
||||
- #if defined(DRM_LINUX_P010_SUPPORT)
|
||||
- if (VA_FOURCC_P010 == vmid->m_fourcc)
|
||||
- pixel_format = DRM_FORMAT_P010;
|
||||
- #endif
|
||||
- handles[1] = flink_open.handle;
|
||||
- pitches[1] = vmid->m_image.pitches[1];
|
||||
- offsets[1] = vmid->m_image.offsets[1];
|
||||
- modifiers[0] = modifiers[1] = I915_FORMAT_MOD_Y_TILED;
|
||||
- flags = DRM_MODE_FB_MODIFIERS;
|
||||
-
|
||||
- if (m_bRequiredTiled4) {
|
||||
+ ) {
|
||||
+ flags = DRM_MODE_FB_MODIFIERS;
|
||||
+ modifiers[i] = I915_FORMAT_MOD_Y_TILED;
|
||||
+ if (m_bRequiredTiled4) {
|
||||
#if defined(DRM_LINUX_MODIFIER_TILED4_SUPPORT)
|
||||
- modifiers[0] = modifiers[1] = I915_FORMAT_MOD_4_TILED;
|
||||
+ modifiers[i] = I915_FORMAT_MOD_4_TILED;
|
||||
#endif
|
||||
- }
|
||||
- else {
|
||||
- modifiers[0] = modifiers[1] = I915_FORMAT_MOD_Y_TILED;
|
||||
-
|
||||
- struct drm_i915_gem_set_tiling set_tiling;
|
||||
- memset(&set_tiling, 0, sizeof(set_tiling));
|
||||
- set_tiling.handle = flink_open.handle;
|
||||
- set_tiling.tiling_mode = I915_TILING_Y;
|
||||
- set_tiling.stride = vmid->m_image.pitches[0];
|
||||
- ret = m_drmlib.drmIoctl(m_fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling);
|
||||
- if (ret) {
|
||||
- printf("DRM_IOCTL_I915_GEM_SET_TILING Failed ret = %d\n", ret);
|
||||
- return NULL;
|
||||
+ }
|
||||
+ else {
|
||||
+ struct drm_i915_gem_set_tiling set_tiling;
|
||||
+ memset(&set_tiling, 0, sizeof(set_tiling));
|
||||
+ set_tiling.handle = flink_open.handle;
|
||||
+ set_tiling.tiling_mode = I915_TILING_Y;
|
||||
+ set_tiling.stride = vmid->m_image.pitches[0];
|
||||
+ ret = m_drmlib.drmIoctl(m_fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling);
|
||||
+ if (ret) {
|
||||
+ printf("DRM_IOCTL_I915_GEM_SET_TILING Failed ret = %d\n", ret);
|
||||
+ return NULL;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
- else {
|
||||
- pixel_format = DRM_FORMAT_XRGB8888;
|
||||
- }
|
||||
|
||||
ret = m_drmlib.drmModeAddFB2WithModifiers(m_fd,
|
||||
vmid->m_image.width,
|
||||
vmid->m_image.height,
|
||||
- pixel_format,
|
||||
+ convertVaFourccToDrmFormat(vmid->m_fourcc),
|
||||
handles,
|
||||
pitches,
|
||||
offsets,
|
||||
@@ -905,6 +919,7 @@ mfxStatus drmRenderer::render(mfxFrameSurface1* pSurface) {
|
||||
if (!setMaster()) {
|
||||
return MFX_ERR_UNKNOWN;
|
||||
}
|
||||
+
|
||||
if ((m_mode.hdisplay == memid->m_image.width) && (m_mode.vdisplay == memid->m_image.height)) {
|
||||
// surface in the framebuffer exactly matches crtc scanout port, so we
|
||||
// can scanout from this framebuffer for the whole crtc
|
||||
--
|
||||
2.43.2
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
From 286804cc4a9646e23b833fa2b308a8e69a3e56f9 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com>
|
||||
Date: Wed, 19 Jun 2024 21:08:41 +0800
|
||||
Subject: [PATCH 5/9] Force allocator to use DRM_PRIME for rDRM
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/3c81381edb5a591f45c92fac60a23eba081b21b1]
|
||||
|
||||
XE deprecated DRM GEM Flink API. Use DRM_PRIME method instead for
|
||||
rDRM case.
|
||||
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
|
||||
---
|
||||
tools/legacy/sample_decode/src/pipeline_decode.cpp | 2 +-
|
||||
.../sample_multi_transcode/src/sample_multi_transcode.cpp | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_decode/src/pipeline_decode.cpp b/tools/legacy/sample_decode/src/pipeline_decode.cpp
|
||||
index 83fb895..51b7d69 100644
|
||||
--- a/tools/legacy/sample_decode/src/pipeline_decode.cpp
|
||||
+++ b/tools/legacy/sample_decode/src/pipeline_decode.cpp
|
||||
@@ -1437,7 +1437,7 @@ mfxStatus CDecodingPipeline::CreateAllocator() {
|
||||
if (m_libvaBackend == MFX_LIBVA_DRM_MODESET) {
|
||||
#if defined(LIBVA_DRM_SUPPORT)
|
||||
CVAAPIDeviceDRM* drmdev = dynamic_cast<CVAAPIDeviceDRM*>(m_hwdev);
|
||||
- p_vaapiAllocParams->m_export_mode = vaapiAllocatorParams::CUSTOM_FLINK;
|
||||
+ p_vaapiAllocParams->m_export_mode = vaapiAllocatorParams::PRIME;
|
||||
p_vaapiAllocParams->m_exporter =
|
||||
dynamic_cast<vaapiAllocatorParams::Exporter*>(drmdev->getRenderer());
|
||||
#endif
|
||||
diff --git a/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp b/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp
|
||||
index ce972c8..6b2c919 100644
|
||||
--- a/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp
|
||||
+++ b/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp
|
||||
@@ -374,7 +374,7 @@ mfxStatus Launcher::Init(int argc, char* argv[]) {
|
||||
#if defined(LIBVA_DRM_SUPPORT)
|
||||
if (params.libvaBackend == MFX_LIBVA_DRM_MODESET) {
|
||||
CVAAPIDeviceDRM* drmdev = dynamic_cast<CVAAPIDeviceDRM*>(hwdev.get());
|
||||
- pVAAPIParams->m_export_mode = vaapiAllocatorParams::CUSTOM_FLINK;
|
||||
+ pVAAPIParams->m_export_mode = vaapiAllocatorParams::PRIME;
|
||||
pVAAPIParams->m_exporter =
|
||||
dynamic_cast<vaapiAllocatorParams::Exporter*>(drmdev->getRenderer());
|
||||
}
|
||||
--
|
||||
2.43.2
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
From 75551817541a3b355eddadf3d5e32da31e5f4a31 Mon Sep 17 00:00:00 2001
|
||||
From: Lim Siew Hoon <siew.hoon.lim@intel.com>
|
||||
Date: Thu, 1 Aug 2024 11:07:42 +0800
|
||||
Subject: [PATCH 6/9] Enable VVC in sample_decode.
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/5f0959abd9271d07c0ad97edd684d7c04d93350c]
|
||||
|
||||
Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com>
|
||||
---
|
||||
tools/legacy/sample_common/src/sample_utils.cpp | 4 ++++
|
||||
tools/legacy/sample_decode/src/sample_decode.cpp | 5 +++--
|
||||
2 files changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_common/src/sample_utils.cpp b/tools/legacy/sample_common/src/sample_utils.cpp
|
||||
index b2b67bf..bd11af7 100644
|
||||
--- a/tools/legacy/sample_common/src/sample_utils.cpp
|
||||
+++ b/tools/legacy/sample_common/src/sample_utils.cpp
|
||||
@@ -2435,6 +2435,7 @@ bool IsDecodeCodecSupported(mfxU32 codecFormat) {
|
||||
case MFX_CODEC_VP8:
|
||||
case MFX_CODEC_VP9:
|
||||
case MFX_CODEC_AV1:
|
||||
+ case MFX_CODEC_VVC:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
@@ -2509,6 +2510,9 @@ mfxStatus StrFormatToCodecFormatFourCC(char* strInput, mfxU32& codecFormat) {
|
||||
else if (msdk_match(strInput, "av1")) {
|
||||
codecFormat = MFX_CODEC_AV1;
|
||||
}
|
||||
+ else if (msdk_match(strInput, "vvc")) {
|
||||
+ codecFormat = MFX_CODEC_VVC;
|
||||
+ }
|
||||
else if ((msdk_match(strInput, "raw"))) {
|
||||
codecFormat = MFX_CODEC_DUMP;
|
||||
}
|
||||
diff --git a/tools/legacy/sample_decode/src/sample_decode.cpp b/tools/legacy/sample_decode/src/sample_decode.cpp
|
||||
index 8ebe4c5..33ab1f5 100644
|
||||
--- a/tools/legacy/sample_decode/src/sample_decode.cpp
|
||||
+++ b/tools/legacy/sample_decode/src/sample_decode.cpp
|
||||
@@ -29,7 +29,7 @@ void PrintHelp(char* strAppName, const char* strErrorMessage) {
|
||||
printf(" or: %s <codecid> [<options>] -i InputBitstream -o OutputYUVFile\n", strAppName);
|
||||
printf("\n");
|
||||
printf("Supported codecs (<codecid>):\n");
|
||||
- printf(" <codecid>=h264|mpeg2|vc1|mvc|jpeg|vp9|av1 - built-in Media SDK codecs\n");
|
||||
+ printf(" <codecid>=h264|mpeg2|vc1|mvc|jpeg|vp9|av1|vvc - built-in Media SDK codecs\n");
|
||||
printf(
|
||||
" <codecid>=h265|vp9|capture - in-box Media SDK plugins (may require separate downloading and installation)\n");
|
||||
printf("\n");
|
||||
@@ -798,7 +798,8 @@ mfxStatus ParseInputString(char* strInput[], mfxU32 nArgNum, sInputParams* pPara
|
||||
if (MFX_CODEC_MPEG2 != pParams->videoType && MFX_CODEC_AVC != pParams->videoType &&
|
||||
MFX_CODEC_HEVC != pParams->videoType && MFX_CODEC_VC1 != pParams->videoType &&
|
||||
MFX_CODEC_JPEG != pParams->videoType && MFX_CODEC_VP8 != pParams->videoType &&
|
||||
- MFX_CODEC_VP9 != pParams->videoType && MFX_CODEC_AV1 != pParams->videoType) {
|
||||
+ MFX_CODEC_VP9 != pParams->videoType && MFX_CODEC_AV1 != pParams->videoType &&
|
||||
+ MFX_CODEC_VVC != pParams->videoType) {
|
||||
PrintHelp(strInput[0], "Unknown codec");
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
--
|
||||
2.43.2
|
||||
|
185
recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch
Normal file
185
recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch
Normal file
|
@ -0,0 +1,185 @@
|
|||
From fecf6b6cdb02c7dba3b838ee710363b57fe8e6e7 Mon Sep 17 00:00:00 2001
|
||||
From: "Hoe, Sheng Yang" <sheng.yang.hoe@intel.com>
|
||||
Date: Fri, 26 Jul 2024 23:35:25 +0800
|
||||
Subject: [PATCH 7/9] Fix X11 rendering for xe
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/2d751730617682133bf066e61e1ca952136309bd]
|
||||
|
||||
Signed-off-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com>
|
||||
---
|
||||
.../sample_common/include/vaapi_device.h | 6 ---
|
||||
.../sample_common/include/vaapi_utils_x11.h | 4 --
|
||||
.../legacy/sample_common/src/vaapi_device.cpp | 50 ++-----------------
|
||||
.../sample_common/src/vaapi_utils_x11.cpp | 4 +-
|
||||
4 files changed, 7 insertions(+), 57 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_common/include/vaapi_device.h b/tools/legacy/sample_common/include/vaapi_device.h
|
||||
index 5752a28..dc71659 100644
|
||||
--- a/tools/legacy/sample_common/include/vaapi_device.h
|
||||
+++ b/tools/legacy/sample_common/include/vaapi_device.h
|
||||
@@ -75,10 +75,7 @@ public:
|
||||
m_nRenderWinH = 0;
|
||||
m_bRenderWin = false;
|
||||
#if defined(X11_DRI3_SUPPORT)
|
||||
- m_dri_fd = 0;
|
||||
- m_bufmgr = NULL;
|
||||
m_xcbconn = NULL;
|
||||
- m_device_path = devicePath;
|
||||
#endif
|
||||
}
|
||||
virtual ~CVAAPIDeviceX11(void);
|
||||
@@ -106,10 +103,7 @@ private:
|
||||
mfxU32 m_nRenderWinW;
|
||||
mfxU32 m_nRenderWinH;
|
||||
#if defined(X11_DRI3_SUPPORT)
|
||||
- int m_dri_fd;
|
||||
- drm_intel_bufmgr* m_bufmgr;
|
||||
xcb_connection_t* m_xcbconn;
|
||||
- std::string m_device_path;
|
||||
#endif
|
||||
// no copies allowed
|
||||
CVAAPIDeviceX11(const CVAAPIDeviceX11&);
|
||||
diff --git a/tools/legacy/sample_common/include/vaapi_utils_x11.h b/tools/legacy/sample_common/include/vaapi_utils_x11.h
|
||||
index acdd78e..840c29d 100644
|
||||
--- a/tools/legacy/sample_common/include/vaapi_utils_x11.h
|
||||
+++ b/tools/legacy/sample_common/include/vaapi_utils_x11.h
|
||||
@@ -40,9 +40,6 @@ public:
|
||||
MfxLoader::Xcbpresent_Proxy& GetXcbpresentX11() {
|
||||
return m_xcbpresentlib;
|
||||
}
|
||||
- MfxLoader::DrmIntel_Proxy& GetDrmIntelX11() {
|
||||
- return m_drmintellib;
|
||||
- }
|
||||
#endif // X11_DRI3_SUPPORT
|
||||
|
||||
protected:
|
||||
@@ -57,7 +54,6 @@ protected:
|
||||
MfxLoader::X11_Xcb_Proxy m_x11xcblib;
|
||||
MfxLoader::XCB_Dri3_Proxy m_xcbdri3lib;
|
||||
MfxLoader::Xcbpresent_Proxy m_xcbpresentlib;
|
||||
- MfxLoader::DrmIntel_Proxy m_drmintellib;
|
||||
#endif // X11_DRI3_SUPPORT
|
||||
int fd;
|
||||
|
||||
diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp
|
||||
index c44e67e..9bf3433 100644
|
||||
--- a/tools/legacy/sample_common/src/vaapi_device.cpp
|
||||
+++ b/tools/legacy/sample_common/src/vaapi_device.cpp
|
||||
@@ -72,39 +72,9 @@ mfxStatus CVAAPIDeviceX11::Init(mfxHDL hWindow, mfxU16 nViews, mfxU32 nAdapterNu
|
||||
}
|
||||
}
|
||||
#if defined(X11_DRI3_SUPPORT)
|
||||
- MfxLoader::DrmIntel_Proxy& drmintellib = m_X11LibVA.GetDrmIntelX11();
|
||||
MfxLoader::X11_Xcb_Proxy& x11xcblib = m_X11LibVA.GetX11XcbX11();
|
||||
|
||||
m_xcbconn = x11xcblib.XGetXCBConnection(VAAPI_GET_X_DISPLAY(m_X11LibVA.GetXDisplay()));
|
||||
-
|
||||
- if (m_device_path.empty()) {
|
||||
- // it's enough to pass render node, because we only request
|
||||
- // information from kernel via m_dri_fd
|
||||
- for (mfxU32 i = 0; i < MFX_DEVICE_MAX_NODES; ++i) {
|
||||
- std::string devPath =
|
||||
- MFX_DEVICE_NODE_RENDER + std::to_string(MFX_DEVICE_NODE_INDEX + i);
|
||||
- m_dri_fd = open_intel_adapter(devPath);
|
||||
- if (m_dri_fd < 0)
|
||||
- continue;
|
||||
- else
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- else {
|
||||
- m_dri_fd = open_intel_adapter(m_device_path);
|
||||
- }
|
||||
-
|
||||
- if (m_dri_fd < 0) {
|
||||
- printf("Failed to open dri device\n");
|
||||
- return MFX_ERR_NOT_INITIALIZED;
|
||||
- }
|
||||
-
|
||||
- m_bufmgr = drmintellib.drm_intel_bufmgr_gem_init(m_dri_fd, 4096);
|
||||
- if (!m_bufmgr) {
|
||||
- printf("Failed to get buffer manager\n");
|
||||
- return MFX_ERR_NOT_INITIALIZED;
|
||||
- }
|
||||
-
|
||||
#endif
|
||||
|
||||
return mfx_res;
|
||||
@@ -121,11 +91,6 @@ void CVAAPIDeviceX11::Close(void) {
|
||||
free(m_window);
|
||||
m_window = NULL;
|
||||
}
|
||||
- #if defined(X11_DRI3_SUPPORT)
|
||||
- if (m_dri_fd) {
|
||||
- close(m_dri_fd);
|
||||
- }
|
||||
- #endif
|
||||
}
|
||||
|
||||
mfxStatus CVAAPIDeviceX11::Reset(void) {
|
||||
@@ -208,13 +173,11 @@ mfxStatus CVAAPIDeviceX11::RenderFrame(mfxFrameSurface1* pSurface,
|
||||
#else //\/ X11_DRI3_SUPPORT
|
||||
Window* window = VAAPI_GET_X_WINDOW(m_window);
|
||||
Window root;
|
||||
- drm_intel_bo* bo = NULL;
|
||||
unsigned int border, depth, stride, size, width, height;
|
||||
int fd = 0, bpp = 0, x, y;
|
||||
|
||||
MfxLoader::Xcb_Proxy& xcblib = m_X11LibVA.GetXcbX11();
|
||||
MfxLoader::XLib_Proxy& x11lib = m_X11LibVA.GetX11();
|
||||
- MfxLoader::DrmIntel_Proxy& drmintellib = m_X11LibVA.GetDrmIntelX11();
|
||||
MfxLoader::Xcbpresent_Proxy& xcbpresentlib = m_X11LibVA.GetXcbpresentX11();
|
||||
MfxLoader::XCB_Dri3_Proxy& dri3lib = m_X11LibVA.GetXCBDri3X11();
|
||||
|
||||
@@ -271,15 +234,7 @@ mfxStatus CVAAPIDeviceX11::RenderFrame(mfxFrameSurface1* pSurface,
|
||||
stride = memId->m_image.pitches[0];
|
||||
size = PAGE_ALIGN(stride * height);
|
||||
|
||||
- bo = drmintellib.drm_intel_bo_gem_create_from_prime(m_bufmgr,
|
||||
- memId->m_buffer_info.handle,
|
||||
- size);
|
||||
- if (!bo) {
|
||||
- printf("Failed to create buffer object\n");
|
||||
- return MFX_ERR_INVALID_VIDEO_PARAM;
|
||||
- }
|
||||
-
|
||||
- drmintellib.drm_intel_bo_gem_export_to_prime(bo, &fd);
|
||||
+ fd = dup(memId->m_buffer_info.handle);
|
||||
if (!fd) {
|
||||
printf("Invalid fd\n");
|
||||
return MFX_ERR_NOT_INITIALIZED;
|
||||
@@ -332,6 +287,9 @@ mfxStatus CVAAPIDeviceX11::RenderFrame(mfxFrameSurface1* pSurface,
|
||||
|
||||
xcblib.xcb_free_pixmap(m_xcbconn, pixmap);
|
||||
xcblib.xcb_flush(m_xcbconn);
|
||||
+
|
||||
+ if (fd)
|
||||
+ close(fd);
|
||||
}
|
||||
|
||||
return mfx_res;
|
||||
diff --git a/tools/legacy/sample_common/src/vaapi_utils_x11.cpp b/tools/legacy/sample_common/src/vaapi_utils_x11.cpp
|
||||
index ec44752..1e76615 100644
|
||||
--- a/tools/legacy/sample_common/src/vaapi_utils_x11.cpp
|
||||
+++ b/tools/legacy/sample_common/src/vaapi_utils_x11.cpp
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
const char* MFX_X11_NODE_RENDER = "/dev/dri/renderD";
|
||||
const char* MFX_X11_DRIVER_NAME = "i915";
|
||||
+const char* MFX_X11_DRIVER_XE_NAME = "xe";
|
||||
constexpr mfxU32 MFX_X11_DRIVER_NAME_LEN = 4;
|
||||
constexpr mfxU32 MFX_X11_NODE_INDEX = 128;
|
||||
constexpr mfxU32 MFX_X11_MAX_NODES = 16;
|
||||
@@ -38,7 +39,8 @@ int open_intel_adapter(const std::string& devicePath) {
|
||||
version.name = driverName;
|
||||
|
||||
if (!ioctl(fd, DRM_IOWR(0, drm_version), &version) &&
|
||||
- msdk_match(driverName, MFX_X11_DRIVER_NAME)) {
|
||||
+ (msdk_match(driverName, MFX_X11_DRIVER_NAME) ||
|
||||
+ msdk_match(driverName, MFX_X11_DRIVER_XE_NAME))) {
|
||||
return fd;
|
||||
}
|
||||
|
||||
--
|
||||
2.43.2
|
||||
|
42
recipes-multimedia/vpl/files/0008-Fix-code-formatting.patch
Normal file
42
recipes-multimedia/vpl/files/0008-Fix-code-formatting.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
From bc6561ea9d9a6f182f6cd3dfe390088b187ac954 Mon Sep 17 00:00:00 2001
|
||||
From: "Hoe, Sheng Yang" <sheng.yang.hoe@intel.com>
|
||||
Date: Mon, 29 Jul 2024 10:15:32 +0800
|
||||
Subject: [PATCH 8/9] Fix code formatting
|
||||
|
||||
Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/0f641e7279e8709bda5f507cf5fe3ea2849ed66a]
|
||||
|
||||
Signed-off-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com>
|
||||
---
|
||||
tools/legacy/sample_common/include/vaapi_device.h | 2 +-
|
||||
tools/legacy/sample_common/src/vaapi_device.cpp | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/legacy/sample_common/include/vaapi_device.h b/tools/legacy/sample_common/include/vaapi_device.h
|
||||
index dc71659..6d46c23 100644
|
||||
--- a/tools/legacy/sample_common/include/vaapi_device.h
|
||||
+++ b/tools/legacy/sample_common/include/vaapi_device.h
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
m_nRenderWinH = 0;
|
||||
m_bRenderWin = false;
|
||||
#if defined(X11_DRI3_SUPPORT)
|
||||
- m_xcbconn = NULL;
|
||||
+ m_xcbconn = NULL;
|
||||
#endif
|
||||
}
|
||||
virtual ~CVAAPIDeviceX11(void);
|
||||
diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp
|
||||
index 9bf3433..d4a785f 100644
|
||||
--- a/tools/legacy/sample_common/src/vaapi_device.cpp
|
||||
+++ b/tools/legacy/sample_common/src/vaapi_device.cpp
|
||||
@@ -72,7 +72,7 @@ mfxStatus CVAAPIDeviceX11::Init(mfxHDL hWindow, mfxU16 nViews, mfxU32 nAdapterNu
|
||||
}
|
||||
}
|
||||
#if defined(X11_DRI3_SUPPORT)
|
||||
- MfxLoader::X11_Xcb_Proxy& x11xcblib = m_X11LibVA.GetX11XcbX11();
|
||||
+ MfxLoader::X11_Xcb_Proxy& x11xcblib = m_X11LibVA.GetX11XcbX11();
|
||||
|
||||
m_xcbconn = x11xcblib.XGetXCBConnection(VAAPI_GET_X_DISPLAY(m_X11LibVA.GetXDisplay()));
|
||||
#endif
|
||||
--
|
||||
2.43.2
|
||||
|
|
@ -9,6 +9,14 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c18ea6bb4786a26bf4eee88a7424a408 \
|
|||
file://third-party-programs.txt;md5=ddf05049184e74942f45b0ca4cc69b8a"
|
||||
|
||||
SRC_URI = "git://github.com/intel/libvpl-tools.git;protocol=https;branch=main \
|
||||
file://0001-Correct-va-attrib-for-vaapiallocator.patch \
|
||||
file://0002-Enable-YUV400-JPEG-Enc-for-vaapi.patch \
|
||||
file://0003-Enable-YUV400-JPEG-Enc-for-linux-vaapi-only.patch \
|
||||
file://0004-Fix-rDRM-DMA-methods.patch \
|
||||
file://0005-Force-allocator-to-use-DRM_PRIME-for-rDRM.patch \
|
||||
file://0006-Enable-VVC-in-sample_decode.patch \
|
||||
file://0007-Fix-X11-rendering-for-xe.patch \
|
||||
file://0008-Fix-code-formatting.patch \
|
||||
"
|
||||
|
||||
SRCREV = "452ab253da13b57067222e8311ef143d0203d766"
|
||||
|
|
Loading…
Reference in New Issue
Block a user