diff mbox series

[FFmpeg-devel,6/7] libavutil/hwcontext_vulkan: fix a sem_wait bug when export drm

Message ID 20211109091843.2024927-6-wenbin.chen@intel.com
State New
Headers show
Series [FFmpeg-devel,1/7] hwcontext_vaapi: Use PRIME_2 memory type for modifiers. | expand

Checks

Context Check Description
andriy/configurex86 warning Failed to apply patch
andriy/configureppc warning Failed to apply patch

Commit Message

Wenbin Chen Nov. 9, 2021, 9:18 a.m. UTC
sem_sig_val is wrongly assigned to pWaitSemaphoreValues when export drm. Now fix
it.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 libavutil/hwcontext_vulkan.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Lynne Nov. 10, 2021, 7:55 a.m. UTC | #1
9 Nov 2021, 10:18 by wenbin.chen@intel.com:

> sem_sig_val is wrongly assigned to pWaitSemaphoreValues when export drm. Now fix
> it.
>
> Signed-off-by: Wenbin Chen <> wenbin.chen@intel.com> >
>

Thanks for spotting this, I fixed that in my patchset and updated branch.
frame->sem_value is safe to use for waiting, as it's only updated after
the command buffer is successfully submitted.
Wenbin Chen Nov. 11, 2021, 6:42 a.m. UTC | #2
> 9 Nov 2021, 10:18 by wenbin.chen@intel.com:
> 
> > sem_sig_val is wrongly assigned to pWaitSemaphoreValues when export
> drm. Now fix
> > it.
> >
> > Signed-off-by: Wenbin Chen <> wenbin.chen@intel.com> >
> >
> 
> Thanks for spotting this, I fixed that in my patchset and updated branch.
> frame->sem_value is safe to use for waiting, as it's only updated after
> the command buffer is successfully submitted.
> 
Ok, Got it.
 
Thanks
Wenbin
> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index b857d1a9ed..29ade94b7f 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1718,7 +1718,7 @@  static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
     const int planes = av_pix_fmt_count_planes(hwfc->sw_format);
     VulkanDevicePriv *p = hwfc->device_ctx->internal->priv;
     FFVulkanFunctions *vk = &p->vkfn;
-    uint64_t sem_sig_val[AV_NUM_DATA_POINTERS];
+    uint64_t sem_sig_val[AV_NUM_DATA_POINTERS], sem_wait_val[AV_NUM_DATA_POINTERS];
 
     VkImageMemoryBarrier img_bar[AV_NUM_DATA_POINTERS] = { 0 };
 
@@ -1738,6 +1738,7 @@  static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
     VkPipelineStageFlagBits wait_st[AV_NUM_DATA_POINTERS];
     for (int i = 0; i < planes; i++) {
         wait_st[i] = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
+        sem_wait_val[i] = frame->sem_value[i];
         sem_sig_val[i] = frame->sem_value[i] + 1;
     }
 
@@ -1756,7 +1757,7 @@  static int prepare_frame(AVHWFramesContext *hwfc, VulkanExecCtx *ectx,
         new_layout = VK_IMAGE_LAYOUT_GENERAL;
         new_access = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT;
         dst_qf     = VK_QUEUE_FAMILY_EXTERNAL_KHR;
-        s_timeline_sem_info.pWaitSemaphoreValues = sem_sig_val;
+        s_timeline_sem_info.pWaitSemaphoreValues = sem_wait_val;
         s_timeline_sem_info.waitSemaphoreValueCount = planes;
         s_info.pWaitSemaphores = frame->sem;
         s_info.pWaitDstStageMask = wait_st;