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

switch: opensource drivers without monitors should switch to internal #107

Open
hertg opened this issue Apr 9, 2023 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@hertg
Copy link
Owner

hertg commented Apr 9, 2023

If /etc/X11/xorg.conf.d/99-egpu-switcher.conf exists:
Expected Behavior: Running sudo egpu-switcher switch auto in the above case of AMD eGPU connected with no displays removes the X11 conf file.
Actual Behavior: Running sudo egpu-switcher switch auto in the above case only prints an error, /etc/X11/xorg.conf.d/99-egpu-switcher.conf still exists.

I believe that at line 139 in

egpu-switcher/cmd/switch.go

Lines 137 to 153 in 13b8a06

logger.Warn("No eGPU attached display detected with open source drivers. (Of %d eGPU outputs detected) Internal mode and setting DRI_PRIME variable are recommended for this configuration.\n", outputs)
if !override {
return fmt.Errorf("Not setting eGPU mode. Run the command with the '--override' flag to force loading eGPU mode")
}
logger.Debug("-> Overridden: setting eGPU mode")
}
}
nomodesetting = nomodesetting || viper.GetBool("egpu.nomodesetting")
conf := xorg.RenderConf("Device0", driver, gpu.XorgPCIString(), !nomodesetting)
if err := xorg.CreateEgpuFile(x11ConfPath, conf, verbose); err != nil {
return err
}
if post := viper.GetString("hooks.egpu"); post != "" {
if err := runHook(post); err != nil {
logger.Error("egpu hook error: %s", err)
}
should also remove the eGPU file unless the --override is issued. Otherwise the behavior of the switching is inconsistent in this case, as it keeps the file if it previously existed, but doesn't create it if it doesn't exist.

Originally posted by @ewagner12 in #106 (comment)

@T-X
Copy link

T-X commented Apr 17, 2023

Thanks for adding this extra ticket!

One question: If sudo egpu-switcher switch auto running with no monitors connected to the eGPU were removing /etc/X11/xorg.conf.d/99-egpu-switcher.conf then all applications would be rendered by the iGPU instead of the eGPU by default right?

I'm wondering if that's what users would want.

Pro: No USB/Thunderbolt bandwith needed to display the rendered image, its going directly from the iGPU to the eDP, no USB/TB bottleneck.
Con: In most cases (when the eGPU is more potent than the iGPU) less rendering power by default.

I'm a bit undecided if that is what I would expect as a user. I think for my case I would slightly tend for the eGPU to be configured as the primary GPU for applications, even if no display is connected. Because why would I otherwise physically connect the eGPU in the first place?

And I would then expect that display managers like LightDM and window managers to enable and use all available monitors by default.


Edit: Saw @ewagner12 's comment here only now, somehow missed it before. Then I'm wondering if it would make sense for the egpu-switcher to indeed remove /etc/X11/xorg.conf.d/99-egpu-switcher.conf if there is no monitor connected to the eGPU - but maybe egpu-switcher could then set DRI_PRIME=1? Still need test this option myself though :-).

@ewagner12
Copy link
Contributor

That's correct, applications would default to using the iGPU unless they use the DRI_PRIME enviroment variable or the PrefersNonDefaultGPU desktop entry or some other way of telling the system that they prefer to use the eGPU. I think one of those options is the preferred way for using the eGPU on the internal display with open source drivers rather than using the xorg configuration.

@hertg
Copy link
Owner Author

hertg commented Apr 18, 2023

One question: If sudo egpu-switcher switch auto running with no monitors connected to the eGPU were removing /etc/X11/xorg.conf.d/99-egpu-switcher.conf then all applications would be rendered by the iGPU instead of the eGPU by default right?

I'm wondering if that's what users would want.

I think we can make the --override flag work for the auto switch, then you could use sudo egpu-switcher switch auto --override to get the behavior you'd want right?

@hertg hertg added the bug Something isn't working label May 9, 2023
@hertg hertg self-assigned this May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Planned
Development

No branches or pull requests

3 participants