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 1CD7447DFA for ; Fri, 27 Oct 2023 16:48:17 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 24D1568CB3F; Fri, 27 Oct 2023 19:48:15 +0300 (EEST) Received: from mail.overt.org (mail.overt.org [72.14.183.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F013568CAA4 for ; Fri, 27 Oct 2023 19:48:08 +0300 (EEST) Received: from authenticated-user (mail.overt.org [72.14.183.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.overt.org (Postfix) with ESMTPSA id BBDF8605D4 for ; Fri, 27 Oct 2023 11:48:05 -0500 (CDT) Date: Fri, 27 Oct 2023 09:48:03 -0700 To: ffmpeg-devel@ffmpeg.org Message-ID: <20231027094803.2f43477c@fido7> In-Reply-To: References: MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/2] avutil/hwcontext_vulkan: cuda doesn't belong to valid_sw_formats 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: , From: Philip Langdale via ffmpeg-devel Reply-To: FFmpeg development discussions and patches Cc: Philip Langdale Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Fri, 27 Oct 2023 23:37:00 +0800 Zhao Zhili wrote: > From: Zhao Zhili > > Move it to transfer_get_formats. > --- > libavutil/hwcontext_vulkan.c | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/libavutil/hwcontext_vulkan.c > b/libavutil/hwcontext_vulkan.c index 8dd40cb66f..8481427b42 100644 > --- a/libavutil/hwcontext_vulkan.c > +++ b/libavutil/hwcontext_vulkan.c > @@ -1664,11 +1664,6 @@ static int > vulkan_frames_get_constraints(AVHWDeviceContext *ctx, NULL, NULL, > NULL, NULL, 0, 0) >= 0; } > > -#if CONFIG_CUDA > - if (p->dev_is_nvidia) > - count++; > -#endif > - > constraints->valid_sw_formats = av_malloc_array(count + 1, > sizeof(enum > AVPixelFormat)); if (!constraints->valid_sw_formats) > @@ -1684,10 +1679,6 @@ static int > vulkan_frames_get_constraints(AVHWDeviceContext *ctx, } > } > > -#if CONFIG_CUDA > - if (p->dev_is_nvidia) > - constraints->valid_sw_formats[count++] = AV_PIX_FMT_CUDA; > -#endif > constraints->valid_sw_formats[count++] = AV_PIX_FMT_NONE; > > constraints->min_width = 1; > @@ -2416,12 +2407,22 @@ static int > vulkan_transfer_get_formats(AVHWFramesContext *hwfc, enum > AVHWFrameTransferDirection dir, enum AVPixelFormat **formats) > { > - enum AVPixelFormat *fmts = av_malloc_array(2, sizeof(*fmts)); > + enum AVPixelFormat *fmts; > + int n = 2; > + > +#if CONFIG_CUDA > + n++; > +#endif > + fmts = av_malloc_array(n, sizeof(*fmts)); > if (!fmts) > return AVERROR(ENOMEM); > > - fmts[0] = hwfc->sw_format; > - fmts[1] = AV_PIX_FMT_NONE; > + n = 0; > + fmts[n++] = hwfc->sw_format; > +#if CONFIG_CUDA > + fmts[n++] = AV_PIX_FMT_CUDA; > +#endif > + fmts[n++] = AV_PIX_FMT_NONE; > > *formats = fmts; > return 0; LGTM. Thanks! --phil _______________________________________________ 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".