Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PR] hwdec/vulkan: fix invalid number of planes usage in map_to_drm (PR #21781)
@ 2026-02-18  9:58 lompik via ffmpeg-devel
  0 siblings, 0 replies; only message in thread
From: lompik via ffmpeg-devel @ 2026-02-18  9:58 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: lompik

PR #21781 opened by lompik
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21781
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21781.patch

This fixes a SIGSEGV happening (for >1 plane images) in drivers as we
are sending a null semaphore for them to wait on.
for example: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20057


>From 38cd91c99a626ef12ba46e34be7a8308c9e84085 Mon Sep 17 00:00:00 2001
From: lompik <lompik@noreply.code.ffmpeg.org>
Date: Wed, 18 Feb 2026 13:48:04 +0400
Subject: [PATCH] hwdec/vulkan: fix invalid number of planes usage in
 map_to_drm

This fixes a SIGSEGV happening (for >1 plane images) in drivers as we
are sending a null semaphore for them to wait on.
---
 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 123ae4363c..3bcf5d732f 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -4153,14 +4153,14 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst,
     AVVulkanDeviceContext *hwctx = &p->p;
     FFVulkanFunctions *vk = &p->vkctx.vkfn;
     VulkanFramesPriv *fp = hwfc->hwctx;
-    const int planes = av_pix_fmt_count_planes(hwfc->sw_format);
+    const int nb_images = ff_vk_count_images(f);
     VkImageDrmFormatModifierPropertiesEXT drm_mod = {
         .sType = VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT,
     };
     VkSemaphoreWaitInfo wait_info = {
         .sType          = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO,
         .flags          = 0x0,
-        .semaphoreCount = planes,
+        .semaphoreCount = nb_images,
     };
 
     AVDRMFrameDescriptor *drm_desc = av_mallocz(sizeof(*drm_desc));
@@ -4189,7 +4189,7 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst,
         goto end;
     }
 
-    for (int i = 0; (i < planes) && (f->mem[i]); i++) {
+    for (int i = 0; (i < nb_images) && (f->mem[i]); i++) {
         VkMemoryGetFdInfoKHR export_info = {
             .sType      = VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR,
             .memory     = f->mem[i],
@@ -4209,7 +4209,7 @@ static int vulkan_map_to_drm(AVHWFramesContext *hwfc, AVFrame *dst,
         drm_desc->objects[i].format_modifier = drm_mod.drmFormatModifier;
     }
 
-    drm_desc->nb_layers = planes;
+    drm_desc->nb_layers = nb_images;
     for (int i = 0; i < drm_desc->nb_layers; i++) {
         VkFormat plane_vkfmt = av_vkfmt_from_pixfmt(hwfc->sw_format)[i];
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-18  9:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-18  9:58 [FFmpeg-devel] [PR] hwdec/vulkan: fix invalid number of planes usage in map_to_drm (PR #21781) lompik via ffmpeg-devel

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