Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Nov 2018 16:25:07 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r483899 - in head/multimedia: . cmrt cmrt/files libva-intel-driver libva-intel-hybrid-driver libva-intel-hybrid-driver/files
Message-ID:  <201811031625.wA3GP7ib058259@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Sat Nov  3 16:25:07 2018
New Revision: 483899
URL: https://svnweb.freebsd.org/changeset/ports/483899

Log:
  multimedia/libva-intel-driver: expose Hybrid decoding
  
  On Skylake this reduces CPU usage by half when decoding VP9.

Added:
  head/multimedia/cmrt/
  head/multimedia/cmrt/Makefile   (contents, props changed)
  head/multimedia/cmrt/distinfo   (contents, props changed)
  head/multimedia/cmrt/files/
  head/multimedia/cmrt/files/patch-i386   (contents, props changed)
  head/multimedia/cmrt/files/patch-memalign   (contents, props changed)
  head/multimedia/cmrt/pkg-descr   (contents, props changed)
  head/multimedia/cmrt/pkg-plist   (contents, props changed)
  head/multimedia/libva-intel-hybrid-driver/
  head/multimedia/libva-intel-hybrid-driver/Makefile   (contents, props changed)
  head/multimedia/libva-intel-hybrid-driver/distinfo   (contents, props changed)
  head/multimedia/libva-intel-hybrid-driver/files/
  head/multimedia/libva-intel-hybrid-driver/files/patch-memalign   (contents, props changed)
  head/multimedia/libva-intel-hybrid-driver/pkg-descr   (contents, props changed)
Modified:
  head/multimedia/Makefile   (contents, props changed)
  head/multimedia/libva-intel-driver/Makefile   (contents, props changed)

Modified: head/multimedia/Makefile
==============================================================================
--- head/multimedia/Makefile	Sat Nov  3 14:42:22 2018	(r483898)
+++ head/multimedia/Makefile	Sat Nov  3 16:25:07 2018	(r483899)
@@ -41,6 +41,7 @@
     SUBDIR += clive
     SUBDIR += clutter-gst
     SUBDIR += clutter-gst3
+    SUBDIR += cmrt
     SUBDIR += cuse4bsd-kmod
     SUBDIR += cx88
     SUBDIR += deforaos-player
@@ -227,6 +228,7 @@
     SUBDIR += libv4l
     SUBDIR += libva
     SUBDIR += libva-intel-driver
+    SUBDIR += libva-intel-hybrid-driver
     SUBDIR += libva-utils
     SUBDIR += libva-vdpau-driver
     SUBDIR += libvdpau

Added: head/multimedia/cmrt/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/cmrt/Makefile	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+PORTNAME=	cmrt
+DISTVERSION=	1.0.6
+CATEGORIES=	multimedia
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	C for Media Runtime
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+ONLY_FOR_ARCHS=	amd64 i386
+ONLY_FOR_ARCHS_REASON=	Only Intel GPUs on x86 are supported
+
+LIB_DEPENDS=	libdrm_intel.so:graphics/libdrm \
+		libva.so:multimedia/libva
+
+USES=		autoreconf compiler:c11 libtool pkgconfig
+USE_GITHUB=	yes
+USE_LDCONFIG=	yes
+GH_ACCOUNT=	intel
+GNU_CONFIGURE=	yes
+INSTALL_TARGET=	install-strip
+
+post-patch:
+	@${REINPLACE_CMD} -e '/-g/d; /-O2/d' \
+		${WRKSRC}/src/Makefile.am
+
+.include <bsd.port.mk>

Added: head/multimedia/cmrt/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/cmrt/distinfo	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1473292298
+SHA256 (intel-cmrt-1.0.6_GH0.tar.gz) = ca22e905a2717fc740e703e65a0061a0e11f4ea513ba970bbc10b3bd6d28e6e0
+SIZE (intel-cmrt-1.0.6_GH0.tar.gz) = 3717552

