diff mbox

[FFmpeg-devel] Add cuDevicePrimaryCtxRetain and cuDevicePrimaryCtxRelease

Message ID 20191117125228.7977-1-olegd@anyvision.co
State New
Headers show

Commit Message

Oleg Dobkin Nov. 17, 2019, 12:52 p.m. UTC
These functions can be used to create HW cuda device using primary
contexts - which is the preferred approach.
---
 include/ffnvcodec/dynlink_cuda.h   | 2 ++
 include/ffnvcodec/dynlink_loader.h | 4 ++++
 2 files changed, 6 insertions(+)
diff mbox

Patch

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");