I am trying to use the Vulkan API for compute on my Tesla P4. It works great in general, however I want to use a specific feature that was announced to be supported in recent driver updates:
- Added support for the EGL_ANDROID_native_fence_sync EGL extension
and the VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT and
VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT Vulkan external handle
types when the nvidia-drm kernel module is loaded with the modeset=1
parameter.
Specifically, I want to use VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD
I am reasonably convinced that my code is correct because I have no problem retrieving VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD. I am of course happy to share my full code if needed but here is the critical section:
VkExportFenceCreateInfo exportFenceInfo =
{
.sType = VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO,
.handleTypes = VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT
};
VkFenceCreateInfo fenceCreateInfo =
{
.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO,
.pNext = &exportFenceInfo,
};
VkFence fence;
vkCreateFence(device, &fenceCreateInfo, NULL, &fence);
VkFenceGetFdInfoKHR getFdInfo = {
.sType = VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR,
.fence = fence,
.handleType = VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT
};
Int fd;
vkGetFenceFdKHR( device, &getFdInfo, &fd ):
When I call vkGetFenceFdKHR it returns -8
VK_KHR_external_fence and VK_KHR_external_fence_fd extensions are loaded on the device and if I substitute VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD with VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD the code works fine, vkGetFenceFdKHR return VK_SUCCESS and fd contain a valid file descriptor.
The release notes say “when the nvidia-drm kernel module is loaded with the modeset=1 parameter.”
I believe I have done this; if I run
sudo cat /sys/module/nvidia_drm/parameters/modeset
I get “Y”, so I believe modeset is set correctly.
Any insight your team may be able to provide is as always most welcomed! .. and this is of course not urgent in any way! 😊
I guess my fundamental question is whether VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD is actually supported on my Tesla P4?