-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Zed doesn't work with NVIDIA Optimus on Linux out of the box #22900
Comments
Expected behavior: Workaround: Additional context: Suggestions for improvement: Feedback: The complexity introduced by managing all aspects of rendering (X, Wayland, Vulkan, etc.) might be overkill for what is essentially a tool for editing text. Electron/Chromium might be less performant but simplifies deployment and development significantly on Linux, especially given the challenges with AppImage and desktop environment integration. Side note: |
It specifically does not do that because doing so burns through laptop batteries in no time. Instead it prefers the integrated GPU if there is one. Unfortunately optimus setups that involve an NVIDIA GPU are frequently broken in ways that make it impossible to display anything from the integrated GPU. #22409 tries to work around this. |
Well, some UI is better than no UI. At least, it could detect there are multiple GPUs on the first start and suggest a choice with "never ask again" option. Currently, the user needs to modify desktop shortcuts to include the environment variable which is suboptimal user experience. I mean, if the first interaction with zed is a freezed window, it seriously undermines trust in anything Zed offers. At the very least, "can't render anything in Opitmus enviroment, try this workaround" would go a mile. If you're worried about power consumption, you could display a widget somewhere in the status bar showing graphics card used and how hungry it is.
Is this included in v0.169.0 (Zed Preview)? |
Found another, simpler workaround Basically, it's a shortcut for switcheroo-control integrated into GNOME: Which is a much better tool to manage dual-GPU than just Some useful high-level context:
Sources: https://wiki.archlinux.org/title/Bumblebee https://help.ubuntu.com/community/HybridGraphics https://en.wikipedia.org/wiki/Nvidia_Optimus https://en.wikipedia.org/wiki/Nvidia_Optimus |
@Vanuan Would you be able to add a section to https://github.com/zed-industries/zed/blob/main/docs/src/linux.md#troubleshooting to describe the problem and the workaround for others that fall into this camp? I'm also open to adding feature detection as we do for the software-renderer if this particular broken combination is detectable. |
Something like this? @ConradIrwin https://github.com/zed-industries/zed/pull/23438/files |
Apparently, after upgrade to 170 I no longer need the workaround. Or maybe it was a graphics driver upgrade? I'm not sure. Previously I was using NVIDIA 545, recently upgraded to 565 |
Ok. Correction. I can still reproduce the issue. But if I already have zed open with a workaround, running zed opens a new window. Apparently, it somehow detects aleady open instance and signals to open a new window there? |
Exactly right. Does vkcube work for you on the integrated graphics? |
Looks like it doesn't:
Even if I try to force it: ~$ MESA_VK_DEVICE_SELECT=list vkcube
selectable devices:
GPU 0: 10005:0 "llvmpipe (LLVM 15.0.7, 256 bits)" CPU
GPU 1: 8086:3e9b "Intel(R) UHD Graphics 630 (CFL GT2)" integrated GPU
GPU 2: 10de:1c8c "NVIDIA GeForce GTX 1050 Ti with Max-Q Design" discrete GPU
~$ MESA_VK_DEVICE_SELECT=8086:3e9b vkcube
Selected GPU 2: NVIDIA GeForce GTX 1050 Ti with Max-Q Design, type: 2 That being said, I have the PRIME config set into performance mode. Could that be a factor? It looks like vkcube just ignores the MESA_VK_DEVICE_SELECT ? Or maybe it somehow selects devices by features supported? |
Thanks for confirming! I'm going to close this issue for now. To avoid an infinite amount of time debugging Linux graphics setups, our rule of thumb is that if vkcube is working and Zed is not, we'll spend more time looking. We should merge the docs change to help other people with the same brokenness as you figure it out though. |
@ConradIrwin
zed also works without any issues. So we now have confirmed the bug is with how Zed selects the GPU. It ignores the NVIDIA prime setting and selects Intel GPU which is disabled in the performance mode. Why it doesn't use the default Vulkan selection behaviour? |
Interestingly the resume from suspend also works without issues when using intel graphics. |
Huh? Shouldn't you keep the issue open according to that logic? What do you mean by "spend more time looking"? Zed clearly has a bug here. You might have misinterpreted what I'm saying. vkcube is working by default without any issues. zed, on the other hand requires forcing NVIDIA graphics to be selected. So vkcube is working, zed is not. |
Ok, so sounds like there are three possible states you can be in:
It'd be helpful if you could add some logging to the GPU selection process on our side to see why it might diverge from vkcube so we can be sure we're always selecting the GPU you expect. |
Well. It's more complicated than that. Let me think how to unpack it. First of all, there's only one 100% proof force selection mechanism I described here, This makes the apps blissfully unaware that there's any other GPUs that they need to select from:
Let's test what we see. Let's exclude forcing llvmpipe (software emulation) for simplicity.
Let me test all these configurations first. This would be our source of truth. |
Check for existing issues
Describe the bug / provide steps to reproduce it
Zed Version and System Specs
Zed: v0.169.0 (Zed Preview)
OS: Linux X11 ubuntu 22.04
Memory: 31 GiB
Architecture: x86_64
GPU: NVIDIA GeForce GTX 1050 Ti with Max-Q Design || NVIDIA || 535.183.01
If applicable, add screenshots or screencasts of the incorrect state / behavior
If applicable, attach your Zed.log file to this issue.
Zed.log
The text was updated successfully, but these errors were encountered: