vulkano-rs/vulkano

Validation error and garbage image when presenting to a fullscreen surface on a different GPU's monitor

daigennki opened this issue · 2 comments

  • Version of vulkano: 0.34.1
  • OS: Arch Linux
    • Kernel (laptop): 6.1.71-1-lts
    • Kernel (desktop): 6.6.8-arch1-1
  • DE: KDE Plasma Wayland (for both laptop and desktop)

Tested GPU combinations

Laptop

  • GPU (the selected PhysicalDevice): NVIDIA GeForce RTX 3060 Mobile
    • Surface GPU: AMD Ryzen 7 5800H integrated graphics
  • GPU Driver: NVIDIA 545.29.06

Desktop PC

  • GPU (the selected PhysicalDevice): AMD Ryzen 9 7900X integrated graphics
    • Surface GPU: AMD Radeon RX 5700 XT
  • GPU Driver: radv 23.3.2

Issue

When presenting from a queue on the selected physical device to a surface on a monitor connected to a different GPU (like the above combinations), with the winit window in fullscreen mode (so some part of the compositor is bypassed), the validation layer says that this validation error has occurred, seemingly every time a present is attempted:

VUID-VkPresentInfoKHR-pImageIndices-01430(ERROR / SPEC): msgNum: 1219306694 - Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01430 ] Object 0: handle = 0x55e4d764cea0, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0x48ad24c6 | vkQueuePresentKHR(): pPresentInfo->pSwapchains[0] images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but is in VK_IMAGE_LAYOUT_UNDEFINED. The Vulkan spec states: Each element of pImageIndices must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the pSwapchains array, and the presented image subresource must be in the VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR layout at the time the operation is executed on a VkDevice (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkPresentInfoKHR-pImageIndices-01430)

When presenting from the NVIDIA GPU in the laptop, a segmentation fault occurs just after the validation error. The same occurs with XWayland.

Meanwhile, when presenting from the integrated graphics in the desktop PC, no segfault occurs, but the image is all garbage. With XWayland, the image is all black instead.

I've run the app through RenderDoc with XWayland (the app immediately closes with Wayland native because RenderDoc and Wayland might not be getting along well), and it says that the swapchain image layout is transitioned to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR just before vkQueuePresentKHR. Maybe this is actually not an issue with Vulkano, especially considering that Wayland still has some issues.

I tested this again on both of my machines with the latest packages such as Mesa 23.3.5, and it looks like the issue is no longer present. It was probably a bug in something outside of Vulkano after all.