[FFmpeg-devel] [PATCH] Add cuDevicePrimaryCtxRetain and cuDevicePrimaryCtxRelease
Oleg Dobkin
olegd at anyvision.co
Mon Nov 18 10:53:44 EET 2019
These functions can be used to create HW cuda device using primary
contexts - which is the preferred approach.
Signed-off-by: Oleg Dobkin <olegd at anyvision.co>
---
ffnvcodec.pc.in | 2 +-
include/ffnvcodec/dynlink_cuda.h | 2 ++
include/ffnvcodec/dynlink_loader.h | 4 ++++
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ffnvcodec.pc.in b/ffnvcodec.pc.in
index 7799048..2a6318f 100644
--- a/ffnvcodec.pc.in
+++ b/ffnvcodec.pc.in
@@ -3,5 +3,5 @@ includedir=${prefix}/include
Name: ffnvcodec
Description: FFmpeg version of Nvidia Codec SDK headers
-Version: 9.1.23.1
+Version: 9.1.23.2
Cflags: -I${includedir}
diff --git a/include/ffnvcodec/dynlink_cuda.h b/include/ffnvcodec/dynlink_cuda.h
index 5c85e0d..bf0ed9f 100644
--- a/include/ffnvcodec/dynlink_cuda.h
+++ b/include/ffnvcodec/dynlink_cuda.h
@@ -331,6 +331,8 @@ typedef CUresult CUDAAPI tcuMemcpy2DAsync_v2(const CUDA_MEMCPY2D *pcopy, CUstrea
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 tcuDevicePrimaryCtxRetain(CUcontext *pctx, CUdevice dev);
+typedef CUresult CUDAAPI tcuDevicePrimaryCtxRelease(CUdevice dev);
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 a1fa323..f471200 100644
--- a/include/ffnvcodec/dynlink_loader.h
+++ b/include/ffnvcodec/dynlink_loader.h
@@ -157,6 +157,8 @@ typedef struct CudaFunctions {
tcuGetErrorName *cuGetErrorName;
tcuGetErrorString *cuGetErrorString;
tcuCtxGetDevice *cuCtxGetDevice;
+ tcuDevicePrimaryCtxRetain *cuDevicePrimaryCtxRetain;
+ tcuDevicePrimaryCtxRelease *cuDevicePrimaryCtxRelease;
tcuStreamCreate *cuStreamCreate;
tcuStreamQuery *cuStreamQuery;
@@ -282,6 +284,8 @@ static inline int cuda_load_functions(CudaFunctions **functions, void *logctx)
LOAD_SYMBOL(cuGetErrorName, tcuGetErrorName, "cuGetErrorName");
LOAD_SYMBOL(cuGetErrorString, tcuGetErrorString, "cuGetErrorString");
LOAD_SYMBOL(cuCtxGetDevice, tcuCtxGetDevice, "cuCtxGetDevice");
+ LOAD_SYMBOL(cuDevicePrimaryCtxRetain, tcuDevicePrimaryCtxRetain, "cuDevicePrimaryCtxRetain");
+ LOAD_SYMBOL(cuDevicePrimaryCtxRelease, tcuDevicePrimaryCtxRelease, "cuDevicePrimaryCtxRelease");
LOAD_SYMBOL(cuStreamCreate, tcuStreamCreate, "cuStreamCreate");
LOAD_SYMBOL(cuStreamQuery, tcuStreamQuery, "cuStreamQuery");
--
2.17.1
More information about the ffmpeg-devel
mailing list