Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Linux + NVIDIA Optimus with dedicated displays (Reverse Prime) #1215

Closed
rnd-ash opened this issue Feb 12, 2021 · 5 comments
Closed
Labels
external: driver-bug A driver is causing the bug, though we may still want to work around it help required We need community help to make this happen. platform: hybrid graphics Issues with machines with attached integrated and dedicated gpus type: bug Something isn't working

Comments

@rnd-ash
Copy link

rnd-ash commented Feb 12, 2021

Description
So on Linux with Optimus capable laptops there are 2 providers for Vulkan:

  1. vulkan-intel

  2. nvidia-utils
    Issue here is that when using external monitors, I am using the NVIDIA GPU. When I am using only my laptops display, the NVIDIA GPU is turned off and therefore only the Intel GPU is active. This causes some unique behavior under the following circumstances:

  3. If Vulkan-intel is installed AND I am plugged into an external monitor (NVIDIA GPU active), wgpu will attempt to load the Intel Vulkan provider when the rendering GPU is actually the NVIDIA one, causing a white screen followed by a crash.

  4. If Vulkan-intel is NOT installed, and NVIDIA GPU is OFF, starting a wgpu application throws GraphicsAdapterNotFound.

NOTE: It is impossible to remove the nvidia-utils package on Arch Linux as it is a dependency of the NVIDIA driver. Where as the vulkan-intel package is an optional extra for Intel GPUs.

Repro steps
The following MUST be done on a a system with NVIDIA Reverse prime (External monitors connected directly to the NVIDIA GPU, with Intel GPU driving the internal laptop display)

  1. Boot up with NVIDIA GPU connected to external displays
  2. Install both Intel and Nvidia Vulkan providers
  3. Open a WGPU application, it will show a white screen before crashing to desktop.

Expected vs observed behavior
Simply put, the only step theoretically needed would be to check if the Intel and NVIDIA Vulkan providers are both installed, and pick the NVIDIA provider rather than the Intel one if the NVIDIA GPU is active in the system. This way, both the Intel and NVIDIA Vulkan providers can co-exist.

There is a way to do this with environment variables, however it is a bit messy.

Platform
OS: Arch Linux
System: Razer blade 2018 (Intel UHD630 + GTX 1060 Maxq)
X11 session (No Wayland)

@kvark
Copy link
Member

kvark commented Feb 12, 2021

Thank you for filing such a detailed issue!

There is a way to do this with environment variables, however it is a bit messy.

Selecting an ICD is the job of Vulkan Loader, not wgpu. We are just using whatever the loader shows us. So this sounds like a system configuration issue to me, rather than a library issue?

wgpu will attempt to load the Intel Vulkan provider when the rendering GPU is actually the NVIDIA one, causing a white screen followed by a crash.

This is definitely undesired. What kind of crash is it?
What do Vulkan apps (e.g. vkcube) do in this case?

@kvark kvark added help required We need community help to make this happen. type: bug Something isn't working labels Feb 12, 2021
@Tim-Paik
Copy link

Same problem, it says Disabling presentation on 'Intel(R) UHD Graphics 630 (CFL GT2)' (id 0x564872e3d830) because of NV Optimus (on Linux) and Unrecognized device error ERROR_INITIALIZATION_FAILED

vkcube: Selected GPU 1: NVIDIA GeForce GTX 1060, type: DiscreteGpu

SYSTEM: Arch Linux GNOME (Wayland)

PS: vkcube is running in xwayland mode, but it works

@teoxoy
Copy link
Member

teoxoy commented Feb 27, 2023

wgpu will attempt to load the Intel Vulkan provider when the rendering GPU is actually the NVIDIA one, causing a white screen followed by a crash.

This was a driver issue that we worked around in #1898. The Nvidia GPU should now get picked over the Intel one.

@teoxoy teoxoy closed this as completed Feb 27, 2023
@teoxoy teoxoy added the external: driver-bug A driver is causing the bug, though we may still want to work around it label Feb 27, 2023
@teoxoy
Copy link
Member

teoxoy commented Feb 27, 2023

@Tim-Paik please open a new issue since I think we've dealt with this one.

SYSTEM: Arch Linux GNOME (Wayland)

As far as I know, Reverse Prime doesn't work on Wayland.

PS: vkcube is running in xwayland mode, but it works

Please try vkcube-wayland and if it works but wgpu doesn't, that means we might be missing something.

@Tim-Paik
Copy link

Tim-Paik commented Mar 3, 2023

@Tim-Paik please open a new issue since I think we've dealt with this one.

SYSTEM: Arch Linux GNOME (Wayland)

As far as I know, Reverse Prime doesn't work on Wayland.

PS: vkcube is running in xwayland mode, but it works

Please try vkcube-wayland and if it works but wgpu doesn't, that means we might be missing something.

Yep, you're right, it's an upstream bug. Thanks for the reminder, vkcube-wayland doesn't work either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external: driver-bug A driver is causing the bug, though we may still want to work around it help required We need community help to make this happen. platform: hybrid graphics Issues with machines with attached integrated and dedicated gpus type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants