VK_ERROR_DEVICE_LOST when changing tty (100% Reproducible in all vulkan applications)

Whenever I change between TTYs (ctrl+alt+F1-F7) if a vulkan application is running, that application will crash with a VK_ERROR_DEVICE_LOST error, 100%, every time. This only happens on X11 window managers, doesn’t happen on Wayland.

I am on a laptop, so I am using optimus (or prime? whatever u call it), I haven’t managed to test this on a proper desktop because I don’t haev one, so it’d be appreciated if someone who has one could see if desktops are affected as well.

Reproduction Steps:

  1. Run a vulkan application on the nvidia (vkcube will do) on any X11 window manager.
  2. Change to another TTY (ctrl+alt+F1-F7)
  3. Go back to X11

And now the application will have crashed, if it has any way to output errors, the error is going to be VK_ERROR_DEVICE_LOST or XNVCtrl didn't find the correct display.

OpenGL applications are unaffected.

nvidia-bug-report.log.gz (1.3 MB)

I managed to work around the issue by creating a xorg.conf entry for the igpu.

In /etc/X11/xorg.conf.d/00-igpu.conf

Section "Device"
   Identifier  "Radeon"
   Driver      "amdgpu"
   Option "TearFree" "true"
EndSection

Creating this entry prevented this issue (but it’s very strange, since it’s not like xorg wasn’t already using the igpu.)

The tearfree option wasn’t needed to solve the issue, but without it there were some weird framerate issues whenever i went back to the X tty (everything would render in slowmo, and although i’m on a 240hz display it’d never render faster than 60fps).