vkswapper: syncronization issues
Describe your issue
Validation errors are show up while using a simple pipeline with Vulkan.
Expected Behavior
No validation errors.
Observed Behavior
Validation errors show up.
Setup
- Operating System: Linux
- Device: Computer
- GStreamer Version: main with !4245 (merged)
- Command line: gst-launch-1.0 videotestsrc num-buffers=10 ! vulkanupload ! vulkansink --gst-debug=vulkan*:1
Steps to reproduce the bug
- open terminal
- compile gstreamer with commit in !4245 (merged) which enables syncronization checks in the validation layer
- type
G_DEBUG=fatal-warnings gst-launch-1.0 videotestsrc num-buffers=10 ! vulkanupload ! vulkansink
- you will see this validation layer error:
(gst-launch-1.0:3759224): GStreamer-Vulkan-CRITICAL **: 11:08:54.520: [Validation] Code 0 : Validation Error:
[ SYNC-HAZARD-WRITE-AFTER-WRITE ] Object 0: handle = 0x80000000008, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x5c0ec5d6 |
vkCmdBlitImage: Hazard WRITE_AFTER_WRITE for dstImage VkImage 0x80000000008[], region 0. Access info
(usage: SYNC_BLIT_TRANSFER_WRITE, prior_usage: SYNC_CLEAR_TRANSFER_WRITE, write_barriers: 0,
command: vkCmdClearColorImage, seq_no: 3, reset_no: 19).
How reproducible is the bug?
Always.
Discussion
The error is raised here: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkswapper.c#L1173
WRITE-AFTER-WRITE Occurs when a subsequent operation writes the same set of memory locations (in whole or in part) being written by a previous operation.
Workaround
Naively, commenting out the previous command, vkCmdClearColorImage, the validation error is gone.