git: 222372fc400a - main - multimedia/onevpl: add new port

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Mon, 15 Nov 2021 12:42:46 UTC
The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=222372fc400a7a391beecd86f183ef9222ae39f2

commit 222372fc400a7a391beecd86f183ef9222ae39f2
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2021-09-13 22:51:02 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2021-11-15 12:41:14 +0000

    multimedia/onevpl: add new port
    
    The oneAPI Video Processing Library (oneVPL) provides a single video
    processing API for encode, decode, and video processing that works
    across a wide range of accelerators.
    
    This package contains the following components of oneVPL:
    
    - Copies of the oneVPL Specification API header files
    - oneVPL dispatcher
    - Examples demonstrating API usage
    - oneVPL command line tools
    
    https://www.intel.com/content/www/us/en/developer/tools/oneapi/onevpl.html
---
 multimedia/Makefile                        |   1 +
 multimedia/onevpl/Makefile                 |  44 ++++
 multimedia/onevpl/distinfo                 |   3 +
 multimedia/onevpl/files/patch-basename     |  22 ++
 multimedia/onevpl/files/patch-drm-to-pciid |  82 ++++++++
 multimedia/onevpl/files/patch-include      |  16 ++
 multimedia/onevpl/files/patch-private-libs |  13 ++
 multimedia/onevpl/files/patch-sched        |  33 +++
 multimedia/onevpl/files/patch-unix         | 320 +++++++++++++++++++++++++++++
 multimedia/onevpl/pkg-descr                |  12 ++
 multimedia/onevpl/pkg-plist                | 142 +++++++++++++
 11 files changed, 688 insertions(+)

diff --git a/multimedia/Makefile b/multimedia/Makefile
index 4dc1fa6afa69..470bf54880ed 100644
--- a/multimedia/Makefile
+++ b/multimedia/Makefile
@@ -287,6 +287,7 @@
     SUBDIR += ogmtools
     SUBDIR += olive
     SUBDIR += omxplayer
+    SUBDIR += onevpl
     SUBDIR += openh264
     SUBDIR += openshot
     SUBDIR += opentoonz
