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 D959447DB3 for ; Fri, 27 Oct 2023 07:37:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 460FF68CC06; Fri, 27 Oct 2023 10:37:21 +0300 (EEST) Received: from out162-62-57-210.mail.qq.com (out162-62-57-210.mail.qq.com [162.62.57.210]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F15B768CA99 for ; Fri, 27 Oct 2023 10:37:13 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1698392224; bh=knG3LvLx/tG5gxwVSuPTNdNSn5CPxqUrYivqW905j30=; h=From:To:Cc:Subject:Date; b=qBrvKuvdxKa8er1Vlrn5wcqYv3jHfpZAue0HeikkdAFPP3H2ZPY6xh3xPSX8qe1m4 0GLNiQ7Iem8eCSi3lDTphRqcVoo3YOBCs5AGVozO1zF+3gXDih/pnSdB+63jxZo5yL 6ioTXFXdoAcUz7HIinem4S3REalSbqiqAtXXOcr0= Received: from localhost.localdomain ([119.147.10.193]) by newxmesmtplogicsvrszc2-0.qq.com (NewEsmtp) with SMTP id 9430B28B; Fri, 27 Oct 2023 15:37:03 +0800 X-QQ-mid: xmsmtpt1698392223t32qqs9hw Message-ID: X-QQ-XMAILINFO: NkHKfw09D6j8aVvnMU3unEAHAFtFJDIxTyFQSlHH7Zd76WUEvlV/fHTQWI+JGd 3Uu725QeJtchTCMh0VgkgSkmDh7WlJQ+97J3M8YkNW7VOTScynOCDK5gpLSZKNpTLCGUO8F0h8jZ C9uamDKCZonngpCDo5SfIfGJzuA1OTNG+knT/Oq/reA6boa5RB0Anp0EMnJ2GqJiVmgenA12pu13 uGpLqOfPnq5l9VWiIybnTzQROzRiMvbN8uaaXJ3Qjvk57kDO4V8VylMvZ9ef6mh9IkR4Q2u5tWP9 bnBIyk4KjdLJ8B43vwh69QUu+NP8oH/H+K0zvj0UxKNnilsjCI1ZAjqH1fjTfPnFL+hX0QMkOHMu Hz06vwXjcy4NwTbxY1HatBpbTx/4LcY/q2uKekkavEksDjNiQTRMOn1iY0p6yPka4IxI9mF/ZcY0 ffzo2ptp5CHswNNCARzTN8Ge6iu0oSqOGKyCjkUTe35gITKjwPk1OQghmbB8xSlwMCUFOIv60UyA rDHMhIiABNfqoMFYsZ2UTWfZuCjOH5PJnKtkTI68jtFHTNSpVmsyL+vd3jZveEBjGS0iLwJ0/GZj 3mGtIiKUpgvjEuzDIiQNWGmqGBXaTogeytU7t2VKGf+x2bZjhTpilUjDTPUkDzTCzAlp40bc26Is I6cIiZqplWpNDrbPBsFj3EbB+Hf9EAS2rbnqS6N5EHSSTGrAdOi3nlL6jodsmmyY/VjNkNYoqA7V uNR90KelhwdOrX6plhrEY/NzkfGA0/PUXnEAsuNClGdSq6HBrMWi9C6SonTJpnhQSgE6sOOI/Ipc jUuREDclBpsq6TEL6NzWUTyOuiLkdeQYfqAcH8irXJnpiN1msiYQMgZJI90v9+HmYxhXh7ORiWts zi3wx9VMJ6Hl2/SAK+5J5PCimjNRK97B7O40jYX+cYqzoI03NJoVRDWyjyHeOGDhjzA1rXmAZL1d 9lBCtOt0PJA5PaXR3BcwA2mXwGbM6696SLsNN9Lp685nNhQfxzxnh97fl4oizT X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Fri, 27 Oct 2023 23:37:00 +0800 X-OQ-MSGID: <20231027153701.246497-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [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: , Reply-To: FFmpeg development discussions and patches Cc: Zhao Zhili 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: 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; -- 2.25.1 _______________________________________________ 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".