c94880d020e778fb7db7558eabbef24a87d81c12
[goodguy/cinelerra.git] / cinelerra-5.1 / thirdparty / src / ffmpeg.git.patch10
1 --- a/libavutil/hwcontext_cuda.c
2 +++ b/libavutil/hwcontext_cuda.c
3 @@ -286,9 +286,11 @@
4          CudaFunctions *cu = hwctx->internal->cuda_dl;
5  
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));
10              else
11 +#endif
12                  CHECK_CU(cu->cuCtxDestroy(hwctx->cuda_ctx));
13  
14              hwctx->cuda_ctx = NULL;
15 @@ -338,7 +340,7 @@
16      cu = hwctx->internal->cuda_dl;
17  
18      hwctx->internal->flags = flags;
19 -
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));
24 @@ -359,7 +361,9 @@
25                                                      hwctx->internal->cuda_device));
26          if (ret < 0)
27              return ret;
28 -    } else {
29 +    } else
30 +#endif
31 +    {
32          ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags,
33                                         hwctx->internal->cuda_device));
34          if (ret < 0)