Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Philip Langdale via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Philip Langdale <philipl@overt.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/2] avutil/hwcontext_vulkan: cuda doesn't belong to valid_sw_formats
Date: Fri, 27 Oct 2023 09:48:03 -0700
Message-ID: <20231027094803.2f43477c@fido7> (raw)
In-Reply-To: <tencent_C2D8A7D0AA8093021C4E8B83263B9082A606@qq.com>

On Fri, 27 Oct 2023 23:37:00 +0800
Zhao Zhili <quinkblack@foxmail.com> wrote:

> From: Zhao Zhili <zhilizhao@tencent.com>
> 
> 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".

  reply	other threads:[~2023-10-27 16:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27 15:37 Zhao Zhili
2023-10-27 16:48 ` Philip Langdale via ffmpeg-devel [this message]
2023-10-29  6:12 ` Lynne
2023-10-29  8:55   ` Zhao Zhili

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=20231027094803.2f43477c@fido7 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=philipl@overt.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