vkdecoder: change dstmask in decoder frame barrier

Use of VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT instead of
specific VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR

Fix for VUID-vkCmdPipelineBarrier2-srcStageMask-03849

pDependencyInfo->pImageMemoryBarriers[0].srcStageMask
(VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR) is not compatible with
the queue family properties
(VK_QUEUE_GRAPHICS_BIT|VK_QUEUE_COMPUTE_BIT|VK_QUEUE_TRANSFER_BIT|
VK_QUEUE_SPARSE_BINDING_BIT|VK_QUEUE_PROTECTED_BIT) of this
command buffer. The Vulkan spec states: The srcStageMask member
of any element of the pMemoryBarriers, pBufferMemoryBarriers, or
pImageMemoryBarriers members of pDependencyInfo must only
include pipeline stages valid for the queue family that was
used to create the command pool that commandBuffer was allocated
 from (
https://www.khronos.org/registry/vulkan/specs/1.3-extensions/
html/vkspec.html#VUID-vkCmdPipelineBarrier2-srcStageMask-03849)

The frame barrier should use a compatible srcStageMask for all
the queues.

Remove reset_pipeline_stage_mask as it is redundant

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6780>
This commit is contained in:
Stéphane Cerveau 2024-04-30 16:55:05 +02:00 committed by GStreamer Marge Bot
parent 2bcbbe0d0a
commit ddb9b9d9ca
3 changed files with 2 additions and 36 deletions

View file

@ -384,20 +384,6 @@ bail:
}
}
/* set a common pipeline stage valid for any queue to avoid Vulkan Validation
* errors */
static void
reset_pipeline_stage_mask (GstBuffer * buf)
{
guint i, n = gst_buffer_n_memory (buf);
for (i = 0; i < n; i++) {
GstVulkanImageMemory *vk_mem =
(GstVulkanImageMemory *) gst_buffer_peek_memory (buf, i);
vk_mem->barrier.parent.pipeline_stages = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
}
}
static GstVulkanH264Picture *
gst_vulkan_h264_picture_new (GstVulkanH264Decoder * self, GstBuffer * out)
{
@ -405,7 +391,6 @@ gst_vulkan_h264_picture_new (GstVulkanH264Decoder * self, GstBuffer * out)
pic = g_new0 (GstVulkanH264Picture, 1);
gst_vulkan_decoder_picture_init (self->decoder, &pic->base, out);
reset_pipeline_stage_mask (out);
return pic;
}
@ -1288,8 +1273,6 @@ gst_vulkan_h264_decoder_output_picture (GstH264Decoder * decoder,
gst_h264_picture_unref (picture);
reset_pipeline_stage_mask (frame->output_buffer);
return gst_video_decoder_finish_frame (vdec, frame);
}

View file

@ -567,20 +567,6 @@ gst_vulkan_h265_decoder_new_sequence (GstH265Decoder * decoder,
return GST_FLOW_OK;
}
/* set a common pipeline stage valid for any queue to avoid Vulkan Validation
* errors */
static void
reset_pipeline_stage_mask (GstBuffer * buf)
{
guint i, n = gst_buffer_n_memory (buf);
for (i = 0; i < n; i++) {
GstVulkanImageMemory *vk_mem =
(GstVulkanImageMemory *) gst_buffer_peek_memory (buf, i);
vk_mem->barrier.parent.pipeline_stages = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
}
}
static GstVulkanH265Picture *
gst_vulkan_h265_picture_new (GstVulkanH265Decoder * self, GstBuffer * out)
{
@ -588,7 +574,6 @@ gst_vulkan_h265_picture_new (GstVulkanH265Decoder * self, GstBuffer * out)
pic = g_new0 (GstVulkanH265Picture, 1);
gst_vulkan_decoder_picture_init (self->decoder, &pic->base, out);
reset_pipeline_stage_mask (out);
return pic;
}
@ -1630,8 +1615,6 @@ gst_vulkan_h265_decoder_output_picture (GstH265Decoder * decoder,
gst_h265_picture_unref (picture);
reset_pipeline_stage_mask (frame->output_buffer);
return gst_video_decoder_finish_frame (vdec, frame);
}

View file

@ -701,7 +701,7 @@ gst_vulkan_decoder_decode (GstVulkanDecoder * self,
VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR :
VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR;
gst_vulkan_operation_add_frame_barrier (priv->exec, pic->out,
VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR, new_layout, NULL);
/* Reference for the current image, if existing and not layered */
@ -728,7 +728,7 @@ gst_vulkan_decoder_decode (GstVulkanDecoder * self,
if (!ref_pic->dpb) {
gst_vulkan_operation_add_frame_barrier (priv->exec, ref_buf,
VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR,
VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR
| VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR,
VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR, NULL);