How do I use vkRegisterDisplayEventEXT to get vblank timing? Always returns VK_ERROR_INITIALIZATION_FAILED

Hi!

I’m trying to implement direct mode rendering to an HMD using VK_EXT_direct_mode_display and VK_EXT_acquire_xlib_display.

I have successfully created a swapchain and rendered to the device :) So far so good.

Now I’m trying to use vkRegisterDisplayEventEXT from the VK_EXT_display_control extension to get vblank timing (VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT).

But the call to vkRegisterDisplayEventEXT always returns (VK_ERROR_INITIALIZATION_FAILED (-3))

But it still writes something to the output variable and if i try to run vkDestroyFence on that value i get a crash. The fact that it writes something even though it returns an error seems like a bug, but it seems unrelated to the failure.

I get no validation errors from the validation layer so I’m fairly sure that the parameters to the call are correct.

I’m running on Ubuntu 18.04 and have tried with the 418 and 430 drivers. I’m running on a GTX 2080 Ti.

Has anyone gotten vkRegisterDisplayEventEXT to work?

1 Like

I get the same error when calling vkGetSwapchainCounterEXT from VK_EXT_display_control. See https://forums.developer.nvidia.com/t/vkgetswapchaincounterext-fails-with-vk-error-initialization-failed/283045 .

It’s a pity no one ever answered your question, so I’m also not having a lot of hope.

I have a vague memory that i eventually got it to work. Don’t remember how though but there is hope 😅 I think the key was something about getting the display de registered with x before trying to use it with the direct mode extensions. I checked some old commits but didn’t leave any hints for how i solved it there 😅