From c5e4af74850a616c42d39ed45b9b8568b71bf8bf Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Mon, 2 Jan 2023 10:01:12 -0800 Subject: [PATCH] Add cuArrayCreate It's slightly surprising that we've got this far without it, but I need it to create 2D arrays to use with the Optical Flow FRUC library. --- include/ffnvcodec/dynlink_cuda.h | 9 +++++++++ include/ffnvcodec/dynlink_loader.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/include/ffnvcodec/dynlink_cuda.h b/include/ffnvcodec/dynlink_cuda.h index 825dcf1..6ad088f 100644 --- a/include/ffnvcodec/dynlink_cuda.h +++ b/include/ffnvcodec/dynlink_cuda.h @@ -359,6 +359,14 @@ typedef struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st { typedef CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS; +typedef struct CUDA_ARRAY_DESCRIPTOR_st { + size_t Width; + size_t Height; + + CUarray_format Format; + unsigned int NumChannels; +} CUDA_ARRAY_DESCRIPTOR; + typedef struct CUDA_ARRAY3D_DESCRIPTOR_st { size_t Width; size_t Height; @@ -480,6 +488,7 @@ typedef CUresult CUDAAPI tcuDestroyExternalSemaphore(CUexternalSemaphore extSem) typedef CUresult CUDAAPI tcuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream); typedef CUresult CUDAAPI tcuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream); +typedef CUresult CUDAAPI tcuArrayCreate(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray); typedef CUresult CUDAAPI tcuArray3DCreate(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray); typedef CUresult CUDAAPI tcuArrayDestroy(CUarray hArray); diff --git a/include/ffnvcodec/dynlink_loader.h b/include/ffnvcodec/dynlink_loader.h index fefd3b8..ea8bef4 100644 --- a/include/ffnvcodec/dynlink_loader.h +++ b/include/ffnvcodec/dynlink_loader.h @@ -217,6 +217,7 @@ typedef struct CudaFunctions { tcuSignalExternalSemaphoresAsync *cuSignalExternalSemaphoresAsync; tcuWaitExternalSemaphoresAsync *cuWaitExternalSemaphoresAsync; + tcuArrayCreate *cuArrayCreate; tcuArray3DCreate *cuArray3DCreate; tcuArrayDestroy *cuArrayDestroy; @@ -380,6 +381,7 @@ static inline int cuda_load_functions(CudaFunctions **functions, void *logctx) LOAD_SYMBOL_OPT(cuSignalExternalSemaphoresAsync, tcuSignalExternalSemaphoresAsync, "cuSignalExternalSemaphoresAsync"); LOAD_SYMBOL_OPT(cuWaitExternalSemaphoresAsync, tcuWaitExternalSemaphoresAsync, "cuWaitExternalSemaphoresAsync"); + LOAD_SYMBOL(cuArrayCreate, tcuArrayCreate, "cuArrayCreate_v2"); LOAD_SYMBOL(cuArray3DCreate, tcuArray3DCreate, "cuArray3DCreate_v2"); LOAD_SYMBOL(cuArrayDestroy, tcuArrayDestroy, "cuArrayDestroy");