PR #21333 opened by Kacper Michajłow (kasper93)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21333
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21333.patch


From 6f513ab06cc80c33eb1c1a396be548b3c781f2bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 31 Dec 2025 02:56:18 +0100
Subject: [PATCH 1/3] avcodec/vulkan_decode: fix logic error when checking for
 encode support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Both FF_VK_EXT_VIDEO_ENCODE_QUEUE and FF_VK_EXT_VIDEO_MAINTENANCE_1 are
required, not only one of them.

Found by VVL.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavcodec/vulkan_decode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index eb76d5b052..5ed963eacc 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -1054,8 +1054,8 @@ static int vulkan_decode_get_profile(AVCodecContext 
*avctx, AVBufferRef *frames_
                               VK_IMAGE_USAGE_TRANSFER_SRC_BIT         |
                               VK_IMAGE_USAGE_SAMPLED_BIT;
 
-        if (ctx->s.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE |
-                                 FF_VK_EXT_VIDEO_MAINTENANCE_1))
+        if ((ctx->s.extensions & FF_VK_EXT_VIDEO_ENCODE_QUEUE) &&
+            (ctx->s.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_1))
             fmt_info.imageUsage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
     }
 
@@ -1229,8 +1229,8 @@ int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef 
*hw_frames_ctx)
             hwfc->usage |= VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR;
 
         ctx = dec->shared_ctx;
-        if (ctx->s.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE |
-                                 FF_VK_EXT_VIDEO_MAINTENANCE_1))
+        if ((ctx->s.extensions & FF_VK_EXT_VIDEO_ENCODE_QUEUE) &&
+            (ctx->s.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_1))
             hwfc->usage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
     }
 
-- 
2.49.1


From d9afcfa2a8829ecd127f4bbc09a23a25dd15e499 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 31 Dec 2025 02:58:58 +0100
Subject: [PATCH 2/3] avfilter/vulkan_filter: fix logic error when checking for
 encode support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Both FF_VK_EXT_VIDEO_ENCODE_QUEUE and FF_VK_EXT_VIDEO_MAINTENANCE_1 are
required, not only one of them.

Found by VVL.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavfilter/vulkan_filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vulkan_filter.c b/libavfilter/vulkan_filter.c
index a9f47741ed..e049efec03 100644
--- a/libavfilter/vulkan_filter.c
+++ b/libavfilter/vulkan_filter.c
@@ -74,8 +74,8 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, 
FFVulkanContext *s,
         /* If format supports hardware encoding, make sure
          * the context includes it. */
         if (vk_frames->format[1] == VK_FORMAT_UNDEFINED &&
-            (s->extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE |
-                              FF_VK_EXT_VIDEO_MAINTENANCE_1))) {
+            (s->extensions & FF_VK_EXT_VIDEO_ENCODE_QUEUE) &&
+            (s->extensions & FF_VK_EXT_VIDEO_MAINTENANCE_1)) {
             VkFormatProperties3 fprops = {
                 .sType = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3,
             };
-- 
2.49.1


From 89c3e83c3b49779eba9468f780bbd71a10f1787c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= <[email protected]>
Date: Wed, 31 Dec 2025 03:00:14 +0100
Subject: [PATCH 3/3] avutil/hwcontext_vulkan: fix logic error when checking
 for encode support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Both FF_VK_EXT_VIDEO_ENCODE_QUEUE and FF_VK_EXT_VIDEO_MAINTENANCE_1 are
required, not only one of them.

Found by VVL.

Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavutil/hwcontext_vulkan.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 2011cdec79..706af35287 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -3025,8 +3025,8 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
 
         /* Enables encoding of images, if supported by format and extensions */
         if ((supported_usage & VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR) &&
-            (p->vkctx.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE |
-                                    FF_VK_EXT_VIDEO_MAINTENANCE_1)))
+            (p->vkctx.extensions & FF_VK_EXT_VIDEO_ENCODE_QUEUE) &&
+            (p->vkctx.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_1))
             hwctx->usage |= VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR;
 
         /* Image creation flags.
@@ -3049,8 +3049,8 @@ static int vulkan_frames_init(AVHWFramesContext *hwfc)
      * If there's no profile list, or it has no encode operations,
      * then allow creating the image with no specific profile. */
     if ((hwctx->usage & VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR) &&
-        (p->vkctx.extensions & (FF_VK_EXT_VIDEO_ENCODE_QUEUE |
-                                FF_VK_EXT_VIDEO_MAINTENANCE_1))) {
+        (p->vkctx.extensions & FF_VK_EXT_VIDEO_ENCODE_QUEUE) &&
+        (p->vkctx.extensions & FF_VK_EXT_VIDEO_MAINTENANCE_1)) {
         const VkVideoProfileListInfoKHR *pl;
         pl = ff_vk_find_struct(hwctx->create_pnext, 
VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR);
         if (!pl) {
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to