fix: force wgpu to use dedicated/discrete graphics-card, to avoid Vulkan issues - #850
fix: force wgpu to use dedicated/discrete graphics-card, to avoid Vulkan issues#850AnonymousWP merged 2 commits into
wgpu to use dedicated/discrete graphics-card, to avoid Vulkan issues#850Conversation
There was a problem hiding this comment.
I'm hesitant to merge this, to avoid this issue popping up again. Even though GL is a much older standard than Vulkan, forcing GL-only for everyone may again lead to similar issues in the future. Also, as far as I understand it, Vulkan, if used properly, offers lower power usage for the same performance (less overhead). It shouldn't make that much of a difference for this project, but it goes in line with our debloater ethos.
If it's only wayland that crashes, wouldn't the better solution be to use GL only for wayland? Users can set the env in their home configs for now.
Side-note: do we know that it crashes for all wayland users, across all distros, or only for the reporter?
I can add check for
I've looked for similar issues based on the crash log: #459 fail with either Wayland/Xorg + Nvidia. This comment from #383 mentions AMD + Wayland though it's old, and the #383 itself mentions problem with Nvidia + Xorg and lack of it with AMD + Wayland. gfx-rs/wgpu#6159 Nvidia + Wayland and a comment that the problem also occurs on AMD + Wayland and another comment that has the same config as I do (Nvidia dGPU + amd iGPU, though I didn't try to blocklist amdgpu). gfx-rs/wgpu#6320 Nvidia + Wayland. One of those issues mentions improper usage of surface, so I tried to run an Iced example from the latest branch to see if it was fixed, it failed, but it had a nice crash log: LogI am on PC and monitor is connected to Nvidia dGPU, not on a laptop, but it selected AMD iGPU instead. There's a similar issue: gfx-rs/wgpu#3747 mentions Nvidia + Intel hybrid laptop + Wayland I'll create an issue on Iced issue tracker later if it doesn't already exist. |
I was thinking of a simple mechanism for UAD to detect when it crashes, so that the next startup forces GL-use to try to prevent a crash. This is very hacky, so false positives/negatives would be detected. For example, depending on implementation details, an unclean computer-shutdown would make the next UADNG startup assume a crash happened.
I agree, we should add this to the FAQ. I'll do it in a minute.
I remember Windows users having issues with Vulkan, too |
|
I did some more investigation (see my comment at gfx-rs/wgpu#6159), and it looks like the problem is that it selects Amd iGPU for some reason. If I force wgpu to use dGPU via Running on dGPU will not force either GL or Vulkan on users, but will prevent crashes at the cost of slightly higher power usage on laptops. |
|
Thank you so much for wanting to fix this issue, it's appreciated.
Is that always or still the case or did you find a workaround?
That's correct, and I agree.
It seems it only affects users using X11:
That'd be good, as long as the endgoal/solution is an efficient fix. |
|
Let's wait with merging. This user is still experiencing issues: #523 (comment) |
wgpu to use dedicated/discrete graphics-card, to avoid Vulkan issues
|
I don't think #523 is related. The problem there is that text is not being rendered correctly, while here the problem is hard crash. Quote from the open iced-rs/iced#2709, which describes the same issue as #523:
I'll try to make a separate PR tomorrow. |
|
Ah I see, I saw they were both related to |
I've spent like an hour looking through Iced, and apparently there is no option to pass config to wgpu, it always picks settings from env:
https://docs.rs/iced_renderer/0.12.1/src/iced_renderer/compositor.rs.html#252
https://docs.rs/iced_wgpu/0.12.1/src/iced_wgpu/settings.rs.html#47
Also, for some reason, on my PC setting via WGPU_BACKEND=gl (either in terminal or using set_env) only fixes the issue when compiling with
--release.fixes #848