Direct mode on non-head mounted displays : Mesa OK but not Nvidia?


I am developping a software where i need to do direct display using vulkan, on X11.

I got it right on Mesa for now :

  • set the non-desktop attribute to 1 with xrandr
  • get the VkDisplayKHR using vkGetRandROutputDisplayEXT (because display is not listed with vkGetPhysicalDeviceDisplayPropertiesKHR)
  • call vkAcquireXlibDisplayEXT
  • set up the swapchain with the VkDisplayKHR

On Nvidia :
This method produces a VK_ERROR_UNKNOWN when calling vkAcquireXlibDisplayEXT.
From the information I gathered

  • I can use vkGetPhysicalDeviceDisplayPropertiesKHR directly to search for my display (indeed, it is there even if non-desktop is set to 1)
  • the non-desktop attribute is not a sufficient condition for the driver to acquire the display

What is unclear is what is necessary for vkAcquireXlibDisplayEXT to work on nvidia cards.
In fact, head mounted displays are set up a certain way by the driver when connected : the desktop does not extend to theses displays per default. For instance, if one would want to extend the desktop to a HMD, they would need to use the option "AllowHMD " "yes".

So I tried to un-extend the desktop to the display I want to acquire for direct display :

  • xrandr --output *name_of_the_display* --off
  • “Nvidia X Server Settings” → “X Server Display Configuration” → (display selection) → “Configuration : Disabled” → “Apply”

But neither seem to be enough

How should I set up the non-head mounted display before calling vkAcquireXlibDisplayEXT ?

Adrien Grosjean