Skip to content

Add GBM_BACKEND env for nvidia cards - #76

Closed
busybox11 wants to merge 2 commits into
omacom:devfrom
busybox11:patch-1
Closed

busybox11 wants to merge 2 commits into
omacom:devfrom
busybox11:patch-1

Conversation

@busybox11

Copy link
Copy Markdown

Can help on hybrid GPU systems and picky programs to recognize and make use of the NVIDIA GPU.

Not having this env variable caused my install to priorize the less powerful integrated graphics (happened to me on Blender). Sometimes, for some reason, the GPU wasn't detected by some programs without it.

Can help on hybrid GPU systems and picky programs to recognize and make use of the NVIDIA GPU.

Not having this env variable caused my install to priorize the less powerful integrated graphics (happened to me on Blender).
Sometimes, for some reason, the GPU wasn't detected by some programs without it.
@busybox11
busybox11 marked this pull request as draft July 6, 2025 02:09
@busybox11
busybox11 marked this pull request as ready for review July 6, 2025 02:21
@dhh

dhh commented Jul 6, 2025

Copy link
Copy Markdown
Contributor

What do you think, @Kn0ax? Any side effects?

@Kn0ax

Kn0ax commented Jul 6, 2025 •

Copy link
Copy Markdown
Contributor

What do you think, @Kn0ax? Any side effects?

It used to cause consistently high GPU usage, and as far as I remember, people recommended launching it as app-specific environment variable defined in .desktop files etc.

But i can't be 100% sure since i don't run a system with igpu :(

@Kn0ax

Kn0ax commented Jul 6, 2025

Copy link
Copy Markdown
Contributor

@busybox11 can you report your GPU usage while idling etc. ?

@busybox11

busybox11 commented Jul 6, 2025 •

Copy link
Copy Markdown
Author

Sure, here's my nvtop!

image

Spikes in GPU usage are from switching workspaces to a GPU intensive app (such as zen, in this case running WebGL Aquarium. Page is opened on zen, but not rendering when idle on another workspace.

I resorted to using this env variable as a global, wasn't aware of this fix being usually app-specific. I might be wrong, my laptop is weird and does not have a MUX switch, it's not easy to troubleshoot unfortunately.

@Kn0ax

Kn0ax commented Jul 6, 2025

Copy link
Copy Markdown
Contributor

Can you please try to run GBM_BACKEND=nvidia-drm blender and check if blender picks your nvidia gpu?

(please remove it first from hyprland config and restart hyprland)

@busybox11

busybox11 commented Jul 6, 2025 •

Copy link
Copy Markdown
Author

This is without the env on the config. It's running on GPU 1, so AMD Integrated.
image

This is with the env passed in the command. Now for some reason blender decides to recognize it and use it by default. I found that this env would help some programs to use the NVIDIA gpu without resorting to use prime-run.
image

FYI - I still haven't figured out a way to force using the NVIDIA GPU in reverse prime in all situations, sometimes it will use the AMD iGPU no matter what I do. For instance, I never managed to run Chrome on NVIDIA with reverse PRIME with Wayland - works with XWayland though.

This isn't bulletproof, this only helped me on some specific cases that are kind of difficult to narrow down and even understand why this is happening.

@dhh

dhh commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

Does this make things better or worse for most on nvidia? If it doesn't always do the right thing, maybe we can start it commented out?

@busybox11

Copy link
Copy Markdown
Author

Makes things better for my system, I unfortunately cannot test anywhere else as this is my only computer :(

I'm not familiar enough with the drivers and their usage to give a definite answer - maybe @Kn0ax has more documentation, sources or data to answer this question.

I didn't find anything online mentioning this env would cause bad things though, if my system benefits from it, surely I wouldn't be the only one. Maybe Linux Twitter would have more info?

@Kn0ax

Kn0ax commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

@busybox11

When this env is set globally, the problem is that all applications that use GBM start using the external card, and the problem is that every application uses the external graphics card, which can cause high power = low battery for laptop users.

That's why I'm in favor of application-specific implementation of this env.

But I would like to get some other opinions as well.

@busybox11

Copy link
Copy Markdown
Author

@busybox11

which can cause high power = low battery for laptop users.

In this case, maybe this could be part of the setup process, asking the user if this is intended for single GPU use or hybrid. And then set env variables accordingly.

I guess this could be automated by counting the detected GPUs, and in that case maybe the issue I was experiencing before setting the env is indeed purely due to the weirdness of my system.

@Kn0ax

Kn0ax commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

In this case, maybe this could be part of the setup process, asking the user if this is intended for single GPU use or hybrid. And then set env variables accordingly.

@dhh wants the installation process to be unattended.

@busybox11

Copy link
Copy Markdown
Author

I guess it would be fine to assume hybrid if multiple, NVIDIA-specific if not. Power users that would like to only use their dGPU could fiddle with the config by themselves then.

Still, would you consider this env to be useful for single GPU systems? It was useful for me but I am not really a reference haha

@dhh

dhh commented Aug 3, 2025

Copy link
Copy Markdown
Contributor

Maybe we could add this to an nvidia guide in Discussions > Manual for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants