Vulkan error with nvidia linux driver 387.12 and later

I’ve built a simple Vulkan program that works just fine when I’m using the NVIDIA Linux driver with a version from 375.66 to 384.130 (haven’t tested earlier versions). However, if I use version 387.12 or later, when the Vulkan program calls vkGetPhysicalDeviceSurfaceFormatsKHR, this function returns VK_ERROR_INITIALIZATION_FAILED. I tested a few later versions of the driver, up through 396.24, and got the same result. All versions that I tested were x86_64.

I am running the NixOS distribution of Linux, kernel version 4.9.104. I have an NVIDIA GeForce 980 GTX video card.

I also tried a newer kernel version, 4.14.46, with driver version 390.48, and saw the same error. I was unable to test an older (i.e. working) version of the driver with this kernel due to build failures (which might be a NixOS-specific problem).

Here is the console output of my program, when it works, to demonstrate what it does:

Window created.
All required validation layers supported.
Vulkan instance created.
Debug callback setup.
Obtained the window surface.
Found queue family indices.
All expected device extensions are supported.
Obtained physical device surface capabilities.
Obtained physical device surface formats.
Obtained physical device surface present modes.
Finished obtaining swapchain support details.
Found a suitable physical device.
Vulkan device created.
Obtained the graphics queue.
Obtained the present queue.
Swapchain created.
Obtained the swapchain images.
Swapchain image views created.
Entering main loop.
Main loop ended, cleaning up.

And when it fails:

Window created.
All required validation layers supported.
Instance created.
Debug callback setup.
Obtained the window surface.
Found queue family indices.
All expected device extensions are supported.
Obtained physical device surface capabilities.
Vulkan error (VK_ERROR_INITIALIZATION_FAILED): vkGetPhysicalDeviceSurfaceFormatsKHR failed.

I initially didn’t post a bug report, because it looks like the NixOS package for the driver doesn’t install nvidia-bug-report.sh. However, I manually extracted the .run file, and ran the script. I have no idea if it worked completely as intended when run that way, but I’ve attached the result.

Also, I found an issue on the NixOS github related to this: [url]https://github.com/NixOS/nixpkgs/issues/39149[/url]. As it suggests, with the same driver versions that prompt my program’s Vulkan error, vulkaninfo indicates 0 formats are available. Makes sense…

And apparently this issue has already been reported here, although I can’t see the page because I apparently lack membership: [url]https://developer.nvidia.com/nvidia_bug/2108502[/url].
nvidia-bug-report.log.gz (98.5 KB)

Hi,

I took a look and posted a comment on Broken vulkan surface type VK_KHR_xcb_surface with nvidia_x11 version 390.48 · Issue #39149 · NixOS/nixpkgs · GitHub