Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Timo Rothenpieler <timo@rothenpieler.org>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_cuda: check that the SDK defines cuCtxGetCurrent()
Date: Sun, 1 Oct 2023 13:39:02 +0200
Message-ID: <178937dc-e800-4297-b4c3-ba4dc9e5f0a8@rothenpieler.org> (raw)
In-Reply-To: <20231001020628.2768-1-jamrial@gmail.com>

On 01.10.2023 04:06, James Almer wrote:
> Fixes compilation after 05f8b2ca0f7e28775837a572c65ce9218f534ee2

It's expected behaviour to break compilation with random inter-release 
versions of ffnvcodec.
It's only reliable exactly on release versions.

I had planned to draw a release of the headers right after, but then my 
PC started to eat files for a yet unknown reason, and I need to figure 
that out first.

A workaround for this would be to check for the existence of 
cuCtxGetCurrent in configure. But there were multiple instances of this 
exact thing in the past, and everyone agreed that it's just expected 
behaviour with development versions of both parts.

> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavutil/hwcontext_cuda.c          | 4 ++++
>   libavutil/hwcontext_cuda_internal.h | 9 +++++++++
>   2 files changed, 13 insertions(+)
> 
> diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
> index 0312d3b9d7..4f55f6441d 100644
> --- a/libavutil/hwcontext_cuda.c
> +++ b/libavutil/hwcontext_cuda.c
> @@ -362,10 +362,14 @@ static int cuda_context_init(AVHWDeviceContext *device_ctx, int flags) {
>           if (ret < 0)
>               return ret;
>       } else if (flags & AV_CUDA_USE_CURRENT_CONTEXT) {
> +#if NVDECAPI_CHECK_VERSION(12, 1)
>           ret = CHECK_CU(cu->cuCtxGetCurrent(&hwctx->cuda_ctx));
>           if (ret < 0)
>               return ret;
>           av_log(device_ctx, AV_LOG_INFO, "Using current CUDA context.\n");
> +#else
> +        return AVERROR(ENOSYS);
> +#endif
>       } else {
>           ret = CHECK_CU(cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags,
>                                          hwctx->internal->cuda_device));
> diff --git a/libavutil/hwcontext_cuda_internal.h b/libavutil/hwcontext_cuda_internal.h
> index d5633c58d5..fe0963b4e5 100644
> --- a/libavutil/hwcontext_cuda_internal.h
> +++ b/libavutil/hwcontext_cuda_internal.h
> @@ -28,6 +28,15 @@
>    * FFmpeg internal API for CUDA.
>    */
>   
> +#if defined(NVDECAPI_MAJOR_VERSION) && defined(NVDECAPI_MINOR_VERSION)
> +# define NVDECAPI_CHECK_VERSION(major, minor) \
> +    ((major) < NVDECAPI_MAJOR_VERSION || ((major) == NVDECAPI_MAJOR_VERSION && (minor) <= NVDECAPI_MINOR_VERSION))
> +#else
> +/* version macros were added in SDK 8.1 ffnvcodec */
> +# define NVDECAPI_CHECK_VERSION(major, minor) \
> +    ((major) < 8 || ((major) == 8 && (minor) <= 0))
> +#endif
> +
>   struct AVCUDADeviceContextInternal {
>       CudaFunctions *cuda_dl;
>       int is_allocated;
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-10-01 11:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-01  2:06 James Almer
2023-10-01  2:24 ` James Almer
2023-10-01 11:39 ` Timo Rothenpieler [this message]
2023-10-06 12:29   ` Hendrik Leppkes
2023-10-06 13:07     ` Timo Rothenpieler
2023-10-06 13:31       ` Hendrik Leppkes
2023-10-06 13:47         ` Timo Rothenpieler
2023-10-06 16:43           ` Hendrik Leppkes
2023-10-07 10:34             ` Timo Rothenpieler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178937dc-e800-4297-b4c3-ba4dc9e5f0a8@rothenpieler.org \
    --to=timo@rothenpieler.org \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git