onevpl: upgrade 2021.5.0 -> 2021.6.0

New in This Release
===================

* Updated dispatcher and CPU runtime to API 2.5
* Internal memory support added to dpcpp-blur sample

Release notes:
https://github.com/oneapi-src/oneVPL/releases/tag/v2021.6.0

Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
This commit is contained in:
Yew, Chang Ching 2021-10-11 09:41:21 +08:00 committed by Anuj Mittal
parent cd0ba51efd
commit aa4e49f126
6 changed files with 41 additions and 394 deletions

View File

@ -0,0 +1,37 @@
From d16afe9f9302e4995f12d699019eba170bb6db21 Mon Sep 17 00:00:00 2001
From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
Date: Fri, 8 Oct 2021 08:45:39 +0800
Subject: [PATCH] Fix basename() build issue with musl_libc
Upstream-Status: Submitted
innersource PR #264
Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
---
tools/legacy/sample_common/src/vaapi_utils.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/legacy/sample_common/src/vaapi_utils.cpp b/tools/legacy/sample_common/src/vaapi_utils.cpp
index b69dbe44..9382535a 100644
--- a/tools/legacy/sample_common/src/vaapi_utils.cpp
+++ b/tools/legacy/sample_common/src/vaapi_utils.cpp
@@ -7,6 +7,7 @@
#ifdef LIBVA_SUPPORT
#include "vaapi_utils.h"
+ #include <libgen.h>
#include <dlfcn.h>
#include <stdexcept>
@@ -26,7 +27,7 @@ SimpleLoader::SimpleLoader(const char* name) {
dlerror();
so_handle = dlopen(name, RTLD_GLOBAL | RTLD_NOW);
if (NULL == so_handle) {
- so_handle = dlopen(basename(name), RTLD_GLOBAL | RTLD_NOW);
+ so_handle = dlopen(basename((char *)name), RTLD_GLOBAL | RTLD_NOW);
if (NULL == so_handle) {
std::cerr << dlerror() << std::endl;
throw std::runtime_error("Can't load library");
--
2.33.0

View File

@ -1,31 +0,0 @@
From f6af035d8cfee4a40a5d02349bf111c3af25432e Mon Sep 17 00:00:00 2001
From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
Date: Thu, 12 Aug 2021 07:33:39 +0800
Subject: [PATCH] Fix compile issue with CMAKE_CXX_FLAGS setting
Appends new options to CMAKE_CXX_FLAGS
Upstream-Status: Submitted
innersource PR #193
Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
---
cmake/CompileOptions.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake
index 2a941b10..97c3f47a 100644
--- a/cmake/CompileOptions.cmake
+++ b/cmake/CompileOptions.cmake
@@ -50,7 +50,7 @@ else()
add_compile_options("-fstack-protector-strong")
endif()
if(NOT MINGW)
- set(CMAKE_CXX_FLAGS "-z relro -z now -z noexecstack")
+ set(CMAKE_CXX_FLAGS "-z relro -z now -z noexecstack ${CMAKE_CXX_FLAGS}")
endif()
add_compile_options("-Wall")
if(ENABLE_WARNING_AS_ERROR)
--
2.32.0

View File

@ -1,135 +0,0 @@
From 775669dbdd97a52dc32dab82c3d5efd160f9e807 Mon Sep 17 00:00:00 2001
From: "Chew, Tong Liang" <tong.liang.chew@intel.com>
Date: Mon, 9 Aug 2021 02:19:01 +0000
Subject: [PATCH] Fix the rendering to X11 failures
The i915 render device node is not always in renderD128.
Change the hard coded with autodetect the i915 device via ioctl
Upstream-Status: Submitted
https://github.com/oneapi-src/oneVPL/pull/21
Signed-off-by: Chew, Tong Liang <tong.liang.chew@intel.com>
Signed-off-by: Teng, Jin Chung <jin.chung.teng@intel.com>
---
tools/legacy/sample_common/src/vaapi_device.cpp | 24 +++++++++++++-
tools/legacy/sample_common/src/vaapi_utils_x11.cpp | 38 +++++++++++++++++++---
2 files changed, 57 insertions(+), 5 deletions(-)
diff --git a/tools/legacy/sample_common/src/vaapi_device.cpp b/tools/legacy/sample_common/src/vaapi_device.cpp
index b034376..f78c5aa 100644
--- a/tools/legacy/sample_common/src/vaapi_device.cpp
+++ b/tools/legacy/sample_common/src/vaapi_device.cpp
@@ -20,6 +20,7 @@
#include "vaapi_allocator.h"
#if defined(X11_DRI3_SUPPORT)
#include <fcntl.h>
+ #include <sys/ioctl.h>
#define ALIGN(x, y) (((x) + (y)-1) & -(y))
#define PAGE_ALIGN(x) ALIGN(x, 4096)
@@ -27,6 +28,11 @@
#define VAAPI_GET_X_DISPLAY(_display) (Display*)(_display)
#define VAAPI_GET_X_WINDOW(_window) (Window*)(_window)
+ const char* MFX_DEVICE_NODE_RENDER = "/dev/dri/renderD";
+ const char* MFX_DEVICE_DRIVER_NAME = "i915";
+ constexpr mfxU32 MFX_DEVICE_DRIVER_NAME_LEN = 4;
+ constexpr mfxU32 MFX_DEVICE_NODE_INDEX = 128;
+ constexpr mfxU32 MFX_DEVICE_MAX_NODES = 16;
CVAAPIDeviceX11::~CVAAPIDeviceX11(void) {
Close();
@@ -73,7 +79,23 @@ mfxStatus CVAAPIDeviceX11::Init(mfxHDL hWindow, mfxU16 nViews, mfxU32 nAdapterNu
// it's enough to pass render node, because we only request
// information from kernel via m_dri_fd
- m_dri_fd = open("/dev/dri/renderD128", O_RDWR);
+ 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(devPath.c_str(), O_RDWR);
+ if (m_dri_fd < 0) continue;
+
+ char driverName[MFX_DEVICE_DRIVER_NAME_LEN + 1] = {};
+ drm_version_t version = {};
+ version.name_len = MFX_DEVICE_DRIVER_NAME_LEN;
+ version.name = driverName;
+
+ if(!ioctl(m_dri_fd, DRM_IOWR(0, drm_version), &version) &&
+ !strcmp(driverName, MFX_DEVICE_DRIVER_NAME)) {
+ break;
+ }
+ close(m_dri_fd);
+ }
+
if (m_dri_fd < 0) {
msdk_printf(MSDK_STRING("Failed to open dri device\n"));
return MFX_ERR_NOT_INITIALIZED;
diff --git a/tools/legacy/sample_common/src/vaapi_utils_x11.cpp b/tools/legacy/sample_common/src/vaapi_utils_x11.cpp
index 9770a2f..734cd10 100644
--- a/tools/legacy/sample_common/src/vaapi_utils_x11.cpp
+++ b/tools/legacy/sample_common/src/vaapi_utils_x11.cpp
@@ -10,18 +10,24 @@
#include "sample_defs.h"
#include <dlfcn.h>
- #if defined(X11_DRI3_SUPPORT)
- #include <fcntl.h>
- #endif
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
#define VAAPI_X_DEFAULT_DISPLAY ":0.0"
+ const char* MFX_X11_NODE_RENDER = "/dev/dri/renderD";
+ const char* MFX_X11_DRIVER_NAME = "i915";
+ constexpr mfxU32 MFX_X11_DRIVER_NAME_LEN = 4;
+ constexpr mfxU32 MFX_X11_NODE_INDEX = 128;
+ constexpr mfxU32 MFX_X11_MAX_NODES = 16;
+
X11LibVA::X11LibVA(void)
: CLibVA(MFX_LIBVA_X11),
m_display(0),
m_configID(VA_INVALID_ID),
m_contextID(VA_INVALID_ID) {
char* currentDisplay = getenv("DISPLAY");
+ int fd = -1;
m_display = (currentDisplay) ? m_x11lib.XOpenDisplay(currentDisplay)
: m_x11lib.XOpenDisplay(VAAPI_X_DEFAULT_DISPLAY);
@@ -32,7 +38,31 @@ X11LibVA::X11LibVA(void)
throw std::bad_alloc();
}
- m_va_dpy = m_vax11lib.vaGetDisplay(m_display);
+ for (mfxU32 i = 0; i < MFX_X11_MAX_NODES; ++i) {
+ std::string devPath = MFX_X11_NODE_RENDER + std::to_string(MFX_X11_NODE_INDEX + i);
+ fd = -1;
+ fd = open(devPath.c_str(), O_RDWR);
+ if (fd < 0) continue;
+
+ char driverName[MFX_X11_DRIVER_NAME_LEN + 1] = {};
+ drm_version_t version = {};
+ version.name_len = MFX_X11_DRIVER_NAME_LEN;
+ version.name = driverName;
+
+ if(!ioctl(fd, DRM_IOWR(0, drm_version), &version) &&
+ !strcmp(driverName, MFX_X11_DRIVER_NAME)) {
+ break;
+ }
+ close(fd);
+ }
+
+ if (fd < 0) {
+ m_x11lib.XCloseDisplay(m_display);
+ msdk_printf(MSDK_STRING("Failed to open adapter\n"));
+ throw std::bad_alloc();
+ }
+
+ m_va_dpy = m_vadrmlib.vaGetDisplayDRM(fd);
if (!m_va_dpy) {
m_x11lib.XCloseDisplay(m_display);
msdk_printf(MSDK_STRING("Failed to get VA Display\n"));
--
2.7.4

View File

@ -1,170 +0,0 @@
From a7f667debb6cf3007ef5b581a91ff7c925d623c3 Mon Sep 17 00:00:00 2001
From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
Date: Wed, 25 Aug 2021 11:13:28 +0000
Subject: [PATCH 1/2] samples: Add support of DRM_FORMAT_NV12 for console mode
rendering
Currently in drm/console mode only RGB4 direct rendering
is possible. This patch add NV12 format provided your
platform and kernel can support it.
Tested both formats using:
sample_encode h265 -i 4k.h265 -rdrm -nv12
sample_encode h265 -i 4k.h265 -rdrm -rgb4
Upstream-Status: Submitted
innersource PR #221
Signed-off: Fu, Wei A <wei.a.fu@intel.com>
Signed-off-by: Sodhi, Vunny <vunny.sodhi@intel.com>
Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
---
.../sample_common/include/vaapi_utils.h | 11 ++++
.../sample_common/src/vaapi_allocator.cpp | 1 +
.../legacy/sample_common/src/vaapi_utils.cpp | 1 +
.../sample_common/src/vaapi_utils_drm.cpp | 61 +++++++++++++++----
4 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/tools/legacy/sample_common/include/vaapi_utils.h b/tools/legacy/sample_common/include/vaapi_utils.h
index 53318630..9df5507b 100644
--- a/tools/legacy/sample_common/include/vaapi_utils.h
+++ b/tools/legacy/sample_common/include/vaapi_utils.h
@@ -149,6 +149,16 @@ public:
uint32_t pitch,
uint32_t bo_handle,
uint32_t* buf_id);
+ typedef int (*drmModeAddFB2WithModifiers_type)(int fd,
+ uint32_t width,
+ uint32_t height,
+ uint32_t pixel_format,
+ uint32_t bo_handles[4],
+ uint32_t pitches[4],
+ uint32_t offsets[4],
+ uint64_t modifier[4],
+ uint32_t* buf_id,
+ uint32_t flags);
typedef void (*drmModeFreeConnector_type)(drmModeConnectorPtr ptr);
typedef void (*drmModeFreeCrtc_type)(drmModeCrtcPtr ptr);
typedef void (*drmModeFreeEncoder_type)(drmModeEncoderPtr ptr);
@@ -192,6 +202,7 @@ public:
#define __DECLARE(name) const name##_type name
__DECLARE(drmIoctl);
__DECLARE(drmModeAddFB);
+ __DECLARE(drmModeAddFB2WithModifiers);
__DECLARE(drmModeFreeConnector);
__DECLARE(drmModeFreeCrtc);
__DECLARE(drmModeFreeEncoder);
diff --git a/tools/legacy/sample_common/src/vaapi_allocator.cpp b/tools/legacy/sample_common/src/vaapi_allocator.cpp
index 51690186..12ace297 100644
--- a/tools/legacy/sample_common/src/vaapi_allocator.cpp
+++ b/tools/legacy/sample_common/src/vaapi_allocator.cpp
@@ -364,6 +364,7 @@ mfxStatus vaapiFrameAllocator::AllocImpl(mfxFrameAllocRequest* request,
}
}
if (m_exporter) {
+ vaapi_mids[i].m_fourcc = va_fourcc;
vaapi_mids[i].m_custom = m_exporter->acquire(&vaapi_mids[i]);
if (!vaapi_mids[i].m_custom) {
mfx_res = MFX_ERR_UNKNOWN;
diff --git a/tools/legacy/sample_common/src/vaapi_utils.cpp b/tools/legacy/sample_common/src/vaapi_utils.cpp
index b69dbe44..9531c65b 100644
--- a/tools/legacy/sample_common/src/vaapi_utils.cpp
+++ b/tools/legacy/sample_common/src/vaapi_utils.cpp
@@ -94,6 +94,7 @@ DRM_Proxy::DRM_Proxy()
: lib("libdrm.so.2"),
SIMPLE_LOADER_FUNCTION(drmIoctl),
SIMPLE_LOADER_FUNCTION(drmModeAddFB),
+ SIMPLE_LOADER_FUNCTION(drmModeAddFB2WithModifiers),
SIMPLE_LOADER_FUNCTION(drmModeFreeConnector),
SIMPLE_LOADER_FUNCTION(drmModeFreeCrtc),
SIMPLE_LOADER_FUNCTION(drmModeFreeEncoder),
diff --git a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
index c896017b..cf8d7ba7 100644
--- a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
+++ b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
@@ -11,9 +11,9 @@
#include <sys/ioctl.h>
#include "vaapi_allocator.h"
- #include <stdexcept>
-
#include <drm_fourcc.h>
+ #include <stdexcept>
+ #include "i915_drm.h"
#include "vaapi_utils_drm.h"
constexpr mfxU32 MFX_DRI_MAX_NODES_NUM = 16;
@@ -311,7 +311,8 @@ bool drmRenderer::getPlane() {
if (plane) {
if (plane->possible_crtcs & (1 << m_crtcIndex)) {
for (uint32_t j = 0; j < plane->count_formats; ++j) {
- if (plane->formats[j] == DRM_FORMAT_XRGB8888) {
+ if ((plane->formats[j] == DRM_FORMAT_XRGB8888) ||
+ (plane->formats[j] == DRM_FORMAT_NV12)) {
m_planeID = plane->plane_id;
m_drmlib.drmModeFreePlane(plane);
m_drmlib.drmModeFreePlaneResources(planes);
@@ -404,14 +405,52 @@ void* drmRenderer::acquire(mfxMemId mid) {
if (ret)
return NULL;
- ret = m_drmlib.drmModeAddFB(m_fd,
- vmid->m_image.width,
- vmid->m_image.height,
- 24,
- 32,
- vmid->m_image.pitches[0],
- flink_open.handle,
- &fbhandle);
+ uint32_t handles[4], pitches[4], offsets[4], pixel_format;
+ 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];
+
+ if (VA_FOURCC_NV12 == vmid->m_fourcc) {
+ struct drm_i915_gem_set_tiling set_tiling;
+
+ pixel_format = DRM_FORMAT_NV12;
+ 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) {
+ msdk_printf(MSDK_STRING("DRM_IOCTL_I915_GEM_SET_TILING Failed ret = %d\n"), ret);
+ return NULL;
+ }
+
+ 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;
+ }
+ else {
+ pixel_format = DRM_FORMAT_XRGB8888;
+ }
+
+ ret = m_drmlib.drmModeAddFB2WithModifiers(m_fd,
+ vmid->m_image.width,
+ vmid->m_image.height,
+ pixel_format,
+ handles,
+ pitches,
+ offsets,
+ modifiers,
+ &fbhandle,
+ 0);
+
if (ret)
return NULL;
--
2.31.1

View File

@ -1,51 +0,0 @@
From 15cc366b66b625b0b2613a4365e7777563325a94 Mon Sep 17 00:00:00 2001
From: "Yew, Chang Ching" <chang.ching.yew@intel.com>
Date: Wed, 25 Aug 2021 11:20:30 +0000
Subject: [PATCH 2/2] samples: Fixed tile modifier issue for NV12 format
If we are using I915_FORMAT_MOD_Y_TILED which is needed for
NV12 format then modifiers need to be enabled which can be passed
as flags argument to ioctl.
Upstream-Status: Submitted
innersource PR #221
Signed-off-by: Sodhi, Vunny <vunny.sodhi@intel.com>
Signed-off-by: Yew, Chang Ching <chang.ching.yew@intel.com>
---
tools/legacy/sample_common/src/vaapi_utils_drm.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
index cf8d7ba7..3df3bb8a 100644
--- a/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
+++ b/tools/legacy/sample_common/src/vaapi_utils_drm.cpp
@@ -405,7 +405,7 @@ void* drmRenderer::acquire(mfxMemId mid) {
if (ret)
return NULL;
- uint32_t handles[4], pitches[4], offsets[4], pixel_format;
+ uint32_t handles[4], pitches[4], offsets[4], pixel_format, flags = 0;
uint64_t modifiers[4];
memset(&handles, 0, sizeof(handles));
@@ -435,6 +435,7 @@ void* drmRenderer::acquire(mfxMemId mid) {
pitches[1] = vmid->m_image.pitches[1];
offsets[1] = vmid->m_image.offsets[1];
modifiers[0] = modifiers[1] = I915_FORMAT_MOD_Y_TILED;
+ flags = 2; // DRM_MODE_FB_MODIFIERS (1<<1) /* enables ->modifer[]
}
else {
pixel_format = DRM_FORMAT_XRGB8888;
@@ -449,7 +450,7 @@ void* drmRenderer::acquire(mfxMemId mid) {
offsets,
modifiers,
&fbhandle,
- 0);
+ flags);
if (ret)
return NULL;
--
2.31.1

View File

@ -6,15 +6,12 @@ that works across a wide range of accelerators."
HOMEPAGE = "https://github.com/oneapi-src/oneVPL"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=c18ea6bb4786a26bf4eee88a7424a408 \
file://third-party-programs.txt;md5=52d2c0c51bb5c0d9d9c16ae91d66c8fb"
file://third-party-programs.txt;md5=67727fd253b1b4574cd9eea78a2b0620"
SRC_URI = "git://github.com/oneapi-src/oneVPL.git;protocol=https \
file://0001-Fix-the-rendering-to-X11-failures.patch \
file://0001-Fix-compile-issue-with-CMAKE_CXX_FLAGS-setting.patch \
file://0001-samples-Add-support-of-DRM_FORMAT_NV12-for-console-m.patch \
file://0001-samples-Fixed-tile-modifier-issue-for-NV12-format.patch \
file://0001-Fix-basename-build-issue-with-musl_libc.patch \
"
SRCREV = "dde640ef0872b645d6e0275a6aaec26c01a9c0b9"
SRCREV = "cdf7444dc971544d148c51e0d93a2df1bb55dda7"
S = "${WORKDIR}/git"
inherit cmake
@ -36,5 +33,5 @@ FILES_SOLIBSDEV = ""
FILES:${PN}-dev += "${libdir}/libvpl.so"
FILES:${PN} += "${datadir} \
${libdir}/libvpl_wayland.so \
${libdir}/oneVPL/libvpl_wayland.so \
"