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

Adding OSX support. #26

Closed sl33k closed 8 years ago

sl33k commented 8 years ago

I have added simple osx support by writing a command line application which reuses some of the code from gfxCardStatus. This removes the need for an old version of gfxCardStatus since it does not switch to dynamic switching on exit. Furthermore this open the possibility to switch the to the integrated graphics card on logout (via a LoginHook) to remove the need to reboot linux everytime osx was used (since osx reset the efi var set by gpu-switch on unix). Unfortunately this means including the new GPL License from gfxCardStatus. Anyway, hope you like it.

malte

ah- commented 8 years ago

Oh cool! What exactly does this all do?

Is there stuff in there you could remove? Like those binaries and xcuserdata?

0xbb commented 8 years ago

Very cool! Adding a new license is absolutely no problem.

@ah- could you test it on your MacBook? I can currently don't have access to any newer MacBook.

ah- commented 8 years ago

Works perfectly. Can just switch between the cards on the command line.

I think everything in the xcodeproj except for osx/gpu-switch.xcodeproj/project.pbxproj should be removed and added to .gitignore, and the same for the gpu-switch binary, then this is good to go.

0xbb commented 8 years ago

Thank you! I will check it later and merge it :)

ah- commented 8 years ago

Maybe a mention of it in the README would be nice as well. Also it's different from the others in that it actually switches without a reboot, I don't know if it sets the EFI var or not.

0xbb commented 8 years ago

Yep, that needs to be updated as well.

sl33k commented 8 years ago

You can safely remove the xcuserdata stuff. Still I wouldn't remove the binary since it is required for the login/logout hook install. The hooks basically allow mode switching on reboot and switching back on the next login. Especially when dual booting Linux and OS X this is handy since OS X reset the efi var all the time which means a second reboot is needed after booting into linux. Switching the to the integrated gpu via the logout hook solves the problem. The binary could be removed and instead be built everytime when installing the hooks, though right now im not sure howto properly compile the binary with xcode on commandline. Will look into that though. As for the tool the usage is simple: -i switches to the integrated gpu -d to the discrete and -a enables os x native automatic switching.

sl33k commented 8 years ago

I removed the binary now and added a shell script for building the binary. Furthermore the install_hooks script now uses the on the fly building. I also added a proper gitignore from gitignore.io and updated the tree for the new gitignore.