This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 30ba440386deb62eb9e489c8939812138a71afe6 Author: Philip Langdale <[email protected]> AuthorDate: Mon Jul 6 10:04:10 2026 -0700 Commit: philipl <[email protected]> CommitDate: Wed Jul 8 03:54:23 2026 +0000 avutil/hwcontext_vulkan: CUDA interop semaphores are per image The current semaphore logic dates back to a time where we did not have any multiplane images, and it has not kept up. As a result, we currently try and manipulate too many semaphores when dealing with multiplane images, leading to errors and crashes. Let's fix it. --- libavutil/hwcontext_vulkan.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 467ae43b19..bb0d6f203f 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -3963,6 +3963,7 @@ static int vulkan_transfer_data_from_cuda(AVHWFramesContext *hwfc, VulkanFramesPriv *fp = hwfc->hwctx; const int planes = av_pix_fmt_count_planes(hwfc->sw_format); const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(hwfc->sw_format); + int nb_images; AVHWFramesContext *cuda_fc = (AVHWFramesContext*)src->hw_frames_ctx->data; AVHWDeviceContext *cuda_cu = cuda_fc->device_ctx; @@ -3973,6 +3974,7 @@ static int vulkan_transfer_data_from_cuda(AVHWFramesContext *hwfc, CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS s_s_par[AV_NUM_DATA_POINTERS] = { 0 }; dst_f = (AVVkFrame *)dst->data[0]; + nb_images = ff_vk_count_images(dst_f); err = prepare_frame(hwfc, &fp->upload_exec, dst_f, PREP_MODE_EXTERNAL_EXPORT); if (err < 0) @@ -3990,13 +3992,13 @@ static int vulkan_transfer_data_from_cuda(AVHWFramesContext *hwfc, dst_int = dst_f->internal; - for (int i = 0; i < planes; i++) { + for (int i = 0; i < nb_images; i++) { s_w_par[i].params.fence.value = dst_f->sem_value[i] + 0; s_s_par[i].params.fence.value = dst_f->sem_value[i] + 1; } err = CHECK_CU(cu->cuWaitExternalSemaphoresAsync(dst_int->cu_sem, s_w_par, - planes, cuda_dev->stream)); + nb_images, cuda_dev->stream)); if (err < 0) goto fail; @@ -4023,11 +4025,11 @@ static int vulkan_transfer_data_from_cuda(AVHWFramesContext *hwfc, } err = CHECK_CU(cu->cuSignalExternalSemaphoresAsync(dst_int->cu_sem, s_s_par, - planes, cuda_dev->stream)); + nb_images, cuda_dev->stream)); if (err < 0) goto fail; - for (int i = 0; i < planes; i++) + for (int i = 0; i < nb_images; i++) dst_f->sem_value[i]++; CHECK_CU(cu->cuCtxPopCurrent(&dummy)); @@ -4878,7 +4880,7 @@ static int vulkan_transfer_data_to_cuda(AVHWFramesContext *hwfc, AVFrame *dst, dst_int = dst_f->internal; - for (int i = 0; i < planes; i++) { + for (int i = 0; i < nb_images; i++) { s_w_par[i].params.fence.value = dst_f->sem_value[i] + 0; s_s_par[i].params.fence.value = dst_f->sem_value[i] + 1; } @@ -4915,7 +4917,7 @@ static int vulkan_transfer_data_to_cuda(AVHWFramesContext *hwfc, AVFrame *dst, if (err < 0) goto fail; - for (int i = 0; i < planes; i++) + for (int i = 0; i < nb_images; i++) dst_f->sem_value[i]++; CHECK_CU(cu->cuCtxPopCurrent(&dummy)); _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