diff --git a/multimedia/onevpl/Makefile b/multimedia/onevpl/Makefile
new file mode 100644
index 000000000000..f390a2b5aa1f
--- /dev/null
+++ b/multimedia/onevpl/Makefile
@@ -0,0 +1,44 @@
+PORTNAME=	oneVPL
+DISTVERSIONPREFIX=	v
+DISTVERSION=	2021.6.0
+CATEGORIES=	multimedia
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	oneAPI Video Processing Library dispatcher, tools, and examples
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+ONLY_FOR_ARCHS=	amd64
+ONLY_FOR_ARCHS_REASON=	only Intel GPUs on x86 are supported
+
+LIB_DEPENDS=	libdrm.so:graphics/libdrm \
+		libwayland-client.so:graphics/wayland \
+		libva.so:multimedia/libva
+
+USES=		cmake:testing compiler:c++17-lang localbase:ldflags pkgconfig
+USE_GITHUB=	yes
+USE_LDCONFIG=	yes
+GH_ACCOUNT=	oneapi-src
+CMAKE_TESTING_ON=	BUILD_TESTS
+
+OPTIONS_DEFINE=	PYTHON
+OPTIONS_DEFAULT=PYTHON
+OPTIONS_SUB=	yes
+
+PYTHON_USES=		python
+PYTHON_BUILD_DEPENDS=	pybind11>0:devel/pybind11
+PYTHON_CMAKE_BOOL=	BUILD_PYTHON_BINDING
+
+post-patch:
+	@${REINPLACE_CMD} -e '/pkgconfig/s,FULL_LIBDIR},PREFIX}/libdata,' \
+		${WRKSRC}/dispatcher/CMakeLists.txt
+	@${REINPLACE_CMD} -e 's,/usr,${PREFIX},' \
+		${WRKSRC}/dispatcher/vpl/mfx_dispatcher_vpl_loader.cpp
+	@${REINPLACE_CMD} -e '/PKG_CONFIG/s,_lib,_prefix/libdata,' \
+		${WRKSRC}/modulefiles/vpl
+
+post-install:
+	@${FIND} ${STAGEDIR} -name \*.orig -delete
+
+.include <bsd.port.mk>
diff --git a/multimedia/onevpl/distinfo b/multimedia/onevpl/distinfo
new file mode 100644
index 000000000000..7a88bb23c4ea
--- /dev/null
+++ b/multimedia/onevpl/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1631573462
+SHA256 (oneapi-src-oneVPL-v2021.6.0_GH0.tar.gz) = c83590c4b0d12c4a48f4cbf4b6e8d595bf1f6f96bb262d21457793d19f7b2b6a
+SIZE (oneapi-src-oneVPL-v2021.6.0_GH0.tar.gz) = 3034593
diff --git a/multimedia/onevpl/files/patch-basename b/multimedia/onevpl/files/patch-basename
new file mode 100644
index 000000000000..e0c6ae560c26
--- /dev/null
+++ b/multimedia/onevpl/files/patch-basename
@@ -0,0 +1,22 @@
+POSIX basename allows modifying the argument, so make a local copy
+
+tools/legacy/sample_common/src/vaapi_utils.cpp:30:28: error: no matching function for call to 'basename'
+        so_handle = dlopen(basename(name), RTLD_GLOBAL | RTLD_NOW);
+                           ^~~~~~~~
+/usr/include/libgen.h:39:7: note: candidate function not viable: 1st argument ('const char *') would lose const qualifier
+char    *basename(char *);
+         ^
+
+--- tools/legacy/sample_common/src/vaapi_utils.cpp.orig	2021-09-13 22:51:02 UTC
++++ tools/legacy/sample_common/src/vaapi_utils.cpp
+@@ -26,7 +26,9 @@ 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);
++        char dlname[PATH_MAX + 1];
++        strncpy(dlname, name, sizeof(dlname));
++        so_handle = dlopen(basename(dlname), RTLD_GLOBAL | RTLD_NOW);
+         if (NULL == so_handle) {
+             std::cerr << dlerror() << std::endl;
+             throw std::runtime_error("Can't load library");
diff --git a/multimedia/onevpl/files/patch-drm-to-pciid b/multimedia/onevpl/files/patch-drm-to-pciid
new file mode 100644
index 000000000000..a33d8e31f37b
--- /dev/null
+++ b/multimedia/onevpl/files/patch-drm-to-pciid
@@ -0,0 +1,82 @@
+/sys/class/drm/renderD*/device/device is Linux-only, so use a BSD extension
+to get vendor/device identifiers from rendor nodes. Based on libdrm code.
+
+$ ffmpeg -hide_banner -init_hw_device qsv=auto -i foo.y4m -vf hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -y foo.mkv
+[AVHWDeviceContext @ 0x8062d0140] Error initializing an MFX session: -3.
+Device creation failed: -1313558101.
+Failed to set value 'qsv=auto' for option 'init_hw_device': Unknown error occurred
+Error parsing global options: Unknown error occurred
+
+--- dispatcher/linux/device_ids.h.orig	2021-09-13 22:51:02 UTC
++++ dispatcher/linux/device_ids.h
+@@ -420,7 +420,62 @@ static inline eMFXHWType get_platform(unsigned int dev
+     return MFX_HW_UNKNOWN;
+ }
+ 
++#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
++#if defined(__FreeBSD__) && __FreeBSD__ < 13
++#include <sys/sysctl.h>
++#else
++#include <sys/ioctl.h>
++#include <fcntl.h>
++#include <unistd.h>
++#endif // defined(__FreeBSD__) && __FreeBSD__ < 13
++
++struct drm_pciinfo {
++	uint16_t	domain;
++	uint8_t		bus;
++	uint8_t		dev;
++	uint8_t		func;
++	uint16_t	vendor_id;
++	uint16_t	device_id;
++	uint16_t	subvendor_id;
++	uint16_t	subdevice_id;
++	uint8_t		revision_id;
++};
++
++#define DRM_IOCTL_BASE		'd'
++#define DRM_IOR(nr,type)	_IOR(DRM_IOCTL_BASE,nr,type)
++#define DRM_IOCTL_GET_PCIINFO	DRM_IOR(0x15, struct drm_pciinfo)
++#endif
++
+ static mfxStatus get_devices(std::vector<Device> &allDevices) {
++#ifdef DRM_IOCTL_GET_PCIINFO
++    std::vector <Device> result;
++    for (int i = 0; i < 64; ++i) {
++#if defined(__FreeBSD__) && __FreeBSD__ < 13
++        std::string mib = "dev.drm." + std::to_string(128 + i) + ".PCI_ID";
++        char pci_id[20];
++        size_t len = sizeof(pci_id);
++        if (sysctlbyname(mib.c_str(), pci_id, &len, NULL, 0)) continue;
++        Device device;
++        sscanf(pci_id, "%x:%x", &device.vendor_id, &device.device_id);
++#else
++        std::string path = "/dev/dri/renderD" + std::to_string(128 + i);
++        int fd = open(path.c_str(), O_RDONLY);
++        if (fd == -1) continue;
++        struct drm_pciinfo pinfo;
++        if (ioctl(fd, DRM_IOCTL_GET_PCIINFO, &pinfo)) {
++            close(fd);
++            continue;
++        }
++        Device device = { .vendor_id = pinfo.vendor_id, .device_id = pinfo.device_id };
++        close(fd);
++#endif // defined(__FreeBSD__) && __FreeBSD__ < 13
++        if (device.vendor_id != 0x8086) {  // Filter out non-Intel devices
++            continue;
++        }
++        device.platform = get_platform(device.device_id);
++        allDevices.emplace_back(device);
++    }
++#else
+     const char *dir            = "/sys/class/drm";
+     const char *device_id_file = "/device/device";
+     const char *vendor_id_file = "/device/vendor";
+@@ -456,6 +511,7 @@ static mfxStatus get_devices(std::vector<Device> &allD
+ 
+         allDevices.emplace_back(device);
+     }
++#endif
+ 
+     // sort by device_id
+     std::sort(allDevices.begin(), allDevices.end(), [](const Device &a, const Device &b) {
diff --git a/multimedia/onevpl/files/patch-include b/multimedia/onevpl/files/patch-include
new file mode 100644
index 000000000000..f3c3559e96e1
--- /dev/null
+++ b/multimedia/onevpl/files/patch-include
@@ -0,0 +1,16 @@
+Add missing headers
+
+tools/legacy/sample_common/src/vaapi_utils.cpp:29:28: error: use of undeclared identifier 'basename'
+        so_handle = dlopen(basename(name), RTLD_GLOBAL | RTLD_NOW);
+                           ^
+
+--- tools/legacy/sample_common/src/vaapi_utils.cpp.orig	2021-09-13 22:51:02 UTC
++++ tools/legacy/sample_common/src/vaapi_utils.cpp
+@@ -8,6 +8,7 @@
+ 
+     #include "vaapi_utils.h"
+     #include <dlfcn.h>
++    #include <libgen.h>
+     #include <stdexcept>
+ 
+     //#if defined(LIBVA_DRM_SUPPORT)
diff --git a/multimedia/onevpl/files/patch-private-libs b/multimedia/onevpl/files/patch-private-libs
new file mode 100644
index 000000000000..43874cd594c7
--- /dev/null
+++ b/multimedia/onevpl/files/patch-private-libs
@@ -0,0 +1,13 @@
+Reduce overlinking when not using static library
+
+--- dispatcher/CMakeLists.txt.orig	2021-09-13 22:51:02 UTC
++++ dispatcher/CMakeLists.txt
+@@ -174,7 +174,7 @@ if(BUILD_DEV)
+   if(NOT MSVC)
+     set(CXX_LIB "-lstdc++")
+   endif()
+-  set(VPL_PKGCONFIG_DEPENDENT_LIBS
++  set(VPL_PKGCONFIG_PRIVATE_LIBS
+       "${DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_LIBS} ${CXX_LIB}")
+   configure_file("pkgconfig/vpl.pc.in" "pkgconfig/vpl.pc" @ONLY)
+   install(
diff --git a/multimedia/onevpl/files/patch-sched b/multimedia/onevpl/files/patch-sched
new file mode 100644
index 000000000000..8012f025d8bb
--- /dev/null
+++ b/multimedia/onevpl/files/patch-sched
@@ -0,0 +1,33 @@
+Disable non-POSIX scheduling policies if not supported
+
+tools/legacy/sample_common/src/vm/thread_linux.cpp:279:16: error: use of undeclared identifier 'SCHED_BATCH'
+        type = SCHED_BATCH;
+               ^
+tools/legacy/sample_common/src/vm/thread_linux.cpp:282:16: error: use of undeclared identifier 'SCHED_IDLE'
+        type = SCHED_IDLE;
+               ^
+
+--- tools/legacy/sample_common/src/vm/thread_linux.cpp.orig	2021-09-13 22:51:02 UTC
++++ tools/legacy/sample_common/src/vm/thread_linux.cpp
+@@ -275,15 +275,21 @@ mfxStatus msdk_thread_get_schedtype(const msdk_char* s
+     else if (!msdk_strcmp(str, MSDK_STRING("other"))) {
+         type = SCHED_OTHER;
+     }
++#ifdef SCHED_BATCH
+     else if (!msdk_strcmp(str, MSDK_STRING("batch"))) {
+         type = SCHED_BATCH;
+     }
++#endif
++#ifdef SCHED_IDLE
+     else if (!msdk_strcmp(str, MSDK_STRING("idle"))) {
+         type = SCHED_IDLE;
+     }
++#endif
++    //#ifdef SCHED_DEADLINE
+     //    else if (!msdk_strcmp(str, MSDK_STRING("deadline"))) {
+     //        type = SCHED_DEADLINE;
+     //    }
++    //#endif
+     else {
+         return MFX_ERR_UNSUPPORTED;
+     }
diff --git a/multimedia/onevpl/files/patch-unix b/multimedia/onevpl/files/patch-unix
new file mode 100644
index 000000000000..1a5a4d2c1907
--- /dev/null
+++ b/multimedia/onevpl/files/patch-unix
@@ -0,0 +1,320 @@
+Relax Linux checks for the code works on any non-Windows platform.
+
+dispatcher/vpl/mfx_dispatcher_vpl_msdk.cpp:171:16: error: use of undeclared identifier 'MFX'
+    sts      = MFX::SelectImplementationType(adapterID, &implTest, &VendorID, &DeviceID, luid);
+               ^
+dispatcher/vpl/mfx_dispatcher_vpl_msdk.cpp:322:5: error: use of undeclared identifier 'strncpy_s'
+    strncpy_s(m_id.ImplName, sizeof(m_id.ImplName), strImplName, sizeof(strImplName));
+    ^
+dispatcher/vpl/mfx_dispatcher_vpl_msdk.cpp:323:5: error: use of undeclared identifier 'strncpy_s'
+    strncpy_s(m_id.License, sizeof(m_id.License), strLicense, sizeof(strLicense));
+    ^
+dispatcher/vpl/mfx_dispatcher_vpl_msdk.cpp:324:5: error: use of undeclared identifier 'strncpy_s'
+    strncpy_s(m_id.Keywords, sizeof(m_id.Keywords), strKeywords, sizeof(strKeywords));
+    ^
+dispatcher/vpl/mfx_dispatcher_vpl_msdk.cpp:339:28: warning: suggest braces around initialization of subobject [-Wmissing-braces]
+    if (IsVersionSupported(MAKE_MFX_VERSION(1, 19), m_id.ApiVersion)) {
+                           ^~~~~~~~~~~~~~~~~~~~~~~
+dispatcher/vpl/mfx_dispatcher_vpl_loader.cpp:583:43: error: use of undeclared identifier 'MSDK_LIB_NAME'
+            if (libInfo->libNameFull.find(MSDK_LIB_NAME) != std::string::npos) {
+                                          ^
+
+--- api/vpl/mfxdefs.h.orig	2021-09-13 22:51:02 UTC
++++ api/vpl/mfxdefs.h
+@@ -64,7 +64,7 @@ extern "C"
+     #define MFX_PACK_BEGIN_STRUCT_W_PTR()    MFX_PACK_BEGIN_X(8)
+     #define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
+ /* 32-bit ILP32 data model Windows* (Intel(r) architecture) */
+-#elif defined(_WIN32) || defined(_M_IX86) && !defined(__linux__)
++#elif defined(_WIN32) || defined(_M_IX86) && !defined(__unix__)
+     #define MFX_PACK_BEGIN_STRUCT_W_PTR()    MFX_PACK_BEGIN_X(4)
+     #define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
+ /* 32-bit ILP32 data model Linux* */
+@@ -99,7 +99,7 @@ extern "C"
+        #define MFX_DEPRECATED __declspec(deprecated)
+        #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
+        #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
+-     #elif defined(__linux__)
++     #elif defined(__unix__)
+        #define MFX_DEPRECATED __attribute__((deprecated))
+        #if defined(__cplusplus)
+          #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
+--- dispatcher/vpl/mfx_dispatcher_vpl.h.orig	2021-09-13 22:51:02 UTC
++++ dispatcher/vpl/mfx_dispatcher_vpl.h
+@@ -47,7 +47,7 @@ typedef char CHAR_TYPE;
+         // Windows x64
+         #define MSDK_LIB_NAME L"libmfxhw64."
+     #endif
+-#elif defined(__linux__)
++#elif defined(__unix__)
+     // Linux x64
+     #define MSDK_LIB_NAME "libmfxhw64."
+ #endif
+--- dispatcher/vpl/mfx_dispatcher_vpl_loader.cpp.orig	2021-09-13 22:51:02 UTC
++++ dispatcher/vpl/mfx_dispatcher_vpl_loader.cpp
+@@ -400,7 +400,9 @@ mfxU32 LoaderCtxVPL::GetSearchPathsSystemDefault(std::
+ #ifdef __linux__
+     // Add the standard path for libmfx1 install in Ubuntu
+     searchDirs.push_back("/usr/lib/x86_64-linux-gnu");
++#endif
+ 
++#ifdef __unix__
+     // Add other default paths
+     searchDirs.push_back("/lib");
+     searchDirs.push_back("/usr/lib");
+@@ -1057,7 +1059,7 @@ mfxStatus LoaderCtxVPL::QueryLibraryCaps() {
+                 // update number of valid MSDK adapters
+                 numImplMSDK++;
+ 
+-#ifdef __linux__
++#ifdef __unix__
+                 // currently only one adapter on Linux (avoid multiple copies)
+                 break;
+ #endif
+--- dispatcher/vpl/mfx_dispatcher_vpl_lowlatency.cpp.orig	2021-09-13 22:51:02 UTC
++++ dispatcher/vpl/mfx_dispatcher_vpl_lowlatency.cpp
+@@ -18,7 +18,7 @@
+         #define LIB_ONEVPL L"libmfx64-gen.dll"
+         #define LIB_MSDK   L"libmfxhw64.dll"
+     #endif
+-#elif defined(__linux__)
++#elif defined(__unix__)
+     // Linux x64
+     #define LIB_ONEVPL "libmfx-gen.so.1.2"
+     #define LIB_MSDK   "libmfxhw64.so.1"
+--- dispatcher/vpl/mfx_dispatcher_vpl_msdk.cpp.orig	2021-09-13 22:51:02 UTC
++++ dispatcher/vpl/mfx_dispatcher_vpl_msdk.cpp
+@@ -10,7 +10,7 @@
+     #include "vpl/mfx_dispatcher_vpl_win.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <pthread.h>
+     #define strncpy_s(dst, size, src, cnt) strcpy((dst), (src)) // NOLINT
+ #endif
+@@ -155,7 +155,7 @@ mfxAccelerationMode LoaderCtxMSDK::CvtAccelType(mfxIMP
+ }
+ 
+ mfxStatus LoaderCtxMSDK::GetDefaultAccelType(mfxU32 adapterID, mfxIMPL *implDefault, mfxU64 *luid) {
+-#ifdef __linux__
++#ifdef __unix__
+     // VAAPI only
+     *implDefault = MFX_IMPL_VIA_VAAPI;
+     *luid        = 0;
+@@ -242,7 +242,7 @@ mfxStatus LoaderCtxMSDK::QueryMSDKCaps(STRING_TYPE lib
+ 
+     m_libNameFull = libNameFull;
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     // require pthreads to be linked in for MSDK RT to load
+     pthread_key_t pkey;
+     if (pthread_key_create(&pkey, NULL) == 0) {
+--- examples/coreAPI/legacy-decode/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/coreAPI/legacy-decode/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+--- examples/coreAPI/legacy-encode/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/coreAPI/legacy-encode/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+--- examples/coreAPI/legacy-vpp/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/coreAPI/legacy-vpp/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+--- examples/hello/hello-createsession/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/hello/hello-createsession/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+--- examples/hello/hello-decvpp/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/hello/hello-decvpp/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+--- examples/hello/hello-transcode/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/hello/hello-transcode/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+ #endif
+ 
+--- examples/interop/advanced-decvpp-infer/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/interop/advanced-decvpp-infer/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+--- examples/interop/hello-decode-infer/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/interop/hello-decode-infer/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+ #endif
+ 
+--- examples/interop/legacy-decode-infer/src/util.h.orig	2021-09-13 22:51:02 UTC
++++ examples/interop/legacy-decode-infer/src/util.h
+@@ -30,7 +30,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+--- preview/cplusplus/examples/hello-decode-cpp/src/util.hpp.orig	2021-09-13 22:51:02 UTC
++++ preview/cplusplus/examples/hello-decode-cpp/src/util.hpp
+@@ -21,7 +21,7 @@
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+@@ -63,7 +63,7 @@ const struct {
+                 X = NULL;        \
+             }                    \
+         }
+-#elif defined(__linux__)
++#elif defined(__unix__)
+     #ifdef LIBVA_SUPPORT
+         #include "va/va.h"
+         #include "va/va_drm.h"
+--- preview/cplusplus/examples/hello-encode-cpp/src/util.hpp.orig	2021-09-13 22:51:02 UTC
++++ preview/cplusplus/examples/hello-encode-cpp/src/util.hpp
+@@ -21,7 +21,7 @@
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+@@ -63,7 +63,7 @@ const struct {
+                 X = NULL;        \
+             }                    \
+         }
+-#elif defined(__linux__)
++#elif defined(__unix__)
+     #ifdef LIBVA_SUPPORT
+         #include "va/va.h"
+         #include "va/va_drm.h"
+--- preview/python/binding/vpl_python.hpp.orig	2021-09-13 22:51:02 UTC
++++ preview/python/binding/vpl_python.hpp
+@@ -15,6 +15,6 @@
+ 
+ namespace py = pybind11;
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #define strncpy_s(dst, size, src, cnt) strncpy((dst), (src), cnt) // NOLINT
+ #endif
+--- tools/cli/decvpp_tool/util.hpp.orig	2021-09-13 22:51:02 UTC
++++ tools/cli/decvpp_tool/util.hpp
+@@ -31,7 +31,7 @@ enum {
+     #include "vpl/mfxdispatcher.h"
+ #endif
+ 
+-#ifdef __linux__
++#ifdef __unix__
+     #include <fcntl.h>
+     #include <unistd.h>
+ #endif
+@@ -62,7 +62,7 @@ const struct {
+                 X = NULL;        \
+             }                    \
+         }
+-#elif defined(__linux__)
++#elif defined(__unix__)
+     #ifdef LIBVA_SUPPORT
+         #include "va/va.h"
+         #include "va/va_drm.h"
+@@ -541,7 +541,7 @@ mfxStatus InitAcceleratorHandle(mfxSession session, in
+     if (sts != MFX_ERR_NONE)
+         return sts;
+ 
+-#if defined(__linux)
++#if defined(__unix)
+     #ifdef LIBVA_SUPPORT
+     if ((impl & MFX_IMPL_VIA_VAAPI) == MFX_IMPL_VIA_VAAPI) {
+         if (!fd)
+@@ -579,7 +579,7 @@ mfxStatus InitAcceleratorHandle(mfxSession session, in
+ }
+ 
+ void FreeAcceleratorHandle(void *accelHandle, int fd) {
+-#if defined(__linux)
++#if defined(__unix)
+     #ifdef LIBVA_SUPPORT
+     vaTerminate((VADisplay)accelHandle);
+     close(fd);
+--- tools/legacy/sample_encode/src/sample_encode.cpp.orig	2021-09-13 22:51:02 UTC
++++ tools/legacy/sample_encode/src/sample_encode.cpp
+@@ -53,7 +53,7 @@ void PrintHelp(msdk_char* strAppName, const msdk_char*
+ 
+     msdk_printf(MSDK_STRING("   If codecid is jpeg, -q option is mandatory.)\n"));
+     msdk_printf(MSDK_STRING("Options: \n"));
+-#if __linux__
++#if __unix__
+     msdk_printf(MSDK_STRING("   [-device /path/to/device] - set graphics device for processing\n"));
+     msdk_printf(
+         MSDK_STRING("                                 For example: '-device /dev/dri/card0'\n"));
+@@ -532,7 +532,7 @@ mfxStatus ParseInputString(msdk_char* strInput[], mfxU
+                 return MFX_ERR_UNSUPPORTED;
+             }
+         }
+-#if __linux__
++#if __unix__
+         else if (0 == msdk_strcmp(strInput[i], MSDK_STRING("-device"))) {
+             if (!pParams->strDevicePath.empty()) {
+                 msdk_printf(MSDK_STRING("error: you can specify only one device\n"));
diff --git a/multimedia/onevpl/pkg-descr b/multimedia/onevpl/pkg-descr
new file mode 100644
index 000000000000..fd9414e21ef3
--- /dev/null
+++ b/multimedia/onevpl/pkg-descr
@@ -0,0 +1,12 @@
+The oneAPI Video Processing Library (oneVPL) provides a single video
+processing API for encode, decode, and video processing that works
+across a wide range of accelerators.
+
+This package contains the following components of oneVPL:
+
+- Copies of the oneVPL Specification API header files
+- oneVPL dispatcher
+- Examples demonstrating API usage
+- oneVPL command line tools
+
+WWW: https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onevpl.html
diff --git a/multimedia/onevpl/pkg-plist b/multimedia/onevpl/pkg-plist
new file mode 100644
index 000000000000..5e90b23839fa
--- /dev/null
+++ b/multimedia/onevpl/pkg-plist
@@ -0,0 +1,142 @@
+bin/decvpp_tool
+bin/sample_decode
+bin/sample_encode
+bin/sample_multi_transcode
+bin/sample_vpp
+bin/vpl-inspect
+include/vpl/mfx.h
+include/vpl/mfxadapter.h
+include/vpl/mfxbrc.h
+include/vpl/mfxcommon.h
+include/vpl/mfxdefs.h
+include/vpl/mfxdispatcher.h
+include/vpl/mfxdispatcherprefixedfunctions.h
+include/vpl/mfximplcaps.h
+include/vpl/mfxjpeg.h
+include/vpl/mfxmvc.h
+include/vpl/mfxpcp.h
+include/vpl/mfxsession.h
+include/vpl/mfxstructures.h
+include/vpl/mfxsurfacepool.h
+include/vpl/mfxvideo++.h
+include/vpl/mfxvideo.h
+include/vpl/mfxvp8.h
+include/vpl/preview/README.txt
+include/vpl/preview/bitstream.hpp
+include/vpl/preview/defs.hpp
+include/vpl/preview/detail/frame_interface.hpp
+include/vpl/preview/detail/sdk_callable.hpp
+include/vpl/preview/detail/string_helpers.hpp
+include/vpl/preview/detail/variant.hpp
+include/vpl/preview/exception.hpp
+include/vpl/preview/extension_buffer.hpp
+include/vpl/preview/extension_buffer_list.hpp
+include/vpl/preview/frame_pool.hpp
+include/vpl/preview/frame_surface.hpp
+include/vpl/preview/future.hpp
+include/vpl/preview/impl_caps.hpp
+include/vpl/preview/impl_selector.hpp
+include/vpl/preview/options.hpp
+include/vpl/preview/payload.hpp
+include/vpl/preview/property_name.hpp
+include/vpl/preview/session.hpp
+include/vpl/preview/source_reader.hpp
+include/vpl/preview/stat.hpp
+include/vpl/preview/surface_pool.hpp
+include/vpl/preview/video_param.hpp
+include/vpl/preview/vpl.hpp
+lib/cmake/vpl/VPLConfig.cmake
+lib/cmake/vpl/VPLConfigVersion.cmake
+lib/libvpl.so
+lib/libvpl.so.2
+lib/libvpl.so.2.5
+lib/oneVPL/libvpl_wayland.so
+%%PYTHON%%lib/python/pyvpl%%PYTHON_EXT_SUFFIX%%.so
+libdata/pkgconfig/vpl.pc
+%%DATADIR%%/env/vars.sh
+%%DATADIR%%/examples/content/cars_128x96.h265
+%%DATADIR%%/examples/content/cars_128x96.i420
+%%DATADIR%%/examples/content/cars_128x96.mjpeg
+%%DATADIR%%/examples/content/cars_128x96.nv12
+%%DATADIR%%/examples/coreAPI/legacy-decode/CMakeLists.txt
+%%DATADIR%%/examples/coreAPI/legacy-decode/License.txt
+%%DATADIR%%/examples/coreAPI/legacy-decode/README.md
+%%DATADIR%%/examples/coreAPI/legacy-decode/sample.json
+%%DATADIR%%/examples/coreAPI/legacy-decode/src/legacy-decode.cpp
+%%DATADIR%%/examples/coreAPI/legacy-decode/src/util.h
+%%DATADIR%%/examples/coreAPI/legacy-encode/CMakeLists.txt
+%%DATADIR%%/examples/coreAPI/legacy-encode/License.txt
+%%DATADIR%%/examples/coreAPI/legacy-encode/PreLoad.cmake
+%%DATADIR%%/examples/coreAPI/legacy-encode/README.md
+%%DATADIR%%/examples/coreAPI/legacy-encode/sample.json
+%%DATADIR%%/examples/coreAPI/legacy-encode/src/legacy-encode.cpp
+%%DATADIR%%/examples/coreAPI/legacy-encode/src/util.h
+%%DATADIR%%/examples/coreAPI/legacy-vpp/CMakeLists.txt
+%%DATADIR%%/examples/coreAPI/legacy-vpp/License.txt
+%%DATADIR%%/examples/coreAPI/legacy-vpp/README.md
+%%DATADIR%%/examples/coreAPI/legacy-vpp/sample.json
+%%DATADIR%%/examples/coreAPI/legacy-vpp/src/legacy-vpp.cpp
+%%DATADIR%%/examples/coreAPI/legacy-vpp/src/util.h
+%%DATADIR%%/examples/hello/hello-createsession/CMakeLists.txt
+%%DATADIR%%/examples/hello/hello-createsession/License.txt
+%%DATADIR%%/examples/hello/hello-createsession/PreLoad.cmake
+%%DATADIR%%/examples/hello/hello-createsession/README.md
+%%DATADIR%%/examples/hello/hello-createsession/sample.json
+%%DATADIR%%/examples/hello/hello-createsession/src/hello-createsession.cpp
+%%DATADIR%%/examples/hello/hello-createsession/src/util.h
+%%DATADIR%%/examples/hello/hello-decvpp/CMakeLists.txt
+%%DATADIR%%/examples/hello/hello-decvpp/License.txt
+%%DATADIR%%/examples/hello/hello-decvpp/PreLoad.cmake
+%%DATADIR%%/examples/hello/hello-decvpp/README.md
+%%DATADIR%%/examples/hello/hello-decvpp/sample.json
+%%DATADIR%%/examples/hello/hello-decvpp/src/hello-decvpp.cpp
+%%DATADIR%%/examples/hello/hello-decvpp/src/util.h
+%%DATADIR%%/examples/hello/hello-transcode/CMakeLists.txt
+%%DATADIR%%/examples/hello/hello-transcode/License.txt
+%%DATADIR%%/examples/hello/hello-transcode/README.md
+%%DATADIR%%/examples/hello/hello-transcode/sample.json
+%%DATADIR%%/examples/hello/hello-transcode/src/hello-transcode.cpp
+%%DATADIR%%/examples/hello/hello-transcode/src/util.h
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/CMakeLists.txt
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/CPPLINT.cfg
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/License.txt
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/PreLoad.cmake
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/README.md
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/sample.json
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/src/advanced-decvpp-infer.cpp
+%%DATADIR%%/examples/interop/advanced-decvpp-infer/src/util.h
+%%DATADIR%%/examples/interop/hello-decode-infer/CMakeLists.txt
+%%DATADIR%%/examples/interop/hello-decode-infer/CPPLINT.cfg
+%%DATADIR%%/examples/interop/hello-decode-infer/License.txt
+%%DATADIR%%/examples/interop/hello-decode-infer/PreLoad.cmake
+%%DATADIR%%/examples/interop/hello-decode-infer/README.md
+%%DATADIR%%/examples/interop/hello-decode-infer/sample.json
+%%DATADIR%%/examples/interop/hello-decode-infer/src/hello-decode-infer.cpp
+%%DATADIR%%/examples/interop/hello-decode-infer/src/util.h
+%%DATADIR%%/examples/interop/legacy-decode-infer/CMakeLists.txt
+%%DATADIR%%/examples/interop/legacy-decode-infer/CPPLINT.cfg
+%%DATADIR%%/examples/interop/legacy-decode-infer/License.txt
+%%DATADIR%%/examples/interop/legacy-decode-infer/README.md
+%%DATADIR%%/examples/interop/legacy-decode-infer/sample.json
+%%DATADIR%%/examples/interop/legacy-decode-infer/src/legacy-decode-infer.cpp
+%%DATADIR%%/examples/interop/legacy-decode-infer/src/util.h
+%%DATADIR%%/examples/preview/cplusplus/hello-decode-cpp/CMakeLists.txt
+%%DATADIR%%/examples/preview/cplusplus/hello-decode-cpp/License.txt
+%%DATADIR%%/examples/preview/cplusplus/hello-decode-cpp/README.md
+%%DATADIR%%/examples/preview/cplusplus/hello-decode-cpp/src/hello-decode.cpp
+%%DATADIR%%/examples/preview/cplusplus/hello-decode-cpp/src/util.hpp
+%%DATADIR%%/examples/preview/cplusplus/hello-encode-cpp/CMakeLists.txt
+%%DATADIR%%/examples/preview/cplusplus/hello-encode-cpp/License.txt
+%%DATADIR%%/examples/preview/cplusplus/hello-encode-cpp/README.md
+%%DATADIR%%/examples/preview/cplusplus/hello-encode-cpp/src/hello-encode.cpp
+%%DATADIR%%/examples/preview/cplusplus/hello-encode-cpp/src/util.hpp
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-decode-py/License.txt
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-decode-py/README.md
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-decode-py/hello-decode.py
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-encode-py/License.txt
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-encode-py/README.md
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-encode-py/hello-encode.py
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-vpp-py/License.txt
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-vpp-py/README.md
+%%PYTHON%%%%DATADIR%%/examples/preview/python/hello-vpp-py/hello-vpp.py
+%%DATADIR%%/modulefiles/vpl