diff options
| author | Lim Siew Hoon <siew.hoon.lim@intel.com> | 2024-10-09 16:33:58 +0800 |
|---|---|---|
| committer | Anuj Mittal <anuj.mittal@intel.com> | 2024-10-10 09:15:19 +0800 |
| commit | 945c5bbb80c4c480c563f6ddd5a9e7acd5ad713e (patch) | |
| tree | 2621feb5c8db3e21e77ef32f51ac5572f8dd710c /recipes-multimedia | |
| parent | 3b4ab5676dcfc66d976e634b215fa003a4b38599 (diff) | |
| download | meta-intel-945c5bbb80c4c480c563f6ddd5a9e7acd5ad713e.tar.gz | |
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>
Diffstat (limited to 'recipes-multimedia')
9 files changed, 908 insertions, 0 deletions
diff --git a/recipes-multimedia/vpl/files/0001-Correct-va-attrib-for-vaapiallocator.patch b/recipes-multimedia/vpl/files/0001-Correct-va-attrib-for-vaapiallocator.patch new file mode 100644 index 00000000..7de9f9ae --- /dev/null +++ b/recipes-multimedia/vpl/files/0001-Correct-va-attrib-for-vaapiallocator.patch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | From 7c3332337d030ec98b4ffeeeac50028b0875262f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com> | ||
| 3 | Date: Mon, 13 May 2024 17:07:20 +0800 | ||
| 4 | Subject: [PATCH 1/9] Correct va-attrib for vaapiallocator | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/54d7d459a918cd26deaa91a37d34b13c37779597] | ||
| 7 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 8 | --- | ||
| 9 | tools/legacy/sample_common/src/vaapi_allocator.cpp | 12 +++++++----- | ||
| 10 | 1 file changed, 7 insertions(+), 5 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/tools/legacy/sample_common/src/vaapi_allocator.cpp b/tools/legacy/sample_common/src/vaapi_allocator.cpp | ||
| 13 | index e5a8823..db18e23 100644 | ||
| 14 | --- a/tools/legacy/sample_common/src/vaapi_allocator.cpp | ||
| 15 | +++ b/tools/legacy/sample_common/src/vaapi_allocator.cpp | ||
| 16 | @@ -245,11 +245,11 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest* request, | ||
| 17 | if (VA_FOURCC_P208 != va_fourcc) { | ||
| 18 | unsigned int format; | ||
| 19 | |||
| 20 | - attrib[attrCnt].type = VASurfaceAttribPixelFormat; | ||
| 21 | - attrib[attrCnt].flags = VA_SURFACE_ATTRIB_SETTABLE; | ||
| 22 | - attrib[attrCnt].value.type = VAGenericValueTypeInteger; | ||
| 23 | - attrib[attrCnt].value.value.i = va_fourcc; | ||
| 24 | - format = va_fourcc; | ||
| 25 | + attrib[attrCnt].type = VASurfaceAttribPixelFormat; | ||
| 26 | + attrib[attrCnt].flags = VA_SURFACE_ATTRIB_SETTABLE; | ||
| 27 | + attrib[attrCnt].value.type = VAGenericValueTypeInteger; | ||
| 28 | + attrib[attrCnt++].value.value.i = va_fourcc; | ||
| 29 | + format = va_fourcc; | ||
| 30 | |||
| 31 | if ((fourcc == MFX_FOURCC_VP8_NV12) || | ||
| 32 | ((MFX_MEMTYPE_FROM_ENCODE & request->Type) && (fourcc == MFX_FOURCC_BGR4))) { | ||
| 33 | @@ -257,6 +257,8 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest* request, | ||
| 34 | * RGB32 for JPEG is required | ||
| 35 | */ | ||
| 36 | attrib[attrCnt].type = (VASurfaceAttribType)VASurfaceAttribUsageHint; | ||
| 37 | + attrib[attrCnt].flags = VA_SURFACE_ATTRIB_SETTABLE; | ||
| 38 | + attrib[attrCnt].value.type = VAGenericValueTypeInteger; | ||
| 39 | attrib[attrCnt++].value.value.i = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER; | ||
| 40 | } | ||
| 41 | else if (fourcc == MFX_FOURCC_VP8_MBDATA) { | ||
| 42 | -- | ||
| 43 | 2.43.2 | ||
| 44 | |||
diff --git a/recipes-multimedia/vpl/files/0002-Enable-YUV400-JPEG-Enc-for-vaapi.patch b/recipes-multimedia/vpl/files/0002-Enable-YUV400-JPEG-Enc-for-vaapi.patch new file mode 100644 index 00000000..5529b5e3 --- /dev/null +++ b/recipes-multimedia/vpl/files/0002-Enable-YUV400-JPEG-Enc-for-vaapi.patch | |||
| @@ -0,0 +1,154 @@ | |||
| 1 | From 1a064a36c164080a21f8d89409564c1812dea6af Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com> | ||
| 3 | Date: Wed, 15 May 2024 09:51:53 +0800 | ||
| 4 | Subject: [PATCH 2/9] Enable YUV400 JPEG Enc for vaapi | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/747b66ce97c6ac5d17a8b8629eb22d790d802da3] | ||
| 7 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 8 | --- | ||
| 9 | .../legacy/sample_common/src/sample_utils.cpp | 2 +- | ||
| 10 | .../sample_common/src/vaapi_allocator.cpp | 13 +++++++++++- | ||
| 11 | .../sample_encode/src/pipeline_encode.cpp | 20 +++++++++---------- | ||
| 12 | .../sample_encode/src/sample_encode.cpp | 4 ---- | ||
| 13 | 4 files changed, 22 insertions(+), 17 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/tools/legacy/sample_common/src/sample_utils.cpp b/tools/legacy/sample_common/src/sample_utils.cpp | ||
| 16 | index ddd783f..b2b67bf 100644 | ||
| 17 | --- a/tools/legacy/sample_common/src/sample_utils.cpp | ||
| 18 | +++ b/tools/legacy/sample_common/src/sample_utils.cpp | ||
| 19 | @@ -284,7 +284,7 @@ mfxStatus CSmplYUVReader::LoadNextFrame(mfxFrameSurface1* pSurface) { | ||
| 20 | MFX_FOURCC_P010 == pInfo.FourCC || MFX_FOURCC_P210 == pInfo.FourCC || | ||
| 21 | MFX_FOURCC_P016 == pInfo.FourCC || MFX_FOURCC_I010 == pInfo.FourCC || | ||
| 22 | MFX_FOURCC_P016 == pInfo.FourCC || MFX_FOURCC_I010 == pInfo.FourCC || | ||
| 23 | - MFX_FOURCC_I420 == pInfo.FourCC) { | ||
| 24 | + MFX_FOURCC_I420 == pInfo.FourCC || MFX_FOURCC_YUV400 == pInfo.FourCC) { | ||
| 25 | pitch = pData.Pitch; | ||
| 26 | ptr = pData.Y + pInfo.CropX + pInfo.CropY * pData.Pitch; | ||
| 27 | |||
| 28 | diff --git a/tools/legacy/sample_common/src/vaapi_allocator.cpp b/tools/legacy/sample_common/src/vaapi_allocator.cpp | ||
| 29 | index db18e23..8ee2408 100644 | ||
| 30 | --- a/tools/legacy/sample_common/src/vaapi_allocator.cpp | ||
| 31 | +++ b/tools/legacy/sample_common/src/vaapi_allocator.cpp | ||
| 32 | @@ -54,6 +54,8 @@ unsigned int ConvertMfxFourccToVAFormat(mfxU32 fourcc) { | ||
| 33 | return VA_FOURCC_Y216; | ||
| 34 | case MFX_FOURCC_Y416: | ||
| 35 | return VA_FOURCC_Y416; | ||
| 36 | + case MFX_FOURCC_YUV400: | ||
| 37 | + return VA_FOURCC_Y800; | ||
| 38 | |||
| 39 | default: | ||
| 40 | assert(!"unsupported fourcc"); | ||
| 41 | @@ -133,7 +135,8 @@ static mfxStatus GetVAFourcc(mfxU32 fourcc, unsigned int& va_fourcc) { | ||
| 42 | (VA_FOURCC_Y210 != va_fourcc) && (VA_FOURCC_Y410 != va_fourcc) && | ||
| 43 | (VA_FOURCC_RGB565 != va_fourcc) && (VA_FOURCC_RGBP != va_fourcc) && | ||
| 44 | (VA_FOURCC_P016 != va_fourcc) && (VA_FOURCC_Y216 != va_fourcc) && | ||
| 45 | - (VA_FOURCC_Y416 != va_fourcc) && (VA_FOURCC_AYUV != va_fourcc))) { | ||
| 46 | + (VA_FOURCC_Y416 != va_fourcc) && (VA_FOURCC_AYUV != va_fourcc) && | ||
| 47 | + (VA_FOURCC_Y800 != va_fourcc))) { | ||
| 48 | return MFX_ERR_MEMORY_ALLOC; | ||
| 49 | } | ||
| 50 | |||
| 51 | @@ -281,6 +284,9 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest* request, | ||
| 52 | else if (fourcc == MFX_FOURCC_RGBP) { | ||
| 53 | format = VA_RT_FORMAT_RGBP; | ||
| 54 | } | ||
| 55 | + else if (fourcc == MFX_FOURCC_YUV400) { | ||
| 56 | + format = VA_RT_FORMAT_YUV400; | ||
| 57 | + } | ||
| 58 | |||
| 59 | va_res = m_libva->vaCreateSurfaces(m_dpy, | ||
| 60 | format, | ||
| 61 | @@ -486,6 +492,11 @@ mfxStatus vaapiFrameAllocator::LockFrame(mfxMemId mid, mfxFrameData* ptr) { | ||
| 62 | } | ||
| 63 | if (MFX_ERR_NONE == mfx_res) { | ||
| 64 | switch (vaapi_mid->m_image.format.fourcc) { | ||
| 65 | + case MFX_FOURCC_YUV400: | ||
| 66 | + if (mfx_fourcc != vaapi_mid->m_image.format.fourcc) | ||
| 67 | + return MFX_ERR_LOCK_MEMORY; | ||
| 68 | + { ptr->Y = pBuffer + vaapi_mid->m_image.offsets[0]; } | ||
| 69 | + break; | ||
| 70 | case VA_FOURCC_NV12: | ||
| 71 | if (mfx_fourcc != vaapi_mid->m_image.format.fourcc) | ||
| 72 | return MFX_ERR_LOCK_MEMORY; | ||
| 73 | diff --git a/tools/legacy/sample_encode/src/pipeline_encode.cpp b/tools/legacy/sample_encode/src/pipeline_encode.cpp | ||
| 74 | index 4476c49..cda607b 100644 | ||
| 75 | --- a/tools/legacy/sample_encode/src/pipeline_encode.cpp | ||
| 76 | +++ b/tools/legacy/sample_encode/src/pipeline_encode.cpp | ||
| 77 | @@ -50,6 +50,7 @@ msdk_tick time_get_frequency(void) { | ||
| 78 | |||
| 79 | mfxU16 FourCcBitDepth(mfxU32 fourCC) { | ||
| 80 | switch (fourCC) { | ||
| 81 | + case MFX_FOURCC_YUV400: | ||
| 82 | case MFX_FOURCC_NV12: | ||
| 83 | case MFX_FOURCC_NV16: | ||
| 84 | case MFX_FOURCC_YUY2: | ||
| 85 | @@ -845,8 +846,8 @@ mfxStatus CEncodingPipeline::CheckHyperEncodeParams(mfxHyperMode hyperMode) { | ||
| 86 | #endif | ||
| 87 | |||
| 88 | mfxU32 CEncodingPipeline::FileFourCC2EncFourCC(mfxU32 fcc) { | ||
| 89 | - // File reader automatically converts I420, YV12, and YUV400 to NV12 | ||
| 90 | - if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12 || fcc == MFX_FOURCC_YUV400) | ||
| 91 | + // File reader automatically converts I420 and YV12 to NV12 | ||
| 92 | + if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12) | ||
| 93 | return MFX_FOURCC_NV12; | ||
| 94 | else | ||
| 95 | return fcc; | ||
| 96 | @@ -1054,6 +1055,7 @@ mfxStatus CEncodingPipeline::AllocFrames() { | ||
| 97 | |||
| 98 | // prepare allocation requests | ||
| 99 | EncRequest.NumFrameSuggested = EncRequest.NumFrameMin = nEncSurfNum; | ||
| 100 | + | ||
| 101 | MSDK_MEMCPY_VAR(EncRequest.Info, &(m_mfxEncParams.mfx.FrameInfo), sizeof(mfxFrameInfo)); | ||
| 102 | if (m_pmfxVPP) { | ||
| 103 | EncRequest.Type |= | ||
| 104 | @@ -1650,15 +1652,11 @@ mfxStatus CEncodingPipeline::Init(sInputParams* pParams) { | ||
| 105 | |||
| 106 | // FileReader can convert yv12->nv12 without vpp, when hw impl | ||
| 107 | if (pParams->bUseHWLib) { | ||
| 108 | - m_InputFourCC = ((pParams->FileInputFourCC == MFX_FOURCC_I420) || | ||
| 109 | - (pParams->FileInputFourCC == MFX_FOURCC_YUV400)) | ||
| 110 | - ? MFX_FOURCC_NV12 | ||
| 111 | - : pParams->FileInputFourCC; | ||
| 112 | - | ||
| 113 | - pParams->EncodeFourCC = ((pParams->EncodeFourCC == MFX_FOURCC_I420) || | ||
| 114 | - (pParams->EncodeFourCC == MFX_FOURCC_YUV400)) | ||
| 115 | - ? MFX_FOURCC_NV12 | ||
| 116 | - : pParams->EncodeFourCC; | ||
| 117 | + m_InputFourCC = (pParams->FileInputFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12 | ||
| 118 | + : pParams->FileInputFourCC; | ||
| 119 | + | ||
| 120 | + pParams->EncodeFourCC = | ||
| 121 | + (pParams->EncodeFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12 : pParams->EncodeFourCC; | ||
| 122 | } | ||
| 123 | else { | ||
| 124 | m_InputFourCC = pParams->FileInputFourCC; | ||
| 125 | diff --git a/tools/legacy/sample_encode/src/sample_encode.cpp b/tools/legacy/sample_encode/src/sample_encode.cpp | ||
| 126 | index 0a65016..7c722ea 100644 | ||
| 127 | --- a/tools/legacy/sample_encode/src/sample_encode.cpp | ||
| 128 | +++ b/tools/legacy/sample_encode/src/sample_encode.cpp | ||
| 129 | @@ -94,10 +94,8 @@ void PrintHelp(char* strAppName, const char* strErrorMessage, ...) { | ||
| 130 | #endif | ||
| 131 | printf( | ||
| 132 | " [-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"); | ||
| 133 | -#if (defined(_WIN64) || defined(_WIN32)) | ||
| 134 | printf( | ||
| 135 | " [-yuv400] - input color format is YUV400 (grayscale) and will be converted to NV12 for encoding (JPEG only).\n"); | ||
| 136 | -#endif | ||
| 137 | printf( | ||
| 138 | " [-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"); | ||
| 139 | printf( | ||
| 140 | @@ -924,11 +922,9 @@ mfxStatus ParseInputString(char* strInput[], mfxU32 nArgNum, sInputParams* pPara | ||
| 141 | else if (msdk_match(strInput[i], "-y410")) { | ||
| 142 | pParams->FileInputFourCC = MFX_FOURCC_Y410; | ||
| 143 | } | ||
| 144 | -#if (defined(_WIN64) || defined(_WIN32)) | ||
| 145 | else if (msdk_match(strInput[i], "-yuv400")) { | ||
| 146 | pParams->FileInputFourCC = MFX_FOURCC_YUV400; | ||
| 147 | } | ||
| 148 | -#endif | ||
| 149 | else if (msdk_match(strInput[i], "-ec::p010")) { | ||
| 150 | pParams->EncodeFourCC = MFX_FOURCC_P010; | ||
| 151 | } | ||
| 152 | -- | ||
| 153 | 2.43.2 | ||
| 154 | |||
diff --git a/recipes-multimedia/vpl/files/0003-Enable-YUV400-JPEG-Enc-for-linux-vaapi-only.patch b/recipes-multimedia/vpl/files/0003-Enable-YUV400-JPEG-Enc-for-linux-vaapi-only.patch new file mode 100644 index 00000000..7e735556 --- /dev/null +++ b/recipes-multimedia/vpl/files/0003-Enable-YUV400-JPEG-Enc-for-linux-vaapi-only.patch | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | From a876f3bd8d31ae47e4f8148ec89edef1eb5dee5f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com> | ||
| 3 | Date: Wed, 12 Jun 2024 10:58:13 +0800 | ||
| 4 | Subject: [PATCH 3/9] Enable YUV400 JPEG Enc for linux vaapi only | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/ef82b8a608999e56a2449937d1fa4cbee274d9ab] | ||
| 7 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 8 | --- | ||
| 9 | .../sample_encode/src/pipeline_encode.cpp | 28 +++++++++++++++---- | ||
| 10 | .../sample_encode/src/sample_encode.cpp | 2 +- | ||
| 11 | 2 files changed, 23 insertions(+), 7 deletions(-) | ||
| 12 | |||
| 13 | diff --git a/tools/legacy/sample_encode/src/pipeline_encode.cpp b/tools/legacy/sample_encode/src/pipeline_encode.cpp | ||
| 14 | index cda607b..b29dc29 100644 | ||
| 15 | --- a/tools/legacy/sample_encode/src/pipeline_encode.cpp | ||
| 16 | +++ b/tools/legacy/sample_encode/src/pipeline_encode.cpp | ||
| 17 | @@ -846,9 +846,15 @@ mfxStatus CEncodingPipeline::CheckHyperEncodeParams(mfxHyperMode hyperMode) { | ||
| 18 | #endif | ||
| 19 | |||
| 20 | mfxU32 CEncodingPipeline::FileFourCC2EncFourCC(mfxU32 fcc) { | ||
| 21 | - // File reader automatically converts I420 and YV12 to NV12 | ||
| 22 | - if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12) | ||
| 23 | + // File reader automatically converts I420, YV12 to NV12 | ||
| 24 | + // On windows, YUV400 is automatically converts to NV12. | ||
| 25 | + if (fcc == MFX_FOURCC_I420 || fcc == MFX_FOURCC_YV12 | ||
| 26 | +#if (defined(_WIN64) || defined(_WIN32)) | ||
| 27 | + || fcc == MFX_FOURCC_YUV400 | ||
| 28 | +#endif | ||
| 29 | + ) { | ||
| 30 | return MFX_FOURCC_NV12; | ||
| 31 | + } | ||
| 32 | else | ||
| 33 | return fcc; | ||
| 34 | } | ||
| 35 | @@ -1652,11 +1658,21 @@ mfxStatus CEncodingPipeline::Init(sInputParams* pParams) { | ||
| 36 | |||
| 37 | // FileReader can convert yv12->nv12 without vpp, when hw impl | ||
| 38 | if (pParams->bUseHWLib) { | ||
| 39 | - m_InputFourCC = (pParams->FileInputFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12 | ||
| 40 | - : pParams->FileInputFourCC; | ||
| 41 | + m_InputFourCC = ((pParams->FileInputFourCC == MFX_FOURCC_I420) | ||
| 42 | +#if (defined(_WIN64) || defined(_WIN32)) | ||
| 43 | + || (pParams->FileInputFourCC == MFX_FOURCC_YUV400) | ||
| 44 | +#endif | ||
| 45 | + ) | ||
| 46 | + ? MFX_FOURCC_NV12 | ||
| 47 | + : pParams->FileInputFourCC; | ||
| 48 | |||
| 49 | - pParams->EncodeFourCC = | ||
| 50 | - (pParams->EncodeFourCC == MFX_FOURCC_I420) ? MFX_FOURCC_NV12 : pParams->EncodeFourCC; | ||
| 51 | + pParams->EncodeFourCC = ((pParams->EncodeFourCC == MFX_FOURCC_I420) | ||
| 52 | +#if (defined(_WIN64) || defined(_WIN32)) | ||
| 53 | + || (pParams->EncodeFourCC == MFX_FOURCC_YUV400) | ||
| 54 | +#endif | ||
| 55 | + ) | ||
| 56 | + ? MFX_FOURCC_NV12 | ||
| 57 | + : pParams->EncodeFourCC; | ||
| 58 | } | ||
| 59 | else { | ||
| 60 | m_InputFourCC = pParams->FileInputFourCC; | ||
| 61 | diff --git a/tools/legacy/sample_encode/src/sample_encode.cpp b/tools/legacy/sample_encode/src/sample_encode.cpp | ||
| 62 | index 7c722ea..ed142f5 100644 | ||
| 63 | --- a/tools/legacy/sample_encode/src/sample_encode.cpp | ||
| 64 | +++ b/tools/legacy/sample_encode/src/sample_encode.cpp | ||
| 65 | @@ -95,7 +95,7 @@ void PrintHelp(char* strAppName, const char* strErrorMessage, ...) { | ||
| 66 | printf( | ||
| 67 | " [-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"); | ||
| 68 | printf( | ||
| 69 | - " [-yuv400] - input color format is YUV400 (grayscale) and will be converted to NV12 for encoding (JPEG only).\n"); | ||
| 70 | + " [-yuv400] - input color format is YUV400 (grayscale) and will be converted to NV12 for encoding (JPEG Windows only).\n"); | ||
| 71 | printf( | ||
| 72 | " [-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"); | ||
| 73 | printf( | ||
| 74 | -- | ||
| 75 | 2.43.2 | ||
| 76 | |||
diff --git a/recipes-multimedia/vpl/files/0004-Fix-rDRM-DMA-methods.patch b/recipes-multimedia/vpl/files/0004-Fix-rDRM-DMA-methods.patch new file mode 100644 index 00000000..de746a95 --- /dev/null +++ b/recipes-multimedia/vpl/files/0004-Fix-rDRM-DMA-methods.patch | |||
| @@ -0,0 +1,294 @@ | |||
| 1 | From 61f75283da56105adca1d3034422ddac2bc88c18 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com> | ||
| 3 | Date: Wed, 19 Jun 2024 21:08:14 +0800 | ||
| 4 | Subject: [PATCH 4/9] Fix rDRM DMA methods | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/0c12ef0fed3d2e8c8f017e6fa5bf74e55ec51412] | ||
| 7 | |||
| 8 | The commits also remove out libDRM intel bufmgr (i915) dependency | ||
| 9 | where XE does not have the equivalent API. Tested i915 for both | ||
| 10 | DRM_PRIME and KERNEL_DRM, both methods could work correctly. | ||
| 11 | |||
| 12 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 13 | --- | ||
| 14 | .../sample_common/include/vaapi_utils.h | 2 + | ||
| 15 | .../sample_common/include/vaapi_utils_drm.h | 2 + | ||
| 16 | .../legacy/sample_common/src/vaapi_utils.cpp | 3 +- | ||
| 17 | .../sample_common/src/vaapi_utils_drm.cpp | 159 ++++++++++-------- | ||
| 18 | 4 files changed, 93 insertions(+), 73 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/tools/legacy/sample_common/include/vaapi_utils.h b/tools/legacy/sample_common/include/vaapi_utils.h | ||
| 21 | index a3a8544..868dd0e 100644 | ||
| 22 | --- a/tools/legacy/sample_common/include/vaapi_utils.h | ||
| 23 | +++ b/tools/legacy/sample_common/include/vaapi_utils.h | ||
| 24 | @@ -281,6 +281,7 @@ public: | ||
| 25 | typedef drm_intel_bufmgr* (*drm_intel_bufmgr_gem_init_type)(int fd, int batch_size); | ||
| 26 | typedef int (*drm_intel_bo_gem_export_to_prime_type)(drm_intel_bo*, int*); | ||
| 27 | typedef void (*drm_intel_bufmgr_destroy_type)(drm_intel_bufmgr*); | ||
| 28 | + typedef int (*drmPrimeFDToHandle_type)(int fd, int prime_fd, uint32_t* handle); | ||
| 29 | |||
| 30 | DrmIntel_Proxy(); | ||
| 31 | ~DrmIntel_Proxy(); | ||
| 32 | @@ -290,6 +291,7 @@ public: | ||
| 33 | __DECLARE(drm_intel_bo_unreference); | ||
| 34 | __DECLARE(drm_intel_bufmgr_gem_init); | ||
| 35 | __DECLARE(drm_intel_bufmgr_destroy); | ||
| 36 | + __DECLARE(drmPrimeFDToHandle); | ||
| 37 | #if defined(X11_DRI3_SUPPORT) | ||
| 38 | __DECLARE(drm_intel_bo_gem_export_to_prime); | ||
| 39 | #endif | ||
| 40 | diff --git a/tools/legacy/sample_common/include/vaapi_utils_drm.h b/tools/legacy/sample_common/include/vaapi_utils_drm.h | ||
| 41 | index 78109aa..1ba6ea8 100644 | ||
| 42 | --- a/tools/legacy/sample_common/include/vaapi_utils_drm.h | ||
| 43 | +++ b/tools/legacy/sample_common/include/vaapi_utils_drm.h | ||
| 44 | @@ -130,6 +130,8 @@ private: | ||
| 45 | mfxExtContentLightLevelInfo* contentLight, | ||
| 46 | bool enableHDR); | ||
| 47 | |||
| 48 | + uint32_t convertVaFourccToDrmFormat(uint32_t vaFourcc); | ||
| 49 | + | ||
| 50 | const MfxLoader::DRM_Proxy m_drmlib; | ||
| 51 | const MfxLoader::DrmIntel_Proxy m_drmintellib; | ||
| 52 | |||
| 53 | diff --git a/tools/legacy/sample_common/src/vaapi_utils.cpp b/tools/legacy/sample_common/src/vaapi_utils.cpp | ||
| 54 | index f01b07f..48a51b0 100644 | ||
| 55 | --- a/tools/legacy/sample_common/src/vaapi_utils.cpp | ||
| 56 | +++ b/tools/legacy/sample_common/src/vaapi_utils.cpp | ||
| 57 | @@ -136,7 +136,8 @@ DrmIntel_Proxy::DrmIntel_Proxy() | ||
| 58 | SIMPLE_LOADER_FUNCTION(drm_intel_bo_gem_create_from_prime), | ||
| 59 | SIMPLE_LOADER_FUNCTION(drm_intel_bo_unreference), | ||
| 60 | SIMPLE_LOADER_FUNCTION(drm_intel_bufmgr_gem_init), | ||
| 61 | - SIMPLE_LOADER_FUNCTION(drm_intel_bufmgr_destroy) | ||
| 62 | + SIMPLE_LOADER_FUNCTION(drm_intel_bufmgr_destroy), | ||
| 63 | + SIMPLE_LOADER_FUNCTION(drmPrimeFDToHandle) | ||
| 64 | #if defined(X11_DRI3_SUPPORT) | ||
| 65 | , | ||
| 66 | SIMPLE_LOADER_FUNCTION(drm_intel_bo_gem_export_to_prime) | ||
| 67 | diff --git a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp | ||
| 68 | index 7227588..44bc693 100644 | ||
| 69 | --- a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp | ||
| 70 | +++ b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp | ||
| 71 | @@ -14,6 +14,7 @@ | ||
| 72 | #include <stdexcept> | ||
| 73 | |||
| 74 | #include <drm_fourcc.h> | ||
| 75 | + #include <xf86drm.h> | ||
| 76 | #include "i915_drm.h" | ||
| 77 | #include "vaapi_utils_drm.h" | ||
| 78 | |||
| 79 | @@ -211,7 +212,6 @@ drmRenderer::drmRenderer(int fd, mfxI32 monitorType) | ||
| 80 | m_crtc(), | ||
| 81 | m_connectorProperties(), | ||
| 82 | m_crtcProperties(), | ||
| 83 | - m_bufmgr(NULL), | ||
| 84 | m_overlay_wrn(true), | ||
| 85 | m_bSentHDR(false), | ||
| 86 | m_bHdrSupport(false), | ||
| 87 | @@ -257,11 +257,6 @@ drmRenderer::~drmRenderer() { | ||
| 88 | m_drmlib.drmModeFreeCrtc(m_crtc); | ||
| 89 | m_drmlib.drmModeFreeObjectProperties(m_connectorProperties); | ||
| 90 | m_drmlib.drmModeFreeObjectProperties(m_crtcProperties); | ||
| 91 | - | ||
| 92 | - if (m_bufmgr) { | ||
| 93 | - m_drmintellib.drm_intel_bufmgr_destroy(m_bufmgr); | ||
| 94 | - m_bufmgr = NULL; | ||
| 95 | - } | ||
| 96 | } | ||
| 97 | |||
| 98 | drmModeObjectPropertiesPtr drmRenderer::getProperties(int fd, int objectId, int32_t objectTypeId) { | ||
| 99 | @@ -752,36 +747,75 @@ int drmRenderer::drmSendHdrMetaData(mfxExtMasteringDisplayColourVolume* displayC | ||
| 100 | return 0; | ||
| 101 | } | ||
| 102 | |||
| 103 | +uint32_t drmRenderer::convertVaFourccToDrmFormat(uint32_t vaFourcc) { | ||
| 104 | + switch (vaFourcc) { | ||
| 105 | + case VA_FOURCC_ARGB: | ||
| 106 | + return DRM_FORMAT_ARGB8888; | ||
| 107 | + case VA_FOURCC_NV12: | ||
| 108 | + return DRM_FORMAT_NV12; | ||
| 109 | + #if defined(DRM_LINUX_P010_SUPPORT) | ||
| 110 | + case VA_FOURCC_P010: | ||
| 111 | + return DRM_FORMAT_P010; | ||
| 112 | + #endif | ||
| 113 | + | ||
| 114 | + default: | ||
| 115 | + printf("unsupported fourcc\n"); | ||
| 116 | + return 0; | ||
| 117 | + } | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | void* drmRenderer::acquire(mfxMemId mid) { | ||
| 121 | - vaapiMemId* vmid = (vaapiMemId*)mid; | ||
| 122 | + vaapiMemId* vmid = (vaapiMemId*)mid; | ||
| 123 | + | ||
| 124 | uint32_t fbhandle = 0; | ||
| 125 | + uint32_t handles[4], pitches[4], offsets[4], flags = 0; | ||
| 126 | + uint64_t modifiers[4]; | ||
| 127 | + int ret; | ||
| 128 | + | ||
| 129 | + MSDK_ZERO_MEMORY(handles); | ||
| 130 | + MSDK_ZERO_MEMORY(pitches); | ||
| 131 | + MSDK_ZERO_MEMORY(offsets); | ||
| 132 | + MSDK_ZERO_MEMORY(modifiers); | ||
| 133 | |||
| 134 | if (vmid->m_buffer_info.mem_type == VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME) { | ||
| 135 | - if (!m_bufmgr) { | ||
| 136 | - m_bufmgr = m_drmintellib.drm_intel_bufmgr_gem_init(m_fd, 4096); | ||
| 137 | - if (!m_bufmgr) | ||
| 138 | - return NULL; | ||
| 139 | - } | ||
| 140 | + uint32_t bo_handle; | ||
| 141 | |||
| 142 | - drm_intel_bo* bo = | ||
| 143 | - m_drmintellib.drm_intel_bo_gem_create_from_prime(m_bufmgr, | ||
| 144 | - (int)vmid->m_buffer_info.handle, | ||
| 145 | - vmid->m_buffer_info.mem_size); | ||
| 146 | - if (!bo) | ||
| 147 | + ret = m_drmintellib.drmPrimeFDToHandle(m_fd, (int)vmid->m_buffer_info.handle, &bo_handle); | ||
| 148 | + if (ret) | ||
| 149 | return NULL; | ||
| 150 | |||
| 151 | - int ret = m_drmlib.drmModeAddFB(m_fd, | ||
| 152 | - vmid->m_image.width, | ||
| 153 | - vmid->m_image.height, | ||
| 154 | - 24, | ||
| 155 | - 32, | ||
| 156 | - vmid->m_image.pitches[0], | ||
| 157 | - bo->handle, | ||
| 158 | - &fbhandle); | ||
| 159 | - if (ret) { | ||
| 160 | - return NULL; | ||
| 161 | + for (uint32_t i = 0; i < vmid->m_image.num_planes; i++) { | ||
| 162 | + pitches[i] = vmid->m_image.pitches[i]; | ||
| 163 | + offsets[i] = vmid->m_image.offsets[i]; | ||
| 164 | + handles[i] = bo_handle; | ||
| 165 | + | ||
| 166 | + if (VA_FOURCC_NV12 == vmid->m_fourcc | ||
| 167 | + #if defined(DRM_LINUX_P010_SUPPORT) | ||
| 168 | + || VA_FOURCC_P010 == vmid->m_fourcc | ||
| 169 | + #endif | ||
| 170 | + ) { | ||
| 171 | + flags = DRM_MODE_FB_MODIFIERS; | ||
| 172 | + modifiers[i] = I915_FORMAT_MOD_Y_TILED; | ||
| 173 | + if (m_bRequiredTiled4) { | ||
| 174 | + #if defined(DRM_LINUX_MODIFIER_TILED4_SUPPORT) | ||
| 175 | + modifiers[i] = I915_FORMAT_MOD_4_TILED; | ||
| 176 | + #endif | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | } | ||
| 180 | - m_drmintellib.drm_intel_bo_unreference(bo); | ||
| 181 | + | ||
| 182 | + ret = m_drmlib.drmModeAddFB2WithModifiers(m_fd, | ||
| 183 | + vmid->m_image.width, | ||
| 184 | + vmid->m_image.height, | ||
| 185 | + convertVaFourccToDrmFormat(vmid->m_fourcc), | ||
| 186 | + handles, | ||
| 187 | + pitches, | ||
| 188 | + offsets, | ||
| 189 | + modifiers, | ||
| 190 | + &fbhandle, | ||
| 191 | + flags); | ||
| 192 | + if (ret) | ||
| 193 | + return NULL; | ||
| 194 | } | ||
| 195 | else if (vmid->m_buffer_info.mem_type == VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM) { | ||
| 196 | struct drm_gem_open flink_open; | ||
| 197 | @@ -793,62 +827,42 @@ void* drmRenderer::acquire(mfxMemId mid) { | ||
| 198 | if (ret) | ||
| 199 | return NULL; | ||
| 200 | |||
| 201 | - uint32_t handles[4], pitches[4], offsets[4], pixel_format, flags = 0; | ||
| 202 | - uint64_t modifiers[4]; | ||
| 203 | - | ||
| 204 | - memset(&handles, 0, sizeof(handles)); | ||
| 205 | - memset(&pitches, 0, sizeof(pitches)); | ||
| 206 | - memset(&offsets, 0, sizeof(offsets)); | ||
| 207 | - memset(&modifiers, 0, sizeof(modifiers)); | ||
| 208 | - | ||
| 209 | - handles[0] = flink_open.handle; | ||
| 210 | - pitches[0] = vmid->m_image.pitches[0]; | ||
| 211 | - offsets[0] = vmid->m_image.offsets[0]; | ||
| 212 | + for (uint32_t i = 0; i < vmid->m_image.num_planes; i++) { | ||
| 213 | + pitches[i] = vmid->m_image.pitches[i]; | ||
| 214 | + offsets[i] = vmid->m_image.offsets[i]; | ||
| 215 | + handles[i] = flink_open.handle; | ||
| 216 | |||
| 217 | - if (VA_FOURCC_NV12 == vmid->m_fourcc | ||
| 218 | + if (VA_FOURCC_NV12 == vmid->m_fourcc | ||
| 219 | #if defined(DRM_LINUX_P010_SUPPORT) | ||
| 220 | - || VA_FOURCC_P010 == vmid->m_fourcc | ||
| 221 | + || VA_FOURCC_P010 == vmid->m_fourcc | ||
| 222 | #endif | ||
| 223 | - ) { | ||
| 224 | - pixel_format = DRM_FORMAT_NV12; | ||
| 225 | - #if defined(DRM_LINUX_P010_SUPPORT) | ||
| 226 | - if (VA_FOURCC_P010 == vmid->m_fourcc) | ||
| 227 | - pixel_format = DRM_FORMAT_P010; | ||
| 228 | - #endif | ||
| 229 | - handles[1] = flink_open.handle; | ||
| 230 | - pitches[1] = vmid->m_image.pitches[1]; | ||
| 231 | - offsets[1] = vmid->m_image.offsets[1]; | ||
| 232 | - modifiers[0] = modifiers[1] = I915_FORMAT_MOD_Y_TILED; | ||
| 233 | - flags = DRM_MODE_FB_MODIFIERS; | ||
| 234 | - | ||
| 235 | - if (m_bRequiredTiled4) { | ||
| 236 | + ) { | ||
| 237 | + flags = DRM_MODE_FB_MODIFIERS; | ||
| 238 | + modifiers[i] = I915_FORMAT_MOD_Y_TILED; | ||
| 239 | + if (m_bRequiredTiled4) { | ||
| 240 | #if defined(DRM_LINUX_MODIFIER_TILED4_SUPPORT) | ||
| 241 | - modifiers[0] = modifiers[1] = I915_FORMAT_MOD_4_TILED; | ||
| 242 | + modifiers[i] = I915_FORMAT_MOD_4_TILED; | ||
| 243 | #endif | ||
| 244 | - } | ||
| 245 | - else { | ||
| 246 | - modifiers[0] = modifiers[1] = I915_FORMAT_MOD_Y_TILED; | ||
| 247 | - | ||
| 248 | - struct drm_i915_gem_set_tiling set_tiling; | ||
| 249 | - memset(&set_tiling, 0, sizeof(set_tiling)); | ||
| 250 | - set_tiling.handle = flink_open.handle; | ||
| 251 | - set_tiling.tiling_mode = I915_TILING_Y; | ||
| 252 | - set_tiling.stride = vmid->m_image.pitches[0]; | ||
| 253 | - ret = m_drmlib.drmIoctl(m_fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling); | ||
| 254 | - if (ret) { | ||
| 255 | - printf("DRM_IOCTL_I915_GEM_SET_TILING Failed ret = %d\n", ret); | ||
| 256 | - return NULL; | ||
| 257 | + } | ||
| 258 | + else { | ||
| 259 | + struct drm_i915_gem_set_tiling set_tiling; | ||
| 260 | + memset(&set_tiling, 0, sizeof(set_tiling)); | ||
| 261 | + set_tiling.handle = flink_open.handle; | ||
| 262 | + set_tiling.tiling_mode = I915_TILING_Y; | ||
| 263 | + set_tiling.stride = vmid->m_image.pitches[0]; | ||
| 264 | + ret = m_drmlib.drmIoctl(m_fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling); | ||
| 265 | + if (ret) { | ||
| 266 | + printf("DRM_IOCTL_I915_GEM_SET_TILING Failed ret = %d\n", ret); | ||
| 267 | + return NULL; | ||
| 268 | + } | ||
| 269 | } | ||
| 270 | } | ||
| 271 | } | ||
| 272 | - else { | ||
| 273 | - pixel_format = DRM_FORMAT_XRGB8888; | ||
| 274 | - } | ||
| 275 | |||
| 276 | ret = m_drmlib.drmModeAddFB2WithModifiers(m_fd, | ||
| 277 | vmid->m_image.width, | ||
| 278 | vmid->m_image.height, | ||
| 279 | - pixel_format, | ||
| 280 | + convertVaFourccToDrmFormat(vmid->m_fourcc), | ||
| 281 | handles, | ||
| 282 | pitches, | ||
| 283 | offsets, | ||
| 284 | @@ -905,6 +919,7 @@ mfxStatus drmRenderer::render(mfxFrameSurface1* pSurface) { | ||
| 285 | if (!setMaster()) { | ||
| 286 | return MFX_ERR_UNKNOWN; | ||
| 287 | } | ||
| 288 | + | ||
| 289 | if ((m_mode.hdisplay == memid->m_image.width) && (m_mode.vdisplay == memid->m_image.height)) { | ||
| 290 | // surface in the framebuffer exactly matches crtc scanout port, so we | ||
| 291 | // can scanout from this framebuffer for the whole crtc | ||
| 292 | -- | ||
| 293 | 2.43.2 | ||
| 294 | |||
diff --git a/recipes-multimedia/vpl/files/0005-Force-allocator-to-use-DRM_PRIME-for-rDRM.patch b/recipes-multimedia/vpl/files/0005-Force-allocator-to-use-DRM_PRIME-for-rDRM.patch new file mode 100644 index 00000000..cb1d2fa6 --- /dev/null +++ b/recipes-multimedia/vpl/files/0005-Force-allocator-to-use-DRM_PRIME-for-rDRM.patch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | From 286804cc4a9646e23b833fa2b308a8e69a3e56f9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Vincent Cheah Beng Keat <vincent.beng.keat.cheah@intel.com> | ||
| 3 | Date: Wed, 19 Jun 2024 21:08:41 +0800 | ||
| 4 | Subject: [PATCH 5/9] Force allocator to use DRM_PRIME for rDRM | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/3c81381edb5a591f45c92fac60a23eba081b21b1] | ||
| 7 | |||
| 8 | XE deprecated DRM GEM Flink API. Use DRM_PRIME method instead for | ||
| 9 | rDRM case. | ||
| 10 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 11 | --- | ||
| 12 | tools/legacy/sample_decode/src/pipeline_decode.cpp | 2 +- | ||
| 13 | .../sample_multi_transcode/src/sample_multi_transcode.cpp | 2 +- | ||
| 14 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/tools/legacy/sample_decode/src/pipeline_decode.cpp b/tools/legacy/sample_decode/src/pipeline_decode.cpp | ||
| 17 | index 83fb895..51b7d69 100644 | ||
| 18 | --- a/tools/legacy/sample_decode/src/pipeline_decode.cpp | ||
| 19 | +++ b/tools/legacy/sample_decode/src/pipeline_decode.cpp | ||
| 20 | @@ -1437,7 +1437,7 @@ mfxStatus CDecodingPipeline::CreateAllocator() { | ||
| 21 | if (m_libvaBackend == MFX_LIBVA_DRM_MODESET) { | ||
| 22 | #if defined(LIBVA_DRM_SUPPORT) | ||
| 23 | CVAAPIDeviceDRM* drmdev = dynamic_cast<CVAAPIDeviceDRM*>(m_hwdev); | ||
| 24 | - p_vaapiAllocParams->m_export_mode = vaapiAllocatorParams::CUSTOM_FLINK; | ||
| 25 | + p_vaapiAllocParams->m_export_mode = vaapiAllocatorParams::PRIME; | ||
| 26 | p_vaapiAllocParams->m_exporter = | ||
| 27 | dynamic_cast<vaapiAllocatorParams::Exporter*>(drmdev->getRenderer()); | ||
| 28 | #endif | ||
| 29 | diff --git a/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp b/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp | ||
| 30 | index ce972c8..6b2c919 100644 | ||
| 31 | --- a/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp | ||
| 32 | +++ b/tools/legacy/sample_multi_transcode/src/sample_multi_transcode.cpp | ||
| 33 | @@ -374,7 +374,7 @@ mfxStatus Launcher::Init(int argc, char* argv[]) { | ||
| 34 | #if defined(LIBVA_DRM_SUPPORT) | ||
| 35 | if (params.libvaBackend == MFX_LIBVA_DRM_MODESET) { | ||
| 36 | CVAAPIDeviceDRM* drmdev = dynamic_cast<CVAAPIDeviceDRM*>(hwdev.get()); | ||
| 37 | - pVAAPIParams->m_export_mode = vaapiAllocatorParams::CUSTOM_FLINK; | ||
| 38 | + pVAAPIParams->m_export_mode = vaapiAllocatorParams::PRIME; | ||
| 39 | pVAAPIParams->m_exporter = | ||
| 40 | dynamic_cast<vaapiAllocatorParams::Exporter*>(drmdev->getRenderer()); | ||
| 41 | } | ||
| 42 | -- | ||
| 43 | 2.43.2 | ||
| 44 | |||
diff --git a/recipes-multimedia/vpl/files/0006-Enable-VVC-in-sample_decode.patch b/recipes-multimedia/vpl/files/0006-Enable-VVC-in-sample_decode.patch new file mode 100644 index 00000000..2bb6525d --- /dev/null +++ b/recipes-multimedia/vpl/files/0006-Enable-VVC-in-sample_decode.patch | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | From 75551817541a3b355eddadf3d5e32da31e5f4a31 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 3 | Date: Thu, 1 Aug 2024 11:07:42 +0800 | ||
| 4 | Subject: [PATCH 6/9] Enable VVC in sample_decode. | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/5f0959abd9271d07c0ad97edd684d7c04d93350c] | ||
| 7 | |||
| 8 | Signed-off-by: Lim Siew Hoon <siew.hoon.lim@intel.com> | ||
| 9 | --- | ||
| 10 | tools/legacy/sample_common/src/sample_utils.cpp | 4 ++++ | ||
| 11 | tools/legacy/sample_decode/src/sample_decode.cpp | 5 +++-- | ||
| 12 | 2 files changed, 7 insertions(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/tools/legacy/sample_common/src/sample_utils.cpp b/tools/legacy/sample_common/src/sample_utils.cpp | ||
| 15 | index b2b67bf..bd11af7 100644 | ||
| 16 | --- a/tools/legacy/sample_common/src/sample_utils.cpp | ||
| 17 | +++ b/tools/legacy/sample_common/src/sample_utils.cpp | ||
| 18 | @@ -2435,6 +2435,7 @@ bool IsDecodeCodecSupported(mfxU32 codecFormat) { | ||
| 19 | case MFX_CODEC_VP8: | ||
| 20 | case MFX_CODEC_VP9: | ||
| 21 | case MFX_CODEC_AV1: | ||
| 22 | + case MFX_CODEC_VVC: | ||
| 23 | break; | ||
| 24 | default: | ||
| 25 | return false; | ||
| 26 | @@ -2509,6 +2510,9 @@ mfxStatus StrFormatToCodecFormatFourCC(char* strInput, mfxU32& codecFormat) { | ||
| 27 | else if (msdk_match(strInput, "av1")) { | ||
| 28 | codecFormat = MFX_CODEC_AV1; | ||
| 29 | } | ||
| 30 | + else if (msdk_match(strInput, "vvc")) { | ||
| 31 | + codecFormat = MFX_CODEC_VVC; | ||
| 32 | + } | ||
| 33 | else if ((msdk_match(strInput, "raw"))) { | ||
| 34 | codecFormat = MFX_CODEC_DUMP; | ||
| 35 | } | ||
| 36 | diff --git a/tools/legacy/sample_decode/src/sample_decode.cpp b/tools/legacy/sample_decode/src/sample_decode.cpp | ||
| 37 | index 8ebe4c5..33ab1f5 100644 | ||
| 38 | --- a/tools/legacy/sample_decode/src/sample_decode.cpp | ||
| 39 | +++ b/tools/legacy/sample_decode/src/sample_decode.cpp | ||
| 40 | @@ -29,7 +29,7 @@ void PrintHelp(char* strAppName, const char* strErrorMessage) { | ||
| 41 | printf(" or: %s <codecid> [<options>] -i InputBitstream -o OutputYUVFile\n", strAppName); | ||
| 42 | printf("\n"); | ||
| 43 | printf("Supported codecs (<codecid>):\n"); | ||
| 44 | - printf(" <codecid>=h264|mpeg2|vc1|mvc|jpeg|vp9|av1 - built-in Media SDK codecs\n"); | ||
| 45 | + printf(" <codecid>=h264|mpeg2|vc1|mvc|jpeg|vp9|av1|vvc - built-in Media SDK codecs\n"); | ||
| 46 | printf( | ||
| 47 | " <codecid>=h265|vp9|capture - in-box Media SDK plugins (may require separate downloading and installation)\n"); | ||
| 48 | printf("\n"); | ||
| 49 | @@ -798,7 +798,8 @@ mfxStatus ParseInputString(char* strInput[], mfxU32 nArgNum, sInputParams* pPara | ||
| 50 | if (MFX_CODEC_MPEG2 != pParams->videoType && MFX_CODEC_AVC != pParams->videoType && | ||
| 51 | MFX_CODEC_HEVC != pParams->videoType && MFX_CODEC_VC1 != pParams->videoType && | ||
| 52 | MFX_CODEC_JPEG != pParams->videoType && MFX_CODEC_VP8 != pParams->videoType && | ||
| 53 | - MFX_CODEC_VP9 != pParams->videoType && MFX_CODEC_AV1 != pParams->videoType) { | ||
| 54 | + MFX_CODEC_VP9 != pParams->videoType && MFX_CODEC_AV1 != pParams->videoType && | ||
| 55 | + MFX_CODEC_VVC != pParams->videoType) { | ||
| 56 | PrintHelp(strInput[0], "Unknown codec"); | ||
| 57 | return MFX_ERR_UNSUPPORTED; | ||
| 58 | } | ||
| 59 | -- | ||
| 60 | 2.43.2 | ||
| 61 | |||
diff --git a/recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch b/recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch new file mode 100644 index 00000000..d6c5cea2 --- /dev/null +++ b/recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch | |||
| @@ -0,0 +1,185 @@ | |||
| 1 | From fecf6b6cdb02c7dba3b838ee710363b57fe8e6e7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Hoe, Sheng Yang" <sheng.yang.hoe@intel.com> | ||
| 3 | Date: Fri, 26 Jul 2024 23:35:25 +0800 | ||
| 4 | Subject: [PATCH 7/9] Fix X11 rendering for xe | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/2d751730617682133bf066e61e1ca952136309bd] | ||
| 7 | |||
| 8 | Signed-off-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com> | ||
| 9 | --- | ||
| 10 | .../sample_common/include/vaapi_device.h | 6 --- | ||
| 11 | .../sample_common/include/vaapi_utils_x11.h | 4 -- | ||
| 12 | .../legacy/sample_common/src/vaapi_device.cpp | 50 ++----------------- | ||
| 13 | .../sample_common/src/vaapi_utils_x11.cpp | 4 +- | ||
| 14 | 4 files changed, 7 insertions(+), 57 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/tools/legacy/sample_common/include/vaapi_device.h b/tools/legacy/sample_common/include/vaapi_device.h | ||
| 17 | index 5752a28..dc71659 100644 | ||
| 18 | --- a/tools/legacy/sample_common/include/vaapi_device.h | ||
| 19 | +++ b/tools/legacy/sample_common/include/vaapi_device.h | ||
| 20 | @@ -75,10 +75,7 @@ public: | ||
| 21 | m_nRenderWinH = 0; | ||
| 22 | m_bRenderWin = false; | ||
| 23 | #if defined(X11_DRI3_SUPPORT) | ||
| 24 | - m_dri_fd = 0; | ||
| 25 | - m_bufmgr = NULL; | ||
| 26 | m_xcbconn = NULL; | ||
| 27 | - m_device_path = devicePath; | ||
| 28 | #endif | ||
| 29 | } | ||
| 30 | virtual ~CVAAPIDeviceX11(void); | ||
| 31 | @@ -106,10 +103,7 @@ private: | ||
| 32 | mfxU32 m_nRenderWinW; | ||
| 33 | mfxU32 m_nRenderWinH; | ||
| 34 | #if defined(X11_DRI3_SUPPORT) | ||
| 35 | - int m_dri_fd; | ||
| 36 | - drm_intel_bufmgr* m_bufmgr; | ||
| 37 | xcb_connection_t* m_xcbconn; | ||
| 38 | - std::string m_device_path; | ||
| 39 | #endif | ||
| 40 | // no copies allowed | ||
| 41 | CVAAPIDeviceX11(const CVAAPIDeviceX11&); | ||
| 42 | diff --git a/tools/legacy/sample_common/include/vaapi_utils_x11.h b/tools/legacy/sample_common/include/vaapi_utils_x11.h | ||
| 43 | index acdd78e..840c29d 100644 | ||
| 44 | --- a/tools/legacy/sample_common/include/vaapi_utils_x11.h | ||
| 45 | +++ b/tools/legacy/sample_common/include/vaapi_utils_x11.h | ||
| 46 | @@ -40,9 +40,6 @@ public: | ||
| 47 | MfxLoader::Xcbpresent_Proxy& GetXcbpresentX11() { | ||
| 48 | return m_xcbpresentlib; | ||
| 49 | } | ||
| 50 | - MfxLoader::DrmIntel_Proxy& GetDrmIntelX11() { | ||
| 51 | - return m_drmintellib; | ||
| 52 | - } | ||
| 53 | #endif // X11_DRI3_SUPPORT | ||
| 54 | |||
| 55 | protected: | ||
| 56 | @@ -57,7 +54,6 @@ protected: | ||
| 57 | MfxLoader::X11_Xcb_Proxy m_x11xcblib; | ||
| 58 | MfxLoader::XCB_Dri3_Proxy m_xcbdri3lib; | ||
| 59 | MfxLoader::Xcbpresent_Proxy m_xcbpresentlib; | ||
| 60 | - MfxLoader::DrmIntel_Proxy m_drmintellib; | ||
| 61 | #endif // X11_DRI3_SUPPORT | ||
| 62 | int fd; | ||
| 63 | |||
| 64 | diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp | ||
| 65 | index c44e67e..9bf3433 100644 | ||
| 66 | --- a/tools/legacy/sample_common/src/vaapi_device.cpp | ||
| 67 | +++ b/tools/legacy/sample_common/src/vaapi_device.cpp | ||
| 68 | @@ -72,39 +72,9 @@ mfxStatus CVAAPIDeviceX11::Init(mfxHDL hWindow, mfxU16 nViews, mfxU32 nAdapterNu | ||
| 69 | } | ||
| 70 | } | ||
| 71 | #if defined(X11_DRI3_SUPPORT) | ||
| 72 | - MfxLoader::DrmIntel_Proxy& drmintellib = m_X11LibVA.GetDrmIntelX11(); | ||
| 73 | MfxLoader::X11_Xcb_Proxy& x11xcblib = m_X11LibVA.GetX11XcbX11(); | ||
| 74 | |||
| 75 | m_xcbconn = x11xcblib.XGetXCBConnection(VAAPI_GET_X_DISPLAY(m_X11LibVA.GetXDisplay())); | ||
| 76 | - | ||
| 77 | - if (m_device_path.empty()) { | ||
| 78 | - // it's enough to pass render node, because we only request | ||
| 79 | - // information from kernel via m_dri_fd | ||
| 80 | - for (mfxU32 i = 0; i < MFX_DEVICE_MAX_NODES; ++i) { | ||
| 81 | - std::string devPath = | ||
| 82 | - MFX_DEVICE_NODE_RENDER + std::to_string(MFX_DEVICE_NODE_INDEX + i); | ||
| 83 | - m_dri_fd = open_intel_adapter(devPath); | ||
| 84 | - if (m_dri_fd < 0) | ||
| 85 | - continue; | ||
| 86 | - else | ||
| 87 | - break; | ||
| 88 | - } | ||
| 89 | - } | ||
| 90 | - else { | ||
| 91 | - m_dri_fd = open_intel_adapter(m_device_path); | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - if (m_dri_fd < 0) { | ||
| 95 | - printf("Failed to open dri device\n"); | ||
| 96 | - return MFX_ERR_NOT_INITIALIZED; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - m_bufmgr = drmintellib.drm_intel_bufmgr_gem_init(m_dri_fd, 4096); | ||
| 100 | - if (!m_bufmgr) { | ||
| 101 | - printf("Failed to get buffer manager\n"); | ||
| 102 | - return MFX_ERR_NOT_INITIALIZED; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | #endif | ||
| 106 | |||
| 107 | return mfx_res; | ||
| 108 | @@ -121,11 +91,6 @@ void CVAAPIDeviceX11::Close(void) { | ||
| 109 | free(m_window); | ||
| 110 | m_window = NULL; | ||
| 111 | } | ||
| 112 | - #if defined(X11_DRI3_SUPPORT) | ||
| 113 | - if (m_dri_fd) { | ||
| 114 | - close(m_dri_fd); | ||
| 115 | - } | ||
| 116 | - #endif | ||
| 117 | } | ||
| 118 | |||
| 119 | mfxStatus CVAAPIDeviceX11::Reset(void) { | ||
| 120 | @@ -208,13 +173,11 @@ mfxStatus CVAAPIDeviceX11::RenderFrame(mfxFrameSurface1* pSurface, | ||
| 121 | #else //\/ X11_DRI3_SUPPORT | ||
| 122 | Window* window = VAAPI_GET_X_WINDOW(m_window); | ||
| 123 | Window root; | ||
| 124 | - drm_intel_bo* bo = NULL; | ||
| 125 | unsigned int border, depth, stride, size, width, height; | ||
| 126 | int fd = 0, bpp = 0, x, y; | ||
| 127 | |||
| 128 | MfxLoader::Xcb_Proxy& xcblib = m_X11LibVA.GetXcbX11(); | ||
| 129 | MfxLoader::XLib_Proxy& x11lib = m_X11LibVA.GetX11(); | ||
| 130 | - MfxLoader::DrmIntel_Proxy& drmintellib = m_X11LibVA.GetDrmIntelX11(); | ||
| 131 | MfxLoader::Xcbpresent_Proxy& xcbpresentlib = m_X11LibVA.GetXcbpresentX11(); | ||
| 132 | MfxLoader::XCB_Dri3_Proxy& dri3lib = m_X11LibVA.GetXCBDri3X11(); | ||
| 133 | |||
| 134 | @@ -271,15 +234,7 @@ mfxStatus CVAAPIDeviceX11::RenderFrame(mfxFrameSurface1* pSurface, | ||
| 135 | stride = memId->m_image.pitches[0]; | ||
| 136 | size = PAGE_ALIGN(stride * height); | ||
| 137 | |||
| 138 | - bo = drmintellib.drm_intel_bo_gem_create_from_prime(m_bufmgr, | ||
| 139 | - memId->m_buffer_info.handle, | ||
| 140 | - size); | ||
| 141 | - if (!bo) { | ||
| 142 | - printf("Failed to create buffer object\n"); | ||
| 143 | - return MFX_ERR_INVALID_VIDEO_PARAM; | ||
| 144 | - } | ||
| 145 | - | ||
| 146 | - drmintellib.drm_intel_bo_gem_export_to_prime(bo, &fd); | ||
| 147 | + fd = dup(memId->m_buffer_info.handle); | ||
| 148 | if (!fd) { | ||
| 149 | printf("Invalid fd\n"); | ||
| 150 | return MFX_ERR_NOT_INITIALIZED; | ||
| 151 | @@ -332,6 +287,9 @@ mfxStatus CVAAPIDeviceX11::RenderFrame(mfxFrameSurface1* pSurface, | ||
| 152 | |||
| 153 | xcblib.xcb_free_pixmap(m_xcbconn, pixmap); | ||
| 154 | xcblib.xcb_flush(m_xcbconn); | ||
| 155 | + | ||
| 156 | + if (fd) | ||
| 157 | + close(fd); | ||
| 158 | } | ||
| 159 | |||
| 160 | return mfx_res; | ||
| 161 | diff --git a/tools/legacy/sample_common/src/vaapi_utils_x11.cpp b/tools/legacy/sample_common/src/vaapi_utils_x11.cpp | ||
| 162 | index ec44752..1e76615 100644 | ||
| 163 | --- a/tools/legacy/sample_common/src/vaapi_utils_x11.cpp | ||
| 164 | +++ b/tools/legacy/sample_common/src/vaapi_utils_x11.cpp | ||
| 165 | @@ -19,6 +19,7 @@ | ||
| 166 | |||
| 167 | const char* MFX_X11_NODE_RENDER = "/dev/dri/renderD"; | ||
| 168 | const char* MFX_X11_DRIVER_NAME = "i915"; | ||
| 169 | +const char* MFX_X11_DRIVER_XE_NAME = "xe"; | ||
| 170 | constexpr mfxU32 MFX_X11_DRIVER_NAME_LEN = 4; | ||
| 171 | constexpr mfxU32 MFX_X11_NODE_INDEX = 128; | ||
| 172 | constexpr mfxU32 MFX_X11_MAX_NODES = 16; | ||
| 173 | @@ -38,7 +39,8 @@ int open_intel_adapter(const std::string& devicePath) { | ||
| 174 | version.name = driverName; | ||
| 175 | |||
| 176 | if (!ioctl(fd, DRM_IOWR(0, drm_version), &version) && | ||
| 177 | - msdk_match(driverName, MFX_X11_DRIVER_NAME)) { | ||
| 178 | + (msdk_match(driverName, MFX_X11_DRIVER_NAME) || | ||
| 179 | + msdk_match(driverName, MFX_X11_DRIVER_XE_NAME))) { | ||
| 180 | return fd; | ||
| 181 | } | ||
| 182 | |||
| 183 | -- | ||
| 184 | 2.43.2 | ||
| 185 | |||
diff --git a/recipes-multimedia/vpl/files/0008-Fix-code-formatting.patch b/recipes-multimedia/vpl/files/0008-Fix-code-formatting.patch new file mode 100644 index 00000000..dc4a21fd --- /dev/null +++ b/recipes-multimedia/vpl/files/0008-Fix-code-formatting.patch | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | From bc6561ea9d9a6f182f6cd3dfe390088b187ac954 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: "Hoe, Sheng Yang" <sheng.yang.hoe@intel.com> | ||
| 3 | Date: Mon, 29 Jul 2024 10:15:32 +0800 | ||
| 4 | Subject: [PATCH 8/9] Fix code formatting | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/0f641e7279e8709bda5f507cf5fe3ea2849ed66a] | ||
| 7 | |||
| 8 | Signed-off-by: Hoe, Sheng Yang <sheng.yang.hoe@intel.com> | ||
| 9 | --- | ||
| 10 | tools/legacy/sample_common/include/vaapi_device.h | 2 +- | ||
| 11 | tools/legacy/sample_common/src/vaapi_device.cpp | 2 +- | ||
| 12 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/tools/legacy/sample_common/include/vaapi_device.h b/tools/legacy/sample_common/include/vaapi_device.h | ||
| 15 | index dc71659..6d46c23 100644 | ||
| 16 | --- a/tools/legacy/sample_common/include/vaapi_device.h | ||
| 17 | +++ b/tools/legacy/sample_common/include/vaapi_device.h | ||
| 18 | @@ -75,7 +75,7 @@ public: | ||
| 19 | m_nRenderWinH = 0; | ||
| 20 | m_bRenderWin = false; | ||
| 21 | #if defined(X11_DRI3_SUPPORT) | ||
| 22 | - m_xcbconn = NULL; | ||
| 23 | + m_xcbconn = NULL; | ||
| 24 | #endif | ||
| 25 | } | ||
| 26 | virtual ~CVAAPIDeviceX11(void); | ||
| 27 | diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp | ||
| 28 | index 9bf3433..d4a785f 100644 | ||
| 29 | --- a/tools/legacy/sample_common/src/vaapi_device.cpp | ||
| 30 | +++ b/tools/legacy/sample_common/src/vaapi_device.cpp | ||
| 31 | @@ -72,7 +72,7 @@ mfxStatus CVAAPIDeviceX11::Init(mfxHDL hWindow, mfxU16 nViews, mfxU32 nAdapterNu | ||
| 32 | } | ||
| 33 | } | ||
| 34 | #if defined(X11_DRI3_SUPPORT) | ||
| 35 | - MfxLoader::X11_Xcb_Proxy& x11xcblib = m_X11LibVA.GetX11XcbX11(); | ||
| 36 | + MfxLoader::X11_Xcb_Proxy& x11xcblib = m_X11LibVA.GetX11XcbX11(); | ||
| 37 | |||
| 38 | m_xcbconn = x11xcblib.XGetXCBConnection(VAAPI_GET_X_DISPLAY(m_X11LibVA.GetXDisplay())); | ||
| 39 | #endif | ||
| 40 | -- | ||
| 41 | 2.43.2 | ||
| 42 | |||
diff --git a/recipes-multimedia/vpl/libvpl-tools_1.0.0.bb b/recipes-multimedia/vpl/libvpl-tools_1.0.0.bb index b489d25d..06048031 100644 --- a/recipes-multimedia/vpl/libvpl-tools_1.0.0.bb +++ b/recipes-multimedia/vpl/libvpl-tools_1.0.0.bb | |||
| @@ -9,6 +9,14 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=c18ea6bb4786a26bf4eee88a7424a408 \ | |||
| 9 | file://third-party-programs.txt;md5=ddf05049184e74942f45b0ca4cc69b8a" | 9 | file://third-party-programs.txt;md5=ddf05049184e74942f45b0ca4cc69b8a" |
| 10 | 10 | ||
| 11 | SRC_URI = "git://github.com/intel/libvpl-tools.git;protocol=https;branch=main \ | 11 | SRC_URI = "git://github.com/intel/libvpl-tools.git;protocol=https;branch=main \ |
| 12 | file://0001-Correct-va-attrib-for-vaapiallocator.patch \ | ||
| 13 | file://0002-Enable-YUV400-JPEG-Enc-for-vaapi.patch \ | ||
| 14 | file://0003-Enable-YUV400-JPEG-Enc-for-linux-vaapi-only.patch \ | ||
| 15 | file://0004-Fix-rDRM-DMA-methods.patch \ | ||
| 16 | file://0005-Force-allocator-to-use-DRM_PRIME-for-rDRM.patch \ | ||
| 17 | file://0006-Enable-VVC-in-sample_decode.patch \ | ||
| 18 | file://0007-Fix-X11-rendering-for-xe.patch \ | ||
| 19 | file://0008-Fix-code-formatting.patch \ | ||
| 12 | " | 20 | " |
| 13 | 21 | ||
| 14 | SRCREV = "452ab253da13b57067222e8311ef143d0203d766" | 22 | SRCREV = "452ab253da13b57067222e8311ef143d0203d766" |