Added: head/multimedia/cmrt/files/patch-i386
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/cmrt/files/patch-i386	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,28 @@
+In file included from cm_device.cpp:31:
+In file included from ./cm_device.h:37:
+In file included from ./cm_array.h:31:
+./cm_mem.h:200:17: error: invalid output size for constraint '=a'
+                                             :"=a"(local_rax), "=r"(local_rbx),
+                                                   ^
+
+--- src/cm_mem.h.orig	2016-09-07 23:51:38 UTC
++++ src/cm_mem.h
+@@ -194,7 +194,9 @@ inline void GetCPUID(int CPUInfo[4], int InfoType)
+ 			CPUInfo[1] = local_ebx;
+ 			CPUInfo[2] = local_ecx;
+ 			CPUInfo[3] = local_edx;
+-		} else {
++		}
++#ifdef __LP64__
++		  else {
+ 			uint64_t local_rax, local_rbx, local_rcx, local_rdx;
+ 			__asm__ __volatile__("push %%rbx      \n\t" "cpuid           \n\t" "mov %%rbx, %1   \n\t" "pop %%rbx       \n\t"	/* restore the old %ebx */
+ 					     :"=a"(local_rax), "=r"(local_rbx),
+@@ -206,6 +208,7 @@ inline void GetCPUID(int CPUInfo[4], int InfoType)
+ 			CPUInfo[2] = local_rcx;
+ 			CPUInfo[3] = local_rdx;
+ 		}
++#endif
+ 
+ #ifndef NO_EXCEPTION_HANDLING
+ 	}

Added: head/multimedia/cmrt/files/patch-memalign
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/cmrt/files/patch-memalign	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,40 @@
+memalign is Linux-specific, so use C11 aligned_alloc instead
+
+--- src/cm_rt_linux.h.orig	2016-09-07 23:51:38 UTC
++++ src/cm_rt_linux.h
+@@ -48,7 +48,6 @@ extern "C" {
+ #include <stdlib.h>
+ #include <stdint.h>
+ #include <math.h>
+-#include <malloc.h>
+ #include <string.h>
+ #include <sys/time.h>
+ #include <pthread.h>
+@@ -334,7 +333,7 @@ template <> inline const char *CM_TYPE_NAME_UNMANGLED 
+ 
+ inline void *CM_ALIGNED_MALLOC(size_t size, size_t alignment)
+ {
+-	return memalign(alignment, size);
++	return aligned_alloc(alignment, size);
+ }
+ 
+ inline void CM_ALIGNED_FREE(void *memory)
+--- src/os_utilities.c.orig	2016-09-07 23:51:38 UTC
++++ src/os_utilities.c
+@@ -40,7 +40,6 @@
+ #include <sys/types.h>
+ #include <sys/sem.h>
+ #include <signal.h>
+-#include <malloc.h>
+ #include "string.h"
+ #include <unistd.h>
+ 
+@@ -56,7 +55,7 @@ INT32 GenOsMemAllocCounter;
+    GENOS_OS_VERBOSEMESSAGE("GenOsMemAllocCounter = %d, Addr = 0x%x.", GenOsMemAllocCounter, ptr);   \
+    GENOS_OS_VERBOSEMESSAGE("<MemNinjaSysFreePtr memPtr = \"%d\" memType = \"Sys\"/>.", ptr);
+ 
+-#define _aligned_malloc(size, alignment)  memalign(alignment, size)
++#define _aligned_malloc(size, alignment)  aligned_alloc(alignment, size)
+ #define _aligned_free(ptr)                free(ptr)
+ 
+ PVOID GENOS_AlignedAllocMemory(SIZE_T size, SIZE_T alignment)

Added: head/multimedia/cmrt/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/cmrt/pkg-descr	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,5 @@
+Media GPU kernel manager for Intel G45 & HD Graphics family. Allows to
+interface between Intel GPU's driver and a host program through a
+high-level language.
+
+WWW: https://01.org/linuxmedia

Added: head/multimedia/cmrt/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/cmrt/pkg-plist	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,7 @@
+etc/cmrt.conf
+include/cm_rt.h
+include/cm_rt_linux.h
+lib/libcmrt.so
+lib/libcmrt.so.1
+lib/libcmrt.so.1.1001.0
+libdata/pkgconfig/libcmrt.pc

Modified: head/multimedia/libva-intel-driver/Makefile
==============================================================================
--- head/multimedia/libva-intel-driver/Makefile	Sat Nov  3 14:42:22 2018	(r483898)
+++ head/multimedia/libva-intel-driver/Makefile	Sat Nov  3 16:25:07 2018	(r483899)
@@ -31,6 +31,12 @@ PLIST_FILES=	lib/dri/i915_drv_video.so lib/dri/i965_dr
 ONLY_FOR_ARCHS=	amd64 i386
 ONLY_FOR_ARCHS_REASON=	Driver for hardware present only on intel i386 and amd64 CPUs
 
+OPTIONS_DEFINE=	HYBRID
+
+HYBRID_DESC=	Hybrid codec support (e.g., VP9 decoding on Skylake)
+HYBRID_RUN_DEPENDS=	${LOCALBASE}/lib/dri/hybrid_drv_video.so:multimedia/libva-intel-hybrid-driver
+HYBRID_CONFIGURE_ENABLE=	hybrid-codec
+
 post-patch:	.SILENT
 	${REINPLACE_CMD} -e 's/-ldl//' \
 		${WRKSRC}/src/Makefile.am

Added: head/multimedia/libva-intel-hybrid-driver/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/libva-intel-hybrid-driver/Makefile	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+PORTNAME=	intel-hybrid-driver
+DISTVERSION=	1.0.2
+CATEGORIES=	multimedia
+PKGNAMEPREFIX=	libva-
+
+PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
+PATCHFILES=	dfa9c8eba295.patch:-p1 b3b4d9a3a08d.patch:-p1
+
+MAINTAINER=	jbeich@FreeBSD.org
+COMMENT=	Hybrid VP8 encoder and VP9 decoder for Intel GPUs
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+ONLY_FOR_ARCHS=	amd64 i386
+ONLY_FOR_ARCHS_REASON=	Only Intel GPUs on x86 are supported
+
+LIB_DEPENDS=	libdrm_intel.so:graphics/libdrm \
+		libcmrt.so:multimedia/cmrt \
+		libva.so:multimedia/libva
+
+USES=		autoreconf compiler:c11 gmake libtool pkgconfig
+USE_GITHUB=	yes
+USE_LDCONFIG=	yes
+GH_ACCOUNT=	01org
+GNU_CONFIGURE=	yes
+INSTALL_TARGET=	install-strip
+PLIST_FILES=	lib/dri/hybrid_drv_video.so
+
+post-patch:
+	@${REINPLACE_CMD} -e '/__linux__/d; /LINUX/d' \
+		${WRKSRC}/src/vp9hdec/Makefile.am
+
+.include <bsd.port.mk>

Added: head/multimedia/libva-intel-hybrid-driver/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/libva-intel-hybrid-driver/distinfo	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,7 @@
+TIMESTAMP = 1473291388
+SHA256 (01org-intel-hybrid-driver-1.0.2_GH0.tar.gz) = 16cd66872e8043ce6c0e9a016a043c460e8a180fdc520f31c1f97ffef7828d7b
+SIZE (01org-intel-hybrid-driver-1.0.2_GH0.tar.gz) = 1331968
+SHA256 (dfa9c8eba295.patch) = 0c5a2501f6a467cc88c04367f5de89c944fbdb013f87f19ba684c6e2e6560f33
+SIZE (dfa9c8eba295.patch) = 1679
+SHA256 (b3b4d9a3a08d.patch) = acb0acf2a83632358ccb3b02a4b74184149312863fa15bab4686df41abb1fd9b
+SIZE (b3b4d9a3a08d.patch) = 1917

Added: head/multimedia/libva-intel-hybrid-driver/files/patch-memalign
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/libva-intel-hybrid-driver/files/patch-memalign	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,71 @@
+memalign is Linux-specific, so use C11 aligned_alloc instead
+
+--- src/vp9hdec/decode_hybrid_vp9.h.orig	2016-09-07 23:36:28 UTC
++++ src/vp9hdec/decode_hybrid_vp9.h
+@@ -39,8 +39,6 @@
+ #include "intel_hybrid_hostvld_vp9.h"
+ #include "intel_hybrid_common_vp9.h"
+ 
+-#include <malloc.h>
+-
+ #define INTEL_HYBRID_VP9_PAGE_SIZE       0x1000
+ 
+ #define INTEL_HYBRID_VP9_KEY_FRAME       0
+--- src/vp9hdec/intel_hybrid_debug_dump.cpp.orig	2016-09-07 23:36:28 UTC
++++ src/vp9hdec/intel_hybrid_debug_dump.cpp
+@@ -34,8 +34,6 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ 
+-#include <malloc.h>
+-
+ static int intel_hybrid_createfile(
+     int		*fd,
+     const char           *lpFileName,
+@@ -166,7 +164,7 @@ char *intel_alloc_zero_aligned_memory(uint32_t size, u
+      size_t tmp_size;
+ 
+      tmp_size = ALIGN(size, alignment);
+-     ptr = (char *)memalign(alignment, tmp_size);
++     ptr = (char *)aligned_alloc(alignment, tmp_size);
+ 
+      if (ptr) {
+          memset(ptr, 0, tmp_size);
+--- src/vp9hdec/intel_hybrid_hostvld_vp9.cpp.orig	2016-09-07 23:36:28 UTC
++++ src/vp9hdec/intel_hybrid_hostvld_vp9.cpp
+@@ -88,7 +88,7 @@ do {                                                  
+ #define VP9_REALLOCATE_ABOVE_CTX_BUFFER(pAboveCtxBuffer, size) \
+ do {                                                           \
+     VP9_ALIGNED_FREE_MEMORY(pAboveCtxBuffer);                                     \
+-    pAboveCtxBuffer = (PUINT8)memalign(INTEL_HOSTVLD_VP9_PAGE_SIZE, size); \
++    pAboveCtxBuffer = (PUINT8)aligned_alloc(INTEL_HOSTVLD_VP9_PAGE_SIZE, size); \
+ } while(0)
+ 
+ #define VP9_REALLOCATE_HOSTVLD_1D_BUFFER_UINT8(pHostvldBuffer, dwBufferSize)    \
+@@ -96,7 +96,7 @@ do                                                    
+ {                                                                               \
+     VP9_ALIGNED_FREE_MEMORY((pHostvldBuffer)->pu8Buffer);                       \
+     (pHostvldBuffer)->dwSize = dwBufferSize;                                    \
+-    (pHostvldBuffer)->pu8Buffer = (PUINT8)memalign(INTEL_HOSTVLD_VP9_PAGE_SIZE, dwBufferSize); \
++    (pHostvldBuffer)->pu8Buffer = (PUINT8)aligned_alloc(INTEL_HOSTVLD_VP9_PAGE_SIZE, dwBufferSize); \
+ } while (0)
+ 
+ VAStatus Intel_HostvldVp9_Execute_MT (
+@@ -425,7 +425,7 @@ VAStatus Intel_HostvldVp9_PreParser (PVOID pVp9FrameSt
+         dwSize = dwNumAboveCtx * sizeof(*pFrameInfo->pContextAbove);
+         VP9_ALIGNED_FREE_MEMORY(pFrameInfo->pContextAbove);
+         pFrameInfo->pContextAbove =
+-            (PINTEL_HOSTVLD_VP9_NEIGHBOR)memalign(INTEL_HOSTVLD_VP9_PAGE_SIZE, dwSize);
++            (PINTEL_HOSTVLD_VP9_NEIGHBOR)aligned_alloc(INTEL_HOSTVLD_VP9_PAGE_SIZE, dwSize);
+ 
+         dwNumAboveCtx <<= 1;
+         // Entropy context, per 4x4 block. Allocate once for all the planes
+@@ -445,7 +445,7 @@ VAStatus Intel_HostvldVp9_PreParser (PVOID pVp9FrameSt
+     if (dwSize > pFrameInfo->ModeInfo.dwSize)
+     {
+         VP9_ALIGNED_FREE_MEMORY(pFrameInfo->ModeInfo.pBuffer);
+-        pFrameInfo->ModeInfo.pBuffer = memalign(INTEL_HOSTVLD_VP9_PAGE_SIZE,
++        pFrameInfo->ModeInfo.pBuffer = aligned_alloc(INTEL_HOSTVLD_VP9_PAGE_SIZE,
+             dwSize * sizeof(INTEL_HOSTVLD_VP9_MODE_INFO));
+         pFrameInfo->ModeInfo.dwSize  = dwSize;
+     }

Added: head/multimedia/libva-intel-hybrid-driver/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/libva-intel-hybrid-driver/pkg-descr	Sat Nov  3 16:25:07 2018	(r483899)
@@ -0,0 +1,6 @@
+Intel hybrid driver provides support for WebM project VPx codecs. GPU
+acceleration is provided via media kernels executed on Intel GEN GPUs.
+The hybrid driver provides the CPU bound entropy (e.g., CPBAC)
+decoding and manages the GEN GPU media kernel parameters and buffers.
+
+WWW: https://01.org/linuxmedia



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811031625.wA3GP7ib058259>