diff options
author | Lim Siew Hoon <siew.hoon.lim@intel.com> | 2021-10-25 10:23:00 +0800 |
---|---|---|
committer | Anuj Mittal <anuj.mittal@intel.com> | 2021-10-25 22:02:00 +0800 |
commit | 82a05e9558a7cd2981d2dec2094a86f83bff1377 (patch) | |
tree | fa98ac52863be386179592450cef47c1a2f8c3d9 /recipes-multimedia/mediasdk/files/0001-Add-support-of-DRM_FORMAT_NV12-for-console-mode-rend.patch | |
parent | c386c9cdcc9cb085d955c7e4f7258d70894c1710 (diff) | |
download | meta-intel-82a05e9558a7cd2981d2dec2094a86f83bff1377.tar.gz |
intel-mediasdk: upgrade 21.2.3 -> 21.3.5
Drops patches already merged:
* 0001-Add-support-of-DRM_FORMAT_NV12-for-console-mode-rend.patch
* 0001-Fixed-tile-modifier-issue-for-NV12-format.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/mediasdk/files/0001-Add-support-of-DRM_FORMAT_NV12-for-console-mode-rend.patch')
-rw-r--r-- | recipes-multimedia/mediasdk/files/0001-Add-support-of-DRM_FORMAT_NV12-for-console-mode-rend.patch | 146 |
1 files changed, 0 insertions, 146 deletions
diff --git a/recipes-multimedia/mediasdk/files/0001-Add-support-of-DRM_FORMAT_NV12-for-console-mode-rend.patch b/recipes-multimedia/mediasdk/files/0001-Add-support-of-DRM_FORMAT_NV12-for-console-mode-rend.patch deleted file mode 100644 index 4b3c650e..00000000 --- a/recipes-multimedia/mediasdk/files/0001-Add-support-of-DRM_FORMAT_NV12-for-console-mode-rend.patch +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | From a1216ce48771a2c7cf690d148d64c2797a960720 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Sodhi, Vunny" <vunny.sodhi@intel.com> | ||
3 | Date: Fri, 28 May 2021 11:40:21 +0800 | ||
4 | Subject: [meta-intel][PATCH] Add support of DRM_FORMAT_NV12 for console mode rendering | ||
5 | |||
6 | Currently in drm/console mode only RGB4 direct rendering | ||
7 | is possible. This patch add NV12 format provided your | ||
8 | platform and kernel can support it. | ||
9 | |||
10 | Tested both formats using: | ||
11 | sample_encode h265 -i 4k.h265 -rdrm -nv12 | ||
12 | sample_encode h265 -i 4k.h265 -rdrm -rgb4 | ||
13 | |||
14 | Issue: #2675 | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | https://github.com/Intel-Media-SDK/MediaSDK/pull/2704 | ||
18 | |||
19 | Signed-off: Fu, Wei A <wei.a.fu@intel.com> | ||
20 | Signed-off-by: Sodhi, Vunny <vunny.sodhi@intel.com> | ||
21 | --- | ||
22 | samples/sample_common/include/vaapi_utils.h | 4 +++ | ||
23 | samples/sample_common/src/vaapi_allocator.cpp | 1 + | ||
24 | samples/sample_common/src/vaapi_utils.cpp | 1 + | ||
25 | samples/sample_common/src/vaapi_utils_drm.cpp | 45 ++++++++++++++++++++++++--- | ||
26 | 4 files changed, 46 insertions(+), 5 deletions(-) | ||
27 | |||
28 | diff --git a/samples/sample_common/include/vaapi_utils.h b/samples/sample_common/include/vaapi_utils.h | ||
29 | index 49589c6..39f77b9 100644 | ||
30 | --- a/samples/sample_common/include/vaapi_utils.h | ||
31 | +++ b/samples/sample_common/include/vaapi_utils.h | ||
32 | @@ -154,6 +154,9 @@ namespace MfxLoader | ||
33 | int fd, uint32_t width, uint32_t height, uint8_t depth, | ||
34 | uint8_t bpp, uint32_t pitch, uint32_t bo_handle, | ||
35 | uint32_t *buf_id); | ||
36 | + typedef int (*drmModeAddFB2WithModifiers_type)(int fd, uint32_t width, uint32_t height, uint32_t pixel_format, | ||
37 | + uint32_t bo_handles[4], uint32_t pitches[4], uint32_t offsets[4], uint64_t modifier[4], | ||
38 | + uint32_t *buf_id, uint32_t flags); | ||
39 | typedef void (*drmModeFreeConnector_type)( drmModeConnectorPtr ptr ); | ||
40 | typedef void (*drmModeFreeCrtc_type)( drmModeCrtcPtr ptr ); | ||
41 | typedef void (*drmModeFreeEncoder_type)( drmModeEncoderPtr ptr ); | ||
42 | @@ -188,6 +191,7 @@ namespace MfxLoader | ||
43 | #define __DECLARE(name) const name ## _type name | ||
44 | __DECLARE(drmIoctl); | ||
45 | __DECLARE(drmModeAddFB); | ||
46 | + __DECLARE(drmModeAddFB2WithModifiers); | ||
47 | __DECLARE(drmModeFreeConnector); | ||
48 | __DECLARE(drmModeFreeCrtc); | ||
49 | __DECLARE(drmModeFreeEncoder); | ||
50 | diff --git a/samples/sample_common/src/vaapi_allocator.cpp b/samples/sample_common/src/vaapi_allocator.cpp | ||
51 | index bf20b0d..442eca0 100644 | ||
52 | --- a/samples/sample_common/src/vaapi_allocator.cpp | ||
53 | +++ b/samples/sample_common/src/vaapi_allocator.cpp | ||
54 | @@ -408,6 +408,7 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest *request, mfxFrame | ||
55 | } | ||
56 | } | ||
57 | if (m_exporter) { | ||
58 | + vaapi_mids[i].m_fourcc = va_fourcc; | ||
59 | vaapi_mids[i].m_custom = m_exporter->acquire(&vaapi_mids[i]); | ||
60 | if (!vaapi_mids[i].m_custom) { | ||
61 | mfx_res = MFX_ERR_UNKNOWN; | ||
62 | diff --git a/samples/sample_common/src/vaapi_utils.cpp b/samples/sample_common/src/vaapi_utils.cpp | ||
63 | index 680c5c3..83ba46c 100644 | ||
64 | --- a/samples/sample_common/src/vaapi_utils.cpp | ||
65 | +++ b/samples/sample_common/src/vaapi_utils.cpp | ||
66 | @@ -111,6 +111,7 @@ DRM_Proxy::DRM_Proxy() | ||
67 | : lib("libdrm.so.2") | ||
68 | , SIMPLE_LOADER_FUNCTION(drmIoctl) | ||
69 | , SIMPLE_LOADER_FUNCTION(drmModeAddFB) | ||
70 | + , SIMPLE_LOADER_FUNCTION(drmModeAddFB2WithModifiers) | ||
71 | , SIMPLE_LOADER_FUNCTION(drmModeFreeConnector) | ||
72 | , SIMPLE_LOADER_FUNCTION(drmModeFreeCrtc) | ||
73 | , SIMPLE_LOADER_FUNCTION(drmModeFreeEncoder) | ||
74 | diff --git a/samples/sample_common/src/vaapi_utils_drm.cpp b/samples/sample_common/src/vaapi_utils_drm.cpp | ||
75 | index 9663245..5ad73dd 100644 | ||
76 | --- a/samples/sample_common/src/vaapi_utils_drm.cpp | ||
77 | +++ b/samples/sample_common/src/vaapi_utils_drm.cpp | ||
78 | @@ -28,6 +28,7 @@ or https://software.intel.com/en-us/media-client-solutions-support. | ||
79 | |||
80 | #include "vaapi_utils_drm.h" | ||
81 | #include <drm_fourcc.h> | ||
82 | +#include "i915_drm.h" | ||
83 | |||
84 | constexpr mfxU32 MFX_DRI_MAX_NODES_NUM = 16; | ||
85 | constexpr mfxU32 MFX_DRI_RENDER_START_INDEX = 128; | ||
86 | @@ -343,7 +344,8 @@ bool drmRenderer::getPlane() | ||
87 | if (plane) { | ||
88 | if (plane->possible_crtcs & (1 << m_crtcIndex)) { | ||
89 | for (uint32_t j = 0; j < plane->count_formats; ++j) { | ||
90 | - if (plane->formats[j] == DRM_FORMAT_XRGB8888) { | ||
91 | + if ((plane->formats[j] == DRM_FORMAT_XRGB8888) | ||
92 | + || (plane->formats[j] == DRM_FORMAT_NV12)) { | ||
93 | m_planeID = plane->plane_id; | ||
94 | m_drmlib.drmModeFreePlane(plane); | ||
95 | m_drmlib.drmModeFreePlaneResources(planes); | ||
96 | @@ -420,10 +422,43 @@ void* drmRenderer::acquire(mfxMemId mid) | ||
97 | int ret = m_drmlib.drmIoctl(m_fd, DRM_IOCTL_GEM_OPEN, &flink_open); | ||
98 | if (ret) return NULL; | ||
99 | |||
100 | - ret = m_drmlib.drmModeAddFB(m_fd, | ||
101 | - vmid->m_image.width, vmid->m_image.height, | ||
102 | - 24, 32, vmid->m_image.pitches[0], | ||
103 | - flink_open.handle, &fbhandle); | ||
104 | + uint32_t handles[4], pitches[4], offsets[4], pixel_format; | ||
105 | + uint64_t modifiers[4]; | ||
106 | + | ||
107 | + memset(&handles, 0, sizeof(handles)); | ||
108 | + memset(&pitches, 0, sizeof(pitches)); | ||
109 | + memset(&offsets, 0, sizeof(offsets)); | ||
110 | + memset(&modifiers, 0, sizeof(modifiers)); | ||
111 | + | ||
112 | + handles[0] = flink_open.handle; | ||
113 | + pitches[0] = vmid->m_image.pitches[0]; | ||
114 | + offsets[0] = vmid->m_image.offsets[0]; | ||
115 | + | ||
116 | + if (VA_FOURCC_NV12 == vmid->m_fourcc) { | ||
117 | + struct drm_i915_gem_set_tiling set_tiling; | ||
118 | + | ||
119 | + pixel_format = DRM_FORMAT_NV12; | ||
120 | + memset(&set_tiling, 0, sizeof(set_tiling)); | ||
121 | + set_tiling.handle = flink_open.handle; | ||
122 | + set_tiling.tiling_mode = I915_TILING_Y; | ||
123 | + set_tiling.stride = vmid->m_image.pitches[0]; | ||
124 | + ret = m_drmlib.drmIoctl(m_fd, DRM_IOCTL_I915_GEM_SET_TILING, &set_tiling); | ||
125 | + if (ret) { | ||
126 | + msdk_printf(MSDK_STRING("DRM_IOCTL_I915_GEM_SET_TILING Failed ret = %d\n"),ret); | ||
127 | + return NULL; | ||
128 | + } | ||
129 | + | ||
130 | + handles[1] = flink_open.handle; | ||
131 | + pitches[1] = vmid->m_image.pitches[1]; | ||
132 | + offsets[1] = vmid->m_image.offsets[1]; | ||
133 | + modifiers[0] = modifiers[1] = I915_FORMAT_MOD_Y_TILED; | ||
134 | + } | ||
135 | + else { | ||
136 | + pixel_format = DRM_FORMAT_XRGB8888; | ||
137 | + } | ||
138 | + | ||
139 | + ret = m_drmlib.drmModeAddFB2WithModifiers(m_fd, vmid->m_image.width, vmid->m_image.height, | ||
140 | + pixel_format, handles, pitches, offsets, modifiers, &fbhandle, 0); | ||
141 | if (ret) return NULL; | ||
142 | |||
143 | MSDK_ZERO_MEMORY(flink_close); | ||
144 | -- | ||
145 | 2.7.4 | ||
146 | |||