I recently saw that VK_EXT_acquire_xlib_display was implemented on the AGX Orin. When I tried to acquire the display, I got VK_UNKNOWN_ERROR from
vkAcquireXlibDisplayEXT. I checked that Xlib display pointer dpy and the VkDisplay passed to the function are both valid. The same code runs fine on a desktop NVIDIA GPU. The display in this case is a Valve Index, which has the non-desktop flag and isn’t used by the window manager.
Display* dpy = XOpenDisplay(nullptr);
if (dpy == nullptr) {
abort("Failed to open X display");
return;
}
uint32_t display_count;
VK_ASSERT_SUCCESS(vkGetPhysicalDeviceDisplayPropertiesKHR(vk_physical_device, &display_count, nullptr));
std::vector<VkDisplayPropertiesKHR> display_properties(display_count);
VK_ASSERT_SUCCESS(vkGetPhysicalDeviceDisplayPropertiesKHR(vk_physical_device, &display_count, display_properties.data()));
std::cout << "Found " << display_count << " displays:" << std::endl;
int index = 0;
for (const auto& display : display_properties) {
std::cout << "\t[" << index++ << "] " << display.displayName << std::endl;
}
auto display_select_str = std::getenv("XLIB_DISPLAY");
assert(display_select_str != nullptr);
int display_select = std::stoi(display_select_str);
if (display_select >= display_count) {
abort("Invalid display selection");
return;
}
display = display_properties[display_select].display;
// Now we acquire the Xlib display
auto acquire_xlib_display = (PFN_vkAcquireXlibDisplayEXT) vkGetInstanceProcAddr(vk_instance, "vkAcquireXlibDisplayEXT");
if (acquire_xlib_display == nullptr) {
abort("Failed to load vkAcquireXlibDisplayEXT");
return;
}
auto ret = acquire_xlib_display(vk_physical_device, dpy, display);
if (ret != VK_SUCCESS) {
abort("Failed to acquire Xlib display");
return;
}
std::cout << "Acquired Xlib display" << std::endl;
Thanks for any help in advance