From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 023E0469E8 for ; Sun, 1 Oct 2023 11:39:18 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 53B3368CD8F; Sun, 1 Oct 2023 14:39:15 +0300 (EEST) Received: from btbn.de (btbn.de [136.243.74.85]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1BDEE68CD8F for ; Sun, 1 Oct 2023 14:39:08 +0300 (EEST) Received: from [authenticated] by btbn.de (Postfix) with ESMTPSA id 680214137B9 for ; Sun, 1 Oct 2023 13:39:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rothenpieler.org; s=mail; t=1696160345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8VXXNNH4u5U7q/mo+HkEhvy3foIh6FkXb9M4JBIsT4E=; b=X3/fF9WDGILlb9BAD6kueHCTJj9I93lnyXOd3U+8K5lc6jM2y1hLp7v5D+8QmmLZBViDmI l0S0SqraTOCpHZTV46jONVjERfehr5kDCjH7s7gkJjyuUfrhnbz5zLQ884lBQ4LgFpY2jA GWtZUM9h7CtyeI5uaZdAsZhBcaGnSjbr34cENnNQjf6kzmq8VrldUduuOdtoffcZZICGww bqWrgS94qO7ZJIlP4F6m1IEUk/D3zcrSlfAS5GE1CLbdTaPR7pqyxRtyGHHx/nm+/xwTKn AHcqdD+vBZ9RyHFeSjWKfT5UTVjVImLXMMzx030fL/SyubO0VtxhI04doqMwBg== Message-ID: <178937dc-e800-4297-b4c3-ba4dc9e5f0a8@rothenpieler.org> Date: Sun, 1 Oct 2023 13:39:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: ffmpeg-devel@ffmpeg.org References: <20231001020628.2768-1-jamrial@gmail.com> Content-Language: en-US From: Timo Rothenpieler In-Reply-To: <20231001020628.2768-1-jamrial@gmail.com> Subject: Re: [FFmpeg-devel] [PATCH] avutil/hwcontext_cuda: check that the SDK defines cuCtxGetCurrent() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 > --- > 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".