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

Forced GPU selection prevents wgpu running on hybrid nvidia laptops #4101

Closed
flukejones opened this issue Aug 30, 2023 · 6 comments · Fixed by #4110
Closed

Forced GPU selection prevents wgpu running on hybrid nvidia laptops #4101

flukejones opened this issue Aug 30, 2023 · 6 comments · Fixed by #4110
Labels
api: vulkan Issues with Vulkan type: bug Something isn't working

Comments

@flukejones
Copy link
Contributor

The block at

if cfg!(target_os = "linux") && has_nvidia_dgpu && self.shared.has_nv_optimus {
is an issue. On hybrid nvidia laptops it is preventing running wgpu based applications completely.

So what is happening for every Nvidia hybrid user is:

  1. Intel GPU is blocked so it's impossible to select it
  2. Nvidia will never work either due to WL Vulkan apps are broken with PRIME NVIDIA/egl-wayland#72
  3. wgpu based apps just will not work (such as wgpu surface_configure fails (intel+nvidia hybrid laptop) lapce/floem#100 and all wgpu examples)

Given the above, this commit should be reverted, and be done before the next release of wgpu.

Related: #1215 (nvidia provides ways to force nvidia gpu selection)
Related: #1898 (the commit)

@teoxoy
Copy link
Member

teoxoy commented Aug 31, 2023

I think we should apply the workaround conditionally on the mesa version.

@teoxoy teoxoy added type: bug Something isn't working api: vulkan Issues with Vulkan labels Aug 31, 2023
@flukejones
Copy link
Contributor Author

@teoxoy mesa version of?

This block also prevents the use of Nvidia GL btw.

@teoxoy
Copy link
Member

teoxoy commented Sep 1, 2023

The "block" was added to work around a bug in mesa. We should find the version of mesa in which it was fixed and conditionally apply the workaround on it.

This block also prevents the use of Nvidia GL btw.

That is most likely a different issue. This workaround is only present in our Vulkan backend.

@flukejones
Copy link
Contributor Author

flukejones commented Sep 1, 2023

Mesa for what though, intel? I'm using mesa-vulkan-drivers-23.2.0~rc2-3.fc40.x86_64. And the previous version also works fine.

To be as clear as I can, current wgpu will never work on hybrid with that block due to NVIDIA/egl-wayland#72

@teoxoy
Copy link
Member

teoxoy commented Sep 1, 2023

Mesa for what though, intel? I'm using mesa-vulkan-drivers-23.2.0~rc2-3.fc40.x86_64. And the previous version also works fine.

The fix upstream got released as part of mesa 21.2.

To be as clear as I can, current wgpu will never work on hybrid with that block due to NVIDIA/egl-wayland#72

Right now it works on x11, but not on Wayland.

Would you be interested in contributing the fix?

@flukejones
Copy link
Contributor Author

Would you be interested in contributing the fix?

Sure I don't mind.

flukejones added a commit to flukejones/wgpu that referenced this issue Sep 2, 2023
Due to an issue with Mesa versions less than 21.2 presentation on Vulkan
was forced to Nvidia only. This in itself brought new issues around the
Nvidia driver specfic format modifers.

As of Mesa 21.2 the Intel vulkan issue is fixed. This commit enables
presentation on versions 21.2 and above for Intel.

References:
- NVIDIA/egl-wayland#72

Closes gfx-rs#4101

Signed-off-by: Luke D. Jones <[email protected]>
flukejones added a commit to flukejones/wgpu that referenced this issue Sep 2, 2023
Due to an issue with Mesa versions less than 21.2 presentation on Vulkan
was forced to Nvidia only. This in itself brought new issues around the
Nvidia driver specfic format modifers.

As of Mesa 21.2 the Intel vulkan issue is fixed. This commit enables
presentation on versions 21.2 and above for Intel.

References:
- NVIDIA/egl-wayland#72

Closes [gfx-rs#4101](gfx-rs#4101)

Signed-off-by: Luke D. Jones <[email protected]>
Wumpf pushed a commit that referenced this issue Sep 5, 2023
Due to an issue with Mesa versions less than 21.2 presentation on Vulkan
was forced to Nvidia only. This in itself brought new issues around the
Nvidia driver specfic format modifers.

As of Mesa 21.2 the Intel vulkan issue is fixed. This commit enables
presentation on versions 21.2 and above for Intel.

References:
- NVIDIA/egl-wayland#72

Closes [#4101](#4101)
bradwerth pushed a commit to bradwerth/wgpu that referenced this issue Sep 19, 2023
Due to an issue with Mesa versions less than 21.2 presentation on Vulkan
was forced to Nvidia only. This in itself brought new issues around the
Nvidia driver specfic format modifers.

As of Mesa 21.2 the Intel vulkan issue is fixed. This commit enables
presentation on versions 21.2 and above for Intel.

References:
- NVIDIA/egl-wayland#72

Closes [gfx-rs#4101](gfx-rs#4101)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vulkan Issues with Vulkan type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants