VkQueueSubmit failed with a semaphore which is signaled by opengl API glSignalSemaphoreEXT()
I am working on port chromium to vulkan graphics backend. We have a use case. WebGL page use opengl to render to a texture which is imported from vulkan. And then chrome will use vulkan API to composite the texture to the final frame.
To archive that, we are using gl extensions(GL_EXT_semaphore_fd and GL_EXT_memory_object_fd) and vulkan extensions(VK_KHR_external_memory_fd and VK_KHR_external_semaphore_fd). The sharing and synchronizing steps are:
- VkSemaphore is created with vulkan API at https://cs.chromium.org/chromium/src/gpu/vulkan/vulkan_util.cc?sq=package:chromium&g=0&l=62
- Get fd from the VkSemaphore at https://cs.chromium.org/chromium/src/gpu/vulkan/vulkan_posix_util.cc?sq=package:chromium&g=0&l=56
- Duplicate fd and import duplicated fd into GL as a glsemaphore at https://cs.chromium.org/chromium/src/gpu/command_buffer/service/external_vk_image_gl_representation.cc?sq=package:chromium&g=0&l=193
- Signal the glsemaphore with glSignalSemaphoreEXT at https://cs.chromium.org/chromium/src/gpu/command_buffer/service/external_vk_image_gl_representation.cc?sq=package:chromium&g=0&l=166
- Delete the glsemaphore and vksemaphore
- Record vulkan command buffer
- Import sempahore fd in step 2 to vulkan as VkSemaphore at https://cs.chromium.org/chromium/src/gpu/command_buffer/service/external_vk_image_backing.cc?sq=package:chromium&g=0&l=588
- Use VKQueueSubmit to submit the command buffer with waiting on the VkSemaphore.
It works perfect with NVida driver, however the VkQueueSubmit failed with amdgpu on Fedora 31 with kernel .4.13-201.fc31.x86_64 (I didn't test other Linux distros).
I got errors: In console:
vk: error: failed to submit CS 0
Received signal 6
dmesg:
[ 273.918806] [drm:amdgpu_cs_ioctl [amdgpu]] *ERROR* Failed in the dependencies handling -22!
[ 274.752309] [drm:amdgpu_syncobj_lookup_and_add_to_sync [amdgpu]] *ERROR* syncobj 26 failed to find fence @ 0 (-22)!
[ 274.752360] [drm:amdgpu_cs_ioctl [amdgpu]] *ERROR* Failed in the dependencies handling -22!
[ 1959.074616] [drm:amdgpu_syncobj_lookup_and_add_to_sync [amdgpu]] *ERROR* syncobj 14 failed to find fence @ 0 (-22)!
[ 1959.074672] [drm:amdgpu_cs_ioctl [amdgpu]] *ERROR* Failed in the dependencies handling -22!