summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch')
-rw-r--r--recipes-multimedia/vpl/files/0007-Fix-X11-rendering-for-xe.patch185
1 files changed, 185 insertions, 0 deletions
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 @@
1From fecf6b6cdb02c7dba3b838ee710363b57fe8e6e7 Mon Sep 17 00:00:00 2001
2From: "Hoe, Sheng Yang" <sheng.yang.hoe@intel.com>
3Date: Fri, 26 Jul 2024 23:35:25 +0800
4Subject: [PATCH 7/9] Fix X11 rendering for xe
5
6Upstream-Status: Backport [https://github.com/intel/libvpl-tools/commit/2d751730617682133bf066e61e1ca952136309bd]
7
8Signed-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
16diff --git a/tools/legacy/sample_common/include/vaapi_device.h b/tools/legacy/sample_common/include/vaapi_device.h
17index 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&);
42diff --git a/tools/legacy/sample_common/include/vaapi_utils_x11.h b/tools/legacy/sample_common/include/vaapi_utils_x11.h
43index 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
64diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp
65index 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;
161diff --git a/tools/legacy/sample_common/src/vaapi_utils_x11.cpp b/tools/legacy/sample_common/src/vaapi_utils_x11.cpp
162index 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--
1842.43.2
185