1 --- a/libavutil/hwcontext_cuda.c
2 +++ b/libavutil/hwcontext_cuda.c
4 CudaFunctions *cu = hwctx->internal->cuda_dl;
6 if (hwctx->internal->is_allocated && hwctx->cuda_ctx) {
7 +#ifdef CUDA_PRIMARY_CTX
8 if (hwctx->internal->flags & AV_CUDA_USE_PRIMARY_CONTEXT)
9 CHECK_CU(cu->cuDevicePrimaryCtxRelease(hwctx->internal->cuda_device));
12 CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx));
14 hwctx->cuda_ctx = NULL;
16 cu = hwctx->internal->cuda_dl;
18 hwctx->internal->flags = flags;
20 +#ifdef CUDA_PRIMARY_CTX
21 if (flags & AV_CUDA_USE_PRIMARY_CONTEXT) {
22 ret = CHECK_CU(cu->cuDevicePrimaryCtxGetState(hwctx->internal->cuda_device,
23 &dev_flags, &dev_active));
25 hwctx->internal->cuda_device));
32 ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags,
33 hwctx->internal->cuda_device));