1 --- a/libavutil/hwcontext_cuda.c 2019-12-03 10:04:24.521156775 -0700
2 +++ b/libavutil/hwcontext_cuda.c 2019-12-03 10:59:03.924121027 -0700
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;
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, &dev_flags, &dev_active));
25 ret = CHECK_CU(cu->cuDevicePrimaryCtxRetain(&hwctx->cuda_ctx, hwctx->internal->cuda_device));
33 ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags, hwctx->internal->cuda_device));