0xbb / gpu-switch

gpu-switch is an application that allows to switch between the graphic cards of dual-GPU Macbook Pro models
MIT License
537 stars 57 forks source link

Run as daemon on OSX #43

Open steveschow opened 7 years ago

steveschow commented 7 years ago

There is a fundamental flaw with both gpu-switch and the gfxCardStatus code that it was derived from:

When using integrated-only mode, this turns off the dynamic switching mode and places the machine in integrated graphics mode. However, when an app exits, OSX is switching the mode to discrete. When it does that it does not turn dynamic switching back on. So the machine will be stuck in discrete-only mode after that without manual intervention.

There is a fork of gfxCardStatus which handles this situation by detecting that when it happens and switching things back to integrated again. However that callback has been pruned out of gpu-switch, so gpu-switch is stuck with this problem as of now. You can see my fork of gfxCardStatus to see the code change that handles this issue.

In order for gpu-switch to handle this kind of situation it will need to be running as a daemon and monitor when the graphics system has switched to discrete in order to switch it back to integrated (if the user has requested integrated-only. In OSX this is handled with callbacks, not sure how it would be handled on windows or linux, but windows and linux may not be suffering from this problem of switching back to discrete when apps exist, I think probably not. So this may only be an issue on OSX.