Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 36 million developers.Sign up
This update brings some massive changes to the internal structure of optimus-manager. In particular, the method by which the X server is restarted and the GPU setup/teardown functions are called has changed greatly :
Before : the display manager service was entirely restarted on a GPU switch, and the setup scripts were called using the ExecStart and ExecStop fields in its Systemd unit. This method has a lot of staibility issues because, as it turns out, display managers on Linux are not supposed to be brutally restarted, and would often leave X sessions hanging around, which it turn would refuse to let go of the current GPU. My attempts at circumventing this problem by killing leftover X servers or the entire logind service fixed issues for some people but created new ones for others.
Now : the new method was copy-pasted from Ubuntu's own Nvidia-Prime solution. The display manager is not restarted anymore ; instead, the GPU setup script is called at boot before the login manager starts, and also whenever the X server shuts down thanks to a hook into the login manager itself. Therefore, to apply the GPU switch, the user only needs to log out (which optimus-manager can do automatically) and log back in. As far as I can tell, this method is much more stable and only requires a minimum of ugly workarounds. It has two drawbacks though :
GDM users need to download a custom-patched versions of the
gdmpackage, which I put on the AUR (link in the README). This version is identical to the normal one, except for a patch from Ubuntu that adds the script hooks required for Prime switching.
Because the login manager isn't completely restarted anymore, auto-login will not kick in on a GPU switch in even if you have it enabled. In other words, you need to type your password in the login screen every time you switch GPUs. I realize this can be an annoyance, but this is the proper method and the stability gains are worth it.
Other improvements :
- Easier installation on Manjaro. Now Manjaro users only need to disable the bumblebee daemon, optimus-manager will take care of the MHWD-generated Xorg config file.
- Some client-side checks to spot the most common problems (Wayland session still running, bumblebee not disabled, etc). They will trigger a warning and a confirmation message before a GPU switch.
- DPI for Nvidia now defaults to 96
- Better README + created some Wiki pages because the README was becoming too bloated
- Better logging with all the log files in one place and their entries timestamped, to facilitate bug reporting
- Improvements to packaging, added pre/post install hooks so that generated Xorg files are automatically cleaned up
- Some config keys were removed because they became obsolete with the new switching method, or never worked to begin with. They will trigger warnings in this new version.
- Minor bug fixes
- Important : The built-in tray app has been deprecated in favor of optimus-manager-qt. The old tray is still there but will be removed in the future.
- For the X setup script, write into the proper config file for SDDM instead of overwriting
- Adjusted polling and timeout delays to avoid premature termination of the DM setup script
- More aggressive termination methods if the previous desktop session hangs during a switch. Can be disabled in the config file.
- New feature : you can specify custom display setup scripts.
- New feature : we now have a tray icon for easy switching ! Thanks a lot @jsmnbom for the implementation.
- bbswitch is now an optional dependency. A warning message will pop up if you try to use the bbswitch option without that module installed.
- optimus-manager now warns you if the nvidia modules are not installed for the current kernel.
- Various bugfixes and stability improvements.
Unfortunately optimus-manager seems to be still quite broken on Gnome. From my own testing on Manjaro Gnome Edition, restarting the display manager causes a number of random issue ranging from the X server being duplicated to the session not starting at all. This is definitely something that needs to be addressed.
Happy new year !
- New feature : DPI setting (see #26)
- New feature : config option to enable PCI power management in the kernel for the Nvidia GPU
- The PCI device corresponding to the Nvidia GPU is now reset when switching. This should prevent issues when swapping drivers (particularly when switching from Nvidia to Intel).
- Merged another PR (#34) from @kuroni to add proper session termination. This should prevent issues with some hardware devices not re-attaching after switching.
- Worked around a known Systemd bug causing the systemd-logind process to hold onto the GPU and preventing module unloading. See #36 and #37.
- Merged more PRs from @kuroni (#21, #24) for some code refactoring and (hopefully) a more robust switching process
- New feature : there is now a
[intel]which allows to disable modesetting for the nouveau driver
- New feature : there is now proper sanitizing of the configuration file. Syntax errors will be explicitely printed to the standard output, instead of causing an exception at some random point in the program.
- README updates
- AUR :
mesa-demosare added as dependencies
- Merged PR #6 to fix broken GDM support (thanks @kuroni)
- New feature : it is now possible to pass extra options to the Xorg configuration
- Various bugfixes
The configuration file has changed location. It is not in
/etc/optimus-manager.conf anymore, but in
/etc/optimus-manager/optimus-manager.conf (one subfolder down). The old location will still work for compatibility, but consider moving your file.
Even though it does not look like much has changed on the surface, this is a massive release.
Due to the problem highlighted in #11, I had to completely change the way GPU switching work. Now instead of being taken care of by a daemon, the configuration of Xorg and the module loading is done through a setup script in the ExecStartPre field of display-manager.service. This method has the following advantages :
- No stupid race condition between the daemon and the display manager anymore.
- No need to immediately restart the display manager (although the tool still does it by default)
- Much cleaner and much more compliant with the design philosophy of SystemD
- Cleanup can be done immediately after the display manager exits (thanks to the ExecStopPost field)
There is technically no need for a daemon anymore (you can just write the mode you want to
/var/lib/optimus-manager/requested_mode and then restart the display manager) but I'm keeping it because it provides a user-friendly interface.
If you do not use a display-manager, there are now extra steps. Please read the updated README.
Also, I had to remove the option in the config file to specify the name of the display manager service. But I am pretty sure it was useless anyway, the default name is the same on Arch and Manjaro and there is no reason for the user to change it.
Other changes :
- Added the option to use the "intel" driver instead of "modesetting"
- Added "acceleration method" option to Intel ("sna", "xna", or default)
- Added "TearFree" option to Intel
- Merged PR #10 to allow the client to print the current GPU mode and auto-switch to the other mode (thanks @kuroni)
The reception to this project has been pretty positive so far. Thanks for your interest !
- Added a more helpful error message to the client if the socket cannot be opened
- Improved the config file with more comments
- Fixed two bugs breaking PRIME setup (958abb2, 3779bf8)
- README improvements and minor fixes
- Not directly related to this repository but there were a tons of problems with the AUR packaging. Should be fixed now.