mirror of
git://git.yoctoproject.org/meta-intel.git
synced 2025-07-19 21:09:03 +02:00

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>
186 lines
6.8 KiB
Diff
186 lines
6.8 KiB
Diff
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
|
|
|