[vlc-devel] [PATCH 1/6] contrib: add nvcodec headers from FFmpeg
Steve Lhomme
robux4 at ycbcr.xyz
Thu Sep 12 14:44:17 CEST 2019
---
.../src/nvcodec/0001-Add-cuCtxGetDevice.patch | 49 +++++++++++++++++++
...ding-the-PREFIX-from-the-environment.patch | 13 +++++
contrib/src/nvcodec/SHA512SUMS | 1 +
contrib/src/nvcodec/rules.mak | 21 ++++++++
4 files changed, 84 insertions(+)
create mode 100644 contrib/src/nvcodec/0001-Add-cuCtxGetDevice.patch
create mode 100644 contrib/src/nvcodec/0001-allow-overriding-the-PREFIX-from-the-environment.patch
create mode 100644 contrib/src/nvcodec/SHA512SUMS
create mode 100644 contrib/src/nvcodec/rules.mak
diff --git a/contrib/src/nvcodec/0001-Add-cuCtxGetDevice.patch b/contrib/src/nvcodec/0001-Add-cuCtxGetDevice.patch
new file mode 100644
index 00000000000..7026b5f92d5
--- /dev/null
+++ b/contrib/src/nvcodec/0001-Add-cuCtxGetDevice.patch
@@ -0,0 +1,49 @@
+From e8cf191007103df27207b33a396dc41dca9b05a4 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Tue, 10 Sep 2019 13:42:14 +0200
+Subject: [PATCH] Add cuCtxGetDevice
+
+It can be useful to determine if the decoder context is the same as the display
+context.
+
+It's used in some samples at https://github.com/NVIDIA/video-sdk-samples
+---
+ include/ffnvcodec/dynlink_cuda.h | 1 +
+ include/ffnvcodec/dynlink_loader.h | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/include/ffnvcodec/dynlink_cuda.h b/include/ffnvcodec/dynlink_cuda.h
+index ad5da7c..cc1cc00 100644
+--- a/include/ffnvcodec/dynlink_cuda.h
++++ b/include/ffnvcodec/dynlink_cuda.h
+@@ -329,6 +329,7 @@ typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy);
+ typedef CUresult CUDAAPI tcuMemcpy2DAsync_v2(const CUDA_MEMCPY2D *pcopy, CUstream hStream);
+ typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr);
+ typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pstr);
++typedef CUresult CUDAAPI tcuCtxGetDevice(CUdevice *device);
+
+ typedef CUresult CUDAAPI tcuStreamCreate(CUstream *phStream, unsigned int flags);
+ typedef CUresult CUDAAPI tcuStreamQuery(CUstream hStream);
+diff --git a/include/ffnvcodec/dynlink_loader.h b/include/ffnvcodec/dynlink_loader.h
+index 358acd5..a1fa323 100644
+--- a/include/ffnvcodec/dynlink_loader.h
++++ b/include/ffnvcodec/dynlink_loader.h
+@@ -156,6 +156,7 @@ typedef struct CudaFunctions {
+ tcuMemcpy2DAsync_v2 *cuMemcpy2DAsync;
+ tcuGetErrorName *cuGetErrorName;
+ tcuGetErrorString *cuGetErrorString;
++ tcuCtxGetDevice *cuCtxGetDevice;
+
+ tcuStreamCreate *cuStreamCreate;
+ tcuStreamQuery *cuStreamQuery;
+@@ -280,6 +281,7 @@ static inline int cuda_load_functions(CudaFunctions **functions, void *logctx)
+ LOAD_SYMBOL(cuMemcpy2DAsync, tcuMemcpy2DAsync_v2, "cuMemcpy2DAsync_v2");
+ LOAD_SYMBOL(cuGetErrorName, tcuGetErrorName, "cuGetErrorName");
+ LOAD_SYMBOL(cuGetErrorString, tcuGetErrorString, "cuGetErrorString");
++ LOAD_SYMBOL(cuCtxGetDevice, tcuCtxGetDevice, "cuCtxGetDevice");
+
+ LOAD_SYMBOL(cuStreamCreate, tcuStreamCreate, "cuStreamCreate");
+ LOAD_SYMBOL(cuStreamQuery, tcuStreamQuery, "cuStreamQuery");
+--
+2.19.1.windows.1
+
diff --git a/contrib/src/nvcodec/0001-allow-overriding-the-PREFIX-from-the-environment.patch b/contrib/src/nvcodec/0001-allow-overriding-the-PREFIX-from-the-environment.patch
new file mode 100644
index 00000000000..32389a9c542
--- /dev/null
+++ b/contrib/src/nvcodec/0001-allow-overriding-the-PREFIX-from-the-environment.patch
@@ -0,0 +1,13 @@
+diff --git a/Makefile b/Makefile
+index a51c2c9..c3a9209 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,4 @@
+-PREFIX = /usr/local
++PREFIX ?= /usr/local
+ LIBDIR = lib
+ INSTALL = install
+ SED = sed
+--
+2.19.1.windows.1
+
diff --git a/contrib/src/nvcodec/SHA512SUMS b/contrib/src/nvcodec/SHA512SUMS
new file mode 100644
index 00000000000..bda8cedffa9
--- /dev/null
+++ b/contrib/src/nvcodec/SHA512SUMS
@@ -0,0 +1 @@
+e5261586d2207862230fa0ce8299b423c5db52d79754703741b4f77f02c73e9ab4c801caf54102566fdc795a9d6c5ec0bcfe7c78aa093fde0dcd9b8b554077c5 nvcodec-96a6db017b096ad48612890083464a7214902afa.tar.xz
diff --git a/contrib/src/nvcodec/rules.mak b/contrib/src/nvcodec/rules.mak
new file mode 100644
index 00000000000..ff16d0288f9
--- /dev/null
+++ b/contrib/src/nvcodec/rules.mak
@@ -0,0 +1,21 @@
+NVCODEC_HASH := 96a6db017b096ad48612890083464a7214902afa
+NVCODEC_GITURL := https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
+
+ifndef HAVE_DARWIN_OS
+PKGS += nvcodec
+endif
+
+$(TARBALLS)/nvcodec-$(NVCODEC_HASH).tar.xz:
+ $(call download_git,$(NVCODEC_GITURL),,$(NVCODEC_HASH))
+
+.sum-nvcodec: nvcodec-$(NVCODEC_HASH).tar.xz
+
+nvcodec: nvcodec-$(NVCODEC_HASH).tar.xz .sum-nvcodec
+ $(UNPACK)
+ $(APPLY) $(SRC)/nvcodec/0001-allow-overriding-the-PREFIX-from-the-environment.patch
+ $(APPLY) $(SRC)/nvcodec/0001-Add-cuCtxGetDevice.patch
+ $(MOVE)
+
+.nvcodec: nvcodec-$(NVCODEC_HASH).tar.xz nvcodec
+ cd nvcodec && PREFIX="$(PREFIX)" make install
+ touch $@
--
2.17.1
More information about the vlc-devel
mailing list