nvidia-xrun icon indicating copy to clipboard operation
nvidia-xrun copied to clipboard

Application using Vulkan goes black after switching to another tty and switching back

Open crazyboycjr opened this issue 6 years ago • 12 comments

My test shows only programs using Vulkan such as vkcube and cube suffer from this issue. glxgears, openbox-session and other programs that without Vulkan as a dependency do not have this issue.

It happens when I switch to another text console(without X running) from the openbox-session and switch back. The running Vulkan application hangs and go black there, does not print any error information.

Another issue is that if I switch back from the X session running by Intel GPU, the nvidia-xrun will stop and exit anyway. The nvidia-xrun session works fine if I switch back from a non-X tty.

I'm not sure if these two issues are related.

It matters because steam games runs with Proton on linux. Proton was just released by Valve and it can run windows games in steam through DXVK which relies on Vulkan

I am on a XPS 15 9550 laptop with a NVIDIA 960m + Intel GPU. The nvidia driver version is 396.54.

Could anyone give any tips? I can send the logs and any other information if you need.

Thanks!

crazyboycjr avatar Sep 28 '18 09:09 crazyboycjr

Now without upgrade anything including kernel and nvidia driver, even without any reboot, the second issue of switching back from origin X session to the nvidia-xrun session has gone. However, the vulkan applications still give a blackscreen and freeze there.

After upgrade the driver to 410.57, the problem still there.

Thanks

crazyboycjr avatar Oct 04 '18 06:10 crazyboycjr

OK. I think the second issue is related to that I'm using an external monitor. When I disable the internal display in openbox-session, the switch issue disappears.

crazyboycjr avatar Oct 04 '18 08:10 crazyboycjr

Did you make any progress on the Vulkan issue? I'm seeing that same problem.

mattosborn avatar Oct 27 '18 15:10 mattosborn

If you mean the second issue that switching to another X session and switching back to openbox session cause nvidia-xrun exited. I found that this only happens when my laptop is connecting to a external monitor with join displays. The issue goes away when I use single display(means turn off the laptop's internal display).

No progress on the issue of vulkan applications goes black after switch back from another tty.

crazyboycjr avatar Nov 04 '18 09:11 crazyboycjr

I can consistently replicate the same issue.

jebbster88 avatar Jan 02 '19 16:01 jebbster88

Same problem here on XPS 15 9550 with NVIDIA GTX960M and NVIDIA driver version 415.25.

connesc avatar Jan 15 '19 16:01 connesc

Same here. I ran mpv from terminal in tty2 + nvidia-xrun, switched to tty1 for a few moments, then went back to tty2, and I was spammed with these error message:

...
AV: 00:00:06 / 00:01:28 (7%) A-V: 0.000004 Vb: 94 kbps Ab: 125 kbps
[vo/vdpau] Error when uploading surface: An invalid handle value was provided.
AV: 00:00:06 / 00:01:28 (7%) A-V: 0.000004 Vb: 94 kbps Ab: 125 kbps
[vo/vdpau] Error when uploading surface: An invalid handle value was provided.
AV: 00:00:06 / 00:01:28 (7%) A-V: 0.000004 Vb: 94 kbps Ab: 125 kbps
[vo/vdpau] Recovered from display preemption.

The last one was after I switched back to tty2. So, well, I don't know, but from the sound of it, when you switch to tty1 which have a running X server, the one in tty2 will become unavailable due to the display being used by the X server in tty1? Games (or perhaps the DXVK thing itself) likely don't have any countermeasure to such behavior, so it will just continue blacking out even after we go back to tty2. Anyways, just a mere speculation on my part.

BobbyWibowo avatar Mar 04 '19 22:03 BobbyWibowo

So, any solution/workaround for this?

alex9099 avatar Jun 18 '19 18:06 alex9099

This problem is still a real pain, it ruins being able to use the desktop with intel and nvidia-xrun with steam comfortably if you plan on using Proton DXVK or even just native games with Vulkan support, i can force Proton to use OpenGL instead and it works fine and i can switch without problems but some games work much better with DXVK and some other games just outright won't work without it.

If you notice very carefully, even OpenGL applications have a momentary black screen when you switch back (at least the ones i tried do) but they are able to recover and pick back up where they left, Vulkan based applications instead crash or sometimes just stay as a black screen.

Trying to figure what is going on, using mangohud vkcube gave me the following errors when switching, not sure if it's related:

$ mangohud vkcube
'data->vtable.AllocateMemory(data->device, &alloc_info, NULL, buffer_memory)' line 1825 failed with VK_ERROR_OUT_OF_DEVICE_MEMORY
'data->vtable.AllocateMemory(data->device, &alloc_info, NULL, buffer_memory)' line 1825 failed with VK_ERROR_OUT_OF_DEVICE_MEMORY

Any new ideas on this?

teggun1 avatar Oct 31 '20 16:10 teggun1

Even though it does not solve this specific bug as a workaround i've been using prime-run (proprietary tool from nvidia i guess?), works like a charm on my laptop, either with vulkan or opengl

alex9099 avatar Nov 01 '20 02:11 alex9099

prime-run works great if you're planning to use it in the same X server, however, i prefer always running my games in a separate X server if i can help it, so i can switch back to my desktop in case a game doesn't react to well to "Alt-Tabbing" and to avoid headaches of games not setting back to my native resolution (when playing games that run in less than native resolution)

Even if i try to run a vulkan game in a separate X server with prime-run and switch around it still crashes, plus apparently power management with prime-run offloading is experimental and the nvidia card seems to always stays on in my laptop, i like nvidia-xrun more because it can actually turn it off when it's done.

It seems to only happen when using nvidia, if for example i run vkcube in two separate X servers while using the intel card i can switch between them no problem, i don't know if there's any way to fix this in software or if it's a limitation of the way the cards interact with eachother.

teggun1 avatar Nov 03 '20 17:11 teggun1

Facing the exact same issue. Opengl works fine. Guess I'm switching back to prime-run :)

Kernel: Arch 5.13.8-xanmod1-cacule-1


GPU:
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1)
00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630]


Drivers:
lib32-nvidia-utils 470.57.02-1
lib32-opencl-nvidia 470.57.02-1
nvidia-dkms 470.57.02-3
nvidia-settings 470.57.02-1
nvidia-utils 470.57.02-3
nvidia-xrun-git 0.3.83.g270b6c0-1
opencl-nvidia 470.57.02-3

intel-gmmlib 21.2.1-1
intel-media-driver 21.2.3-1
intel-media-sdk 21.2.3-1
intel-ucode 20210608-1
lib32-vulkan-intel 21.1.6-1
vulkan-intel 21.1.6-1
xf86-video-intel 1:2.99.917+916+g31486f40-1

lib32-vulkan-icd-loader 1.2.184-1
lib32-vulkan-intel 21.1.6-1
vulkan-icd-loader 1.2.185-1
vulkan-intel 21.1.6-1

marchellodev avatar Aug 06 '21 11:08 marchellodev