CodySchrank / gSwitch

macOS menu bar app that allows control over the gpu on dual gpu macbooks
MIT License
881 stars 46 forks source link

Does this app work for macbooks older than 2011? #12

Open CodySchrank opened 6 years ago

CodySchrank commented 6 years ago

If someone has a macbook older than 2011, can you let me know if this app fully works? I don't have any way to test it.

irodimus commented 6 years ago

Is it possible for something like this to work with a Mac Mini (Mid 2011) with an Intel HD Graphics 3000 and AMD Radeon HD 6630M?

As of now, I tried launching the app but nothing happens when I do.

CodySchrank commented 6 years ago

@irodimusDoes This app is really only designed for 15" and 17" macbook pros. I believe your mac mini does not have automatic graphics switching, even if it has both gpu's. I'm pretty sure it uses the AMD card all the time.

You can check by going to system preferences -> energy saver -> automatic graphics switching. If you don't have a checkbox for automatic graphics switching then there is nothing my app can do (it will crash immediately), because your computer does not support it. If it does have the checkbox then please let me know and I'll check it out further!

irodimus commented 6 years ago

You are correct in that this Mac Mini (Mid 2011) does not have Automatic Graphic Switching, which is a bummer. Didn't hurt to ask though.

HackintoshHD commented 6 years ago

Okay, you asked for it: 😏

On a 17" MacBook Pro Mid-2009 (macbookpro5,2 w/ discrete GPU nVidia GeForce 9600M GT (512MB) and an integrated GPU nVidia GeForce 9400M (256MB)) with macOS 10.13.4 (Build 17E202), gSwitch 1.7.7 will launch, but it will not even show its status bar icon.

I did a tail -F on ~/Library/Caches/gSwitch/swiftybeaver.log (… name courtesy of Sebastian Kreutzberger?) while launching gSwitch, and from the output it seems that gSwitch is detecting the (active) discrete GPU, but fails to recognize the (inactive) integrated GPU:

22:55:29.200 INFO GPUManager.connect():78 - Successfully connected
22:55:29.203 VERBOSE AppDelegate.applicationDidFinishLaunching():68 - App Startup set as 1
22:55:29.204 VERBOSE AppDelegate.applicationDidFinishLaunching():69 - Use Last State set as 1
22:55:29.204 VERBOSE AppDelegate.applicationDidFinishLaunching():70 - Saved GPU State set as 2
22:55:29.204 VERBOSE AppDelegate.applicationDidFinishLaunching():71 - GPU Change notifications set as 1
22:55:29.204 VERBOSE GPUManager.setGPUNames():46 - Integrated: Unknown
22:55:29.204 VERBOSE GPUManager.setGPUNames():47 - Discrete: NVIDIA GeForce 9600M GT

This is just my interpretation, of course, I'm still going to investigate what is logged in the inverse situation (= integrated GPU active, discrete GPU inactive).

HackintoshHD commented 6 years ago

Here's the full output of a gSwitch launch up to the point freezing gSwitch activity:

22:55:29.200 INFO GPUManager.connect():78 - Successfully connected
22:55:29.203 VERBOSE AppDelegate.applicationDidFinishLaunching():68 - App Startup set as 1
22:55:29.204 VERBOSE AppDelegate.applicationDidFinishLaunching():69 - Use Last State set as 1
22:55:29.204 VERBOSE AppDelegate.applicationDidFinishLaunching():70 - Saved GPU State set as 2
22:55:29.204 VERBOSE AppDelegate.applicationDidFinishLaunching():71 - GPU Change notifications set as 1
22:55:29.204 VERBOSE GPUManager.setGPUNames():46 - Integrated: Unknown
22:55:29.204 VERBOSE GPUManager.setGPUNames():47 - Discrete: NVIDIA GeForce 9600M GT
22:55:29.204 INFO GPUListener.listen():33 - Listening
22:55:29.204 INFO GPUManager.GPUMode():140 - Requesting Dynamic
22:55:29.204 VERBOSE GPUManager.setGPUState():220 - Modified state with EnableFeatureORFeatureInfo2
22:55:29.204 VERBOSE GPUManager.setGPUState():220 - Modified state with SwitchPolicy
22:55:29.205 VERBOSE GPUManager.setGPUState():220 - Modified state with GpuSelect
22:55:29.205 INFO AppDelegate.safeDynamicSwitching():201 - Set Dynamic Switching
22:55:29.205 VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 0
22:55:29.205 INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
22:55:29.212 INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
22:55:29.216 INFO AppDelegate.setupUpdater():226 - Started updater
22:55:29.220 WARNING StatusMenuController.changeGPUNameInMenu():135 - Can't change gpu name in menu, Current GPU Unknown
HackintoshHD commented 6 years ago

You can check by going to system preferences -> energy saver -> automatic graphics switching. If you don't have a checkbox for automatic graphics switching then there is nothing my app can do (it will crash immediately), because your computer does not support it. If it does have the checkbox then please let me know and I'll check it out further!

Just as a sidenote to point out that graphics switching ability on the fly and the existence of the "automatic graphics switching" checkbox are not necessarily connected: The mid-2009 MacBook Pros did not have that checkbox in the (Mac) OS X releases during their lifecycle (Mac OS X 10.6 Snow Leopard to OS X 10.11 El Capitan), either, yet @codykrieger 's gfxCardStatus was nonetheless able to swith between integrated and discrete GPUs on the fly (i.e. without logging the user off) on these machines up to macOS 10.12 Sierra. This was not automatic graphics switching in the sense that the app would decide when to switch GPUs, but that a switch on the fly was possible on user interaction with gfxCardStatus Finder bar icon menu.

The feature was finally broken by the changes Apple made in macOS 10.13 High Sierra, and neither Cody Krieger nor any other third party developers (e.g. the developers of Duet Display) have been able to reinstate that feature for older MacBook Pros in their apps.

CodySchrank commented 6 years ago

Oh boi!

Ok, it's gonna take me a while to go through all of this.

I did a tail -F on ~/Library/Caches/gSwitch/swiftybeaver.log (… name courtesy of Sebastian Kreutzberger?)

Thats because it is swiftybeaver :) and thanks for leading with the log! (I have a tail.sh on the repo but it appears that it is out of date, I will update it)

it seems that gSwitch is detecting the (active) discrete GPU, but fails to recognize the (inactive) integrated GPU

You are correct, it is detecting the discrete one but not the integrated one.

I do not think it crashed on this line: 22:55:29.220 WARNING StatusMenuController.changeGPUNameInMenu():135 - Can't change gpu name in menu, Current GPU Unknown It can be hard to debug given the asynchronous nature of the code. I suspect there is more but it didn't get reported. However, it looks like it was in the process of switching to the integrated card when it crashed.

You can start the app by setting a specific mode off the bat by passing in --integrated, --discrete, or --dynamic.

Could you try launching with discrete selected?
/Applications/gSwitch.app/Contents/MacOS/gSwitch --discrete

You should be able to start with discrete selected.

I did not implement any of the code that gfxCardStatus used to support older machines, so I'm not surprised that it failed to find your card. Unfortunately I don't have a <2011 MBP so its difficult for me to test anything related to the older machines!

Just as a sidenote to point out that graphics switching ability on the fly and the existence of the "automatic graphics switching" checkbox are not necessarily connected: The mid-2009 MacBook Pros did not have that checkbox in the (Mac) OS X releases during their lifecycle (Mac OS X 10.6 Snow Leopard to OS X 10.11 El Capitan), either, yet @codykrieger 's gfxCardStatus was nonetheless able to swith between integrated and discrete GPUs on the fly (i.e. without logging the user off) on these machines up to macOS 10.12 Sierra. This was not automatic graphics switching in the sense that the app would decide when to switch GPUs, but that a switch on the fly was possible on user interaction with gfxCardStatus Finder bar icon menu.

Ok thanks for the info! As you can tell I've only been doing this for like a month, I still don't know the intricacies of the older models yet.

The feature was finally broken by the changes Apple made in macOS 10.13 High Sierra, and neither Cody Krieger nor any other third party developers (e.g. the developers of Duet Display) have been able to reinstate that feature for older MacBook Pros in their apps.

Can you expand on this? Does gfxCardStatus work at all for your machine? I was under the impression that the older machines now have to log out in order to switch to a different card?

If you can get back to me with those questions I think I will be able to add support for older machines (assuming its possible at all on 10.13?). I'm really busy with work right now but my schedule is going to clear up next week so I will have more time to look into it.

CodySchrank commented 6 years ago

@HackintoshHD The problem with the menu icon was an indirect bug caused by a missing gpu name. I just fixed it so now the menu should work (the app still won't work probably!) and released 1.7.8 so please download that first.

HackintoshHD commented 6 years ago

Thanks a lot for your fast reaction on my feedback, @CodySchrank, and sorry for that bit of delay in responding myself (I'm quite busy with work right now, too).

First of all, here's the feedback to your questions:

Can you expand on this? Does gfxCardStatus work at all for your machine? I was under the impression that the older machines now have to log out in order to switch to a different card?

Yes, gfxCardStatus actually did work on my 17" MacBook Pro mid-2009 from the time I started using it (with OS X 10.8 Mountain Lion or OS X 10.9 Mavericks) up to (and including) macOS 10.12 Sierra.

A few words on this particular MacBook Pro itself: The last OS version for the machine officially supported by Apple was OS X 10.11 El Capitan. For the upgrades to macOS 10.12 Sierra and macOS 10.13 High Sierra I used Colin Mistr's excellent macOS Sierra Patcher Tool rsp. macOS High Sierra Patcher Tool. This results in OS installations working completely flawlessly (mac OS 10.12 Sierra) in comparison to the last officially supported OS version or at least with only minor flaws (mac OS 10.13 High Sierra w/ sometimes unreliable hibernation and loss of the ability to switch GPUs on the fly using gfxCardStatus). Forum discussion to Colin's tools are taking place mainly on the MacRumors forums.

As far as gfxCardStatus and later OS X/macOS versions (i.e. OS X 10.11 El Capitan or macOS 10.12 Sierra) are concerned, I had to switch from Cody Krieger's original 2.3 release to the 2.4.4i binaries of Steve Schow's gfxCardStatus fork.

You're basically right that you have to log out on the older machines in order to switch from one GPU to the other, if you only use the features provided by Apple's OS - but: On my mid-2009 MacBook Pro, gfxCardStatus was nonetheless able to switch between GPUs on the fly up to macOS 10.12 Sierra: If you chose the other, currently inactive GPU in gfxCardStatus Finder bar icon's menu, the switch was done on the fly within perhaps two or three seconds without the need to log out. AFAIK, the background for this is that nVidia's GPUs actually were able to switch from one to the other on the fly and that Apple just hadn't software-implemented the feature for the mid-2009 MacBook Pro generation. That's what I've read, I'm sure Cody Krieger can give you more detailed and in-depth info on this.

Could you try launching with discrete selected? /Applications/gSwitch.app/Contents/MacOS/gSwitch --discrete

No problem - this is the output of gSwitch 1.7.8 when launched with the --discrete parameter:

bash-3.2$ ./gSwitch --discrete
14:14:11.709 πŸ’™ INFO GPUManager.connect():78 - Successfully connected
14:14:11.709 πŸ’œ VERBOSE AppDelegate.applicationDidFinishLaunching():68 - App Startup set as 1
14:14:11.709 πŸ’œ VERBOSE AppDelegate.applicationDidFinishLaunching():69 - Use Last State set as 1
14:14:11.709 πŸ’œ VERBOSE AppDelegate.applicationDidFinishLaunching():70 - Saved GPU State set as 1
14:14:11.709 πŸ’œ VERBOSE AppDelegate.applicationDidFinishLaunching():71 - GPU Change notifications set as 1
14:14:11.709 πŸ’œ VERBOSE GPUManager.setGPUNames():46 - Integrated: Unknown
14:14:11.709 πŸ’œ VERBOSE GPUManager.setGPUNames():47 - Discrete: NVIDIA GeForce 9400M
14:14:11.709 πŸ’™ INFO GPUListener.listen():33 - Listening
14:14:11.710 πŸ’š DEBUG AppDelegate.applicationDidFinishLaunching():91 - Discrete passed in
14:14:11.710 πŸ’™ INFO GPUManager.GPUMode():126 - Requesting discrete
14:14:11.710 πŸ’œ VERBOSE GPUManager.setGPUState():220 - Modified state with EnableFeatureORFeatureInfo2
14:14:11.710 πŸ’œ VERBOSE GPUManager.setGPUState():220 - Modified state with SwitchPolicy
14:14:11.710 πŸ’œ VERBOSE GPUManager.setGPUState():220 - Modified state with GpuSelect
14:14:12.713 πŸ’œ VERBOSE GPUManager.setGPUState():220 - Modified state with GpuSelect
14:14:12.713 πŸ’™ INFO AppDelegate.safeDiscreteOnly():190 - Set Force Discrete
14:14:12.714 πŸ’œ VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 1
14:14:12.714 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
14:14:12.728 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
14:14:12.728 πŸ’™ INFO AppDelegate.setupUpdater():232 - Started updater
14:14:12.728 πŸ’› WARNING StatusMenuController.changeGPUNameInMenu():137 - Can't change gpu name in menu, Current GPU Unknown
14:14:13.258 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
14:14:13.258 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
14:14:13.258 πŸ’œ VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 0
14:14:13.258 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
14:14:13.258 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
14:14:13.287 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
14:14:13.288 πŸ’œ VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 0
14:14:13.288 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
14:14:13.288 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
14:14:13.297 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
14:14:13.316 πŸ’œ VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 0
14:14:13.316 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
14:14:13.317 πŸ’™ INFO GPUListener.displayCallback():57 - Dedicated Graphics Card Called
14:14:13.317 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
14:14:13.317 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
14:14:13.317 πŸ’œ VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 0
14:14:13.317 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
14:14:13.338 πŸ’› WARNING StatusMenuController.changeGPUNameInMenu():137 - Can't change gpu name in menu, Current GPU Unknown
14:14:13.338 πŸ’› WARNING StatusMenuController.changeGPUNameInMenu():137 - Can't change gpu name in menu, Current GPU Unknown
14:14:13.339 πŸ’› WARNING StatusMenuController.changeGPUNameInMenu():137 - Can't change gpu name in menu, Current GPU Unknown
14:14:13.339 πŸ’› WARNING StatusMenuController.changeGPUNameInMenu():137 - Can't change gpu name in menu, Current GPU Unknown
14:14:14.310 πŸ’œ VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 0
14:14:14.310 πŸ’› WARNING StatusMenuController.changeGPUNameInMenu():137 - Can't change gpu name in menu, Current GPU Unknown
14:14:14.310 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
14:14:14.310 πŸ’œ VERBOSE GPUListener.displayCallback():74 - NOTIFY: GPU maybe Changed
14:14:31.483 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
14:14:31.492 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
14:14:37.619 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
14:14:37.619 πŸ’œ VERBOSE GPUManager.getGPUState():255 - Successfully got state, count 1, value 0
14:14:37.619 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():171 - NOTIFY: checkGPUState ~ Checking GPU...
14:14:37.619 πŸ’™ INFO GPUManager.GPUMode():119 - Requesting integrated, are we integrated?  false
14:14:37.620 πŸ’œ VERBOSE GPUManager.setGPUState():220 - Modified state with GpuSelect
14:14:38.619 πŸ’œ VERBOSE GPUManager.setGPUState():220 - Modified state with ForceSwitch
14:14:38.619 πŸ’™ INFO AppDelegate.safeIntergratedOnly():173 - Set Force Integrated
14:14:38.622 πŸ’› WARNING StatusMenuController.changeGPUNameInMenu():137 - Can't change gpu name in menu, Current GPU Unknown
14:14:45.864 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
14:14:45.873 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
14:14:48.019 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed

Things noticable to me:

  1. With gSwitch 1.7.8, the Finder bar icon now appears normally. Its menu still lists the GPU as 'unknown' and the setting at launch is on 'Discrete Only'.
  2. The attempt to switch from discrete to integrated GPU only changes the checkmark from 'Discrete Only' to 'Integrated Only', but obviously no switch of GPUs is taking place. When I check the GPUs' activity with gfxCardStatus, it still reports the discrete GPU to be the active one after the switch.
  3. In these two lines of the log, the integrated and discrete GPU seem to be mixed up (the 9400M is the MBP's integrated GPU and the 9600M GT is the discrete GPU):
14:14:11.709 πŸ’œ VERBOSE GPUManager.setGPUNames():46 - Integrated: Unknown
14:14:11.709 πŸ’œ VERBOSE GPUManager.setGPUNames():47 - Discrete: NVIDIA GeForce 9400M

If I can do more testing, please just let me know. I'd be more than happy to contribute to gSwitch by testing, if it helps to remove these somewhat artifical flaws from otherwise still completely decent working machines like the MacBook Pro mid-2009 generation.

CodySchrank commented 6 years ago

@HackintoshHD Thanks dude! I see the problem to getting the right GPU name. And since a lot of the code is dependent on having the right gpu, I'll fix that, and then send you the binary to test. I'm still pretty busy but I'll dive into this in a couple days.

CodySchrank commented 6 years ago

@HackintoshHD Ok I finally have some free time! I think I fixed the problem with detecting the respective gpus. If this fix worked I need to see how the app reacts to your machine now in the logs. If you're comfortable building with xcode can you clone or fork the development branch? If not thats totally ok I will make a binary and upload it to github.

HackintoshHD commented 6 years ago

@CodySchrank Thanks for potentially fixing the GPU detection. In general, building the development branch with Xcode shouldn't be a problem for me. I've already forked your project and got around the code signing stuff in Xcode. I am now investigating a remaining Xcode problem with SwiftyBeaver when building the project (error message: No such module 'SwiftyBeaver', a bit like here) and I'm confident I'll also get around that by next week.

CodySchrank commented 6 years ago

@HackintoshHD You have to use carthage to install the modules

brew update
brew install carthage

And then bootstrap the frameworks in the project dir:

carthage bootstrap

Then you should be able to build in Xcode.

HackintoshHD commented 6 years ago

Thank you, I realize this was a so to speak RTFM! problem on my side. Sorry for that. - I've now followed your build instructions and could easily build gSwitch. Here's again the output when launched with the --discrete parameter:

23:15:30.062 πŸ’™ INFO GPUManager.connect():80 - Successfully connected
23:15:30.065 πŸ’œ VERBOSE GPUManager.setGPUNames():48 - Integrated: Unknown
23:15:30.065 πŸ’œ VERBOSE GPUManager.setGPUNames():49 - Discrete: NVIDIA GeForce 9600M GT
23:15:30.065 πŸ’™ INFO GPUListener.listen():33 - Listening
23:15:30.067 πŸ’™ INFO AppDelegate.setupUpdater():244 - Updater setup
23:15:30.067 πŸ’œ VERBOSE AppDelegate.deforestation():251 - Launch at Login set as true
23:15:30.067 πŸ’œ VERBOSE AppDelegate.deforestation():253 - Automatically update set as true
23:15:30.067 πŸ’œ VERBOSE AppDelegate.deforestation():255 - GPU Change notifications set as true
23:15:30.067 πŸ’œ VERBOSE AppDelegate.deforestation():257 - Use Last State set as true
23:15:30.067 πŸ’œ VERBOSE AppDelegate.deforestation():259 - Saved GPU State set as 1 (ForceDiscrete)
23:15:30.068 πŸ’š DEBUG AppDelegate.applicationDidFinishLaunching():93 - Discrete passed in
23:15:30.068 πŸ’™ INFO GPUManager.GPUMode():128 - Requesting discrete
23:15:30.068 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with EnableFeatureORFeatureInfo2
23:15:30.068 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with SwitchPolicy
23:15:30.068 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with GpuSelect
23:15:31.069 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with GpuSelect
23:15:31.069 πŸ’™ INFO AppDelegate.unsafeDiscreteOnly():164 - Set Force Discrete
23:15:31.069 πŸ’œ VERBOSE GPUManager.getGPUState():258 - GET: count 1, value 0 (Discrete)
23:15:31.070 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():178 - NOTIFY: checkGPUState ~ Checking GPU...
23:15:31.081 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
23:15:56.018 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
23:15:56.026 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
23:15:59.469 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
23:15:59.487 πŸ’œ VERBOSE GPUManager.getGPUState():258 - GET: count 1, value 0 (Discrete)
23:15:59.487 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():178 - NOTIFY: checkGPUState ~ Checking GPU...
23:15:59.487 πŸ’™ INFO GPUManager.GPUMode():121 - Requesting integrated, are we integrated?  false
23:15:59.487 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with GpuSelect
23:16:00.488 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with ForceSwitch
23:16:00.488 πŸ’™ INFO AppDelegate.unsafeIntegratedOnly():151 - Set Force Integrated
23:16:09.686 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
23:16:09.696 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
23:16:15.324 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
23:16:15.374 πŸ’™ INFO PreferencesWindow.windowDidLoad():24 - Preferences Opened
23:16:21.550 πŸ’™ INFO PreferencesWindow.openAdvancedPaneClicked():87 - advancedClicked
23:16:25.552 πŸ’™ INFO PreferencesWindow.openAdvancedPaneClicked():87 - advancedClicked
23:16:29.858 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
23:16:29.866 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
23:16:31.989 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed

The discrete GPU is now correctly identified, GPUs are no longer mixed up. Switching GPUs in gSwitch's menu does not have an effect, yet, the active GPU will remain active and no switch is taking place.

CodySchrank commented 6 years ago

Haha no worries I probably should have mentioned it. I'm surprised it is still saying unknown integrated gpu.. I have an idea of how to get the app to work for your machine but I need to figure this out first.

I just made a couple commits can you pull the dev branch and give me the log again?

You can probably launch the app normally now. ( or just build with xcode and copy/paste the output )

HackintoshHD commented 6 years ago

I'm sorry I made a mistake yesterday by building the experimental branch instead of the development branch. There's not much of a difference in the output, however:

23:49:03.467 πŸ’™ INFO GPUManager.connect():80 - Successfully connected
23:49:03.470 πŸ’œ VERBOSE GPUManager.setGPUNames():48 - Integrated: Unknown
23:49:03.470 πŸ’œ VERBOSE GPUManager.setGPUNames():49 - Discrete: NVIDIA GeForce 9600M GT
23:49:03.470 πŸ’™ INFO GPUListener.listen():33 - Listening
23:49:03.472 πŸ’™ INFO AppDelegate.setupUpdater():244 - Updater setup
23:49:03.472 πŸ’œ VERBOSE AppDelegate.deforestation():251 - Launch at Login set as true
23:49:03.472 πŸ’œ VERBOSE AppDelegate.deforestation():253 - Automatically update set as true
23:49:03.472 πŸ’œ VERBOSE AppDelegate.deforestation():255 - GPU Change notifications set as true
23:49:03.472 πŸ’œ VERBOSE AppDelegate.deforestation():257 - Use Last State set as true
23:49:03.472 πŸ’œ VERBOSE AppDelegate.deforestation():259 - Saved GPU State set as 1 (ForceDiscrete)
23:49:03.472 πŸ’™ INFO GPUManager.GPUMode():128 - Requesting discrete
23:49:03.472 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with EnableFeatureORFeatureInfo2
23:49:03.472 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with SwitchPolicy
23:49:03.473 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with GpuSelect
23:49:04.474 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with GpuSelect
23:49:04.474 πŸ’™ INFO AppDelegate.unsafeDiscreteOnly():164 - Set Force Discrete
23:49:04.474 πŸ’œ VERBOSE GPUManager.getGPUState():258 - GET: count 1, value 0 (Discrete)
23:49:04.474 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():178 - NOTIFY: checkGPUState ~ Checking GPU...
23:49:04.486 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
23:49:25.247 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
23:49:25.256 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
23:49:29.937 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
23:49:29.959 πŸ’œ VERBOSE GPUManager.getGPUState():258 - GET: count 1, value 0 (Discrete)
23:49:29.959 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():178 - NOTIFY: checkGPUState ~ Checking GPU...
23:49:29.960 πŸ’™ INFO GPUManager.GPUMode():121 - Requesting integrated, are we integrated?  false
23:49:29.960 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with GpuSelect
23:49:30.951 πŸ’œ VERBOSE GPUManager.setGPUState():221 - SET: Modified state with ForceSwitch
23:49:30.952 πŸ’™ INFO AppDelegate.unsafeIntegratedOnly():151 - Set Force Integrated
23:49:55.821 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
23:49:55.821 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
23:49:58.512 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed

I'll pull the dev branch again later tonight and give you the log again.

HackintoshHD commented 6 years ago

Here's the output after forking again and building gSwitch from the dev branch:

00:24:06.183 πŸ’œ VERBOSE AppDelegate.applicationDidFinishLaunching():48 - gSwtich 1.7.9-beta1
00:24:06.183 πŸ’™ INFO GPUManager.connect():86 - Successfully connected
00:24:06.188 πŸ’œ VERBOSE GPUManager.setGPUNames():47 - Integrated: Unknown
00:24:06.188 πŸ’œ VERBOSE GPUManager.setGPUNames():48 - Discrete: NVIDIA GeForce 9600M GT
00:24:06.188 ❀️ ERROR GPUManager.setGPUNames():54 - There was an error finding the gpus.. ["NVIDIA GeForce 9400M", "NVIDIA GeForce 9600M GT"]
00:24:06.188 πŸ’™ INFO GPUListener.listen():33 - Listening
00:24:06.188 πŸ’™ INFO AppDelegate.setupUpdater():245 - Updater setup
00:24:06.188 πŸ’œ VERBOSE AppDelegate.deforestation():252 - Launch at Login set as true
00:24:06.188 πŸ’œ VERBOSE AppDelegate.deforestation():254 - Automatically update set as true
00:24:06.190 πŸ’œ VERBOSE AppDelegate.deforestation():256 - GPU Change notifications set as true
00:24:06.190 πŸ’œ VERBOSE AppDelegate.deforestation():258 - Use Last State set as true
00:24:06.190 πŸ’œ VERBOSE AppDelegate.deforestation():260 - Saved GPU State set as 0 (ForceIntergrated)
00:24:06.198 πŸ’œ VERBOSE GPUManager.getGPUState():268 - GET: count 1, value 0 (Discrete)
00:24:06.198 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():187 - NOTIFY: checkGPUState ~ Checking GPU...
00:24:06.198 πŸ’™ INFO GPUManager.GPUMode():130 - Requesting integrated, are we integrated?  false
00:24:06.198 πŸ’œ VERBOSE GPUManager.setGPUState():222 - SET: Modified state with GpuSelect
00:24:07.201 πŸ’œ VERBOSE GPUManager.setGPUState():222 - SET: Modified state with ForceSwitch
00:24:07.201 πŸ’™ INFO AppDelegate.unsafeIntegratedOnly():152 - Set Force Integrated
00:24:07.201 πŸ’œ VERBOSE GPUManager.getGPUState():268 - GET: count 1, value 0 (Discrete)
00:24:07.201 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():187 - NOTIFY: checkGPUState ~ Checking GPU...
00:24:07.212 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
00:24:30.072 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
00:24:30.080 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
00:24:43.670 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed

The corresponding gSwitch Finder bar icon and (localized) menu look like this:

gswitch-1 7 9-beta_localized

mobimation commented 6 years ago

My MBP17 late 2011 (AMD Radeon HD 6770M 1GB + Intel HD Graphics 3000 512Mb) has a problem with the graphic MUX so that when in integrated mode, if some app switches to discrete graphics and there is no external monitor connected then the OS panics and reboots. But if I have a monitor connected then all is fine on the monitor screen (while the LCD shows some slight green artifact flicker). My desired functionality is to be able to switch to integrated graphics (your app works to do this), then any attempt of the OS or App to switch to discrete graphics shall be ignored. Is that possible to accomplish ? That the MBP17 stays permanently on integrated mode and IGNORE attempts to switch graphics to discrete (as long as not connecting a monitor cable) ?

CodySchrank commented 6 years ago

@mobimation When an app requests the discrete graphics card the OS forces it to be switched, this app just switches it back to the integrated one. It sounds like you're looking to completely disable your card, you can do that with this: https://apple.stackexchange.com/questions/166876/macbook-pro-how-to-disable-discrete-gpu-permanently-from-efi/285896#285896

CodySchrank commented 6 years ago

@HackintoshHD Thanks so much, I know how to fix the gpu detection. I'll get back to you in a couple days (I'm really busy right now) and I want to test some gpu features.

CodySchrank commented 6 years ago

@HackintoshHD Hey sorry for the delay, I've just had to prioritize work the past couple weeks. I believe I fixed the gpu detection in the latest release for your machine if you could confirm. I also added an advanced pane. Theres some values I would like you to test if you could? I'm not sure exactly what settings are needed yet but I'll get back to you.

HackintoshHD commented 6 years ago

Thanks a lot for the improved code.

I've now run a few tests with the current gSwitch 1.7.9: The MacBook Pro was initially on integrated graphics. This time, gSwitch was able to detect both GPUs correctly and even successfully switch from integrated to discrete graphics on the fly (a step that no other macOS utility is currently able to achieve on the machine).

The switch back to integrated graphics was not (yet) successful. I then went to the gSwitch advanced pane and tried a few buttons - Here's the complete output:

MacBook-Pro:MacOS My User$ ./gSwitch
12:33:21.614 πŸ’œ VERBOSE AppDelegate.applicationDidFinishLaunching():48 - gSwitch 1.7.9
12:33:21.614 πŸ’™ INFO GPUManager.connect():97 - Successfully connected
12:33:21.620 πŸ’œ VERBOSE GPUManager.setGPUNames():58 - Integrated: NVIDIA GeForce 9400M
12:33:21.620 πŸ’œ VERBOSE GPUManager.setGPUNames():59 - Discrete: NVIDIA GeForce 9600M GT
12:33:21.620 πŸ’™ INFO GPUListener.listen():33 - Listening
12:33:21.620 πŸ’™ INFO AppDelegate.setupUpdater():243 - Updater setup
12:33:21.620 πŸ’œ VERBOSE AppDelegate.deforestation():250 - Launch at Login set as true
12:33:21.621 πŸ’œ VERBOSE AppDelegate.deforestation():252 - Automatically update set as true
12:33:21.621 πŸ’œ VERBOSE AppDelegate.deforestation():254 - GPU Change notifications set as true
12:33:21.621 πŸ’œ VERBOSE AppDelegate.deforestation():256 - Use Last State set as true
12:33:21.621 πŸ’œ VERBOSE AppDelegate.deforestation():258 - Saved GPU State set as 0 (ForceIntergrated)
12:33:21.630 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 1 (Integrated)
12:33:21.630 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:21.630 πŸ’™ INFO GPUManager.GPUMode():141 - Requesting integrated, are we integrated?  true
12:33:21.630 πŸ’› WARNING AppDelegate.unsafeIntegratedOnly():153 - Failed to force igpu (probably because already on igpu)
12:33:21.630 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 1 (Integrated)
12:33:21.630 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:21.639 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:33:37.766 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
12:33:37.785 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:33:41.156 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
12:33:41.157 πŸ’™ INFO GPUManager.GPUMode():148 - Requesting discrete
12:33:41.158 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with EnableFeatureORFeatureInfo2
12:33:41.159 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with SwitchPolicy
12:33:41.159 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with GpuSelect
12:33:42.159 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with GpuSelect
12:33:42.159 πŸ’™ INFO AppDelegate.unsafeDiscreteOnly():163 - Set Force Discrete
12:33:42.808 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
12:33:42.808 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:33:42.808 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 0 (Discrete)
12:33:42.808 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:42.809 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
12:33:42.818 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:33:42.819 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 0 (Discrete)
12:33:42.819 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:42.819 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
12:33:42.837 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:33:42.838 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 0 (Discrete)
12:33:42.839 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:42.839 πŸ’™ INFO GPUListener.displayCallback():57 - Dedicated Graphics Card Called
12:33:42.870 πŸ’™ INFO GPUListener.displayCallback():42 - NOTIFY: checkForHungryProcesses ~ for menu update
12:33:42.892 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:33:42.895 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 0 (Discrete)
12:33:42.895 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:43.871 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 0 (Discrete)
12:33:43.872 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:43.872 πŸ’œ VERBOSE GPUListener.displayCallback():74 - NOTIFY: GPU maybe Changed
12:33:51.284 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
12:33:51.294 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:33:58.853 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
12:33:58.866 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 0 (Discrete)
12:33:58.866 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:33:58.866 πŸ’™ INFO GPUManager.GPUMode():141 - Requesting integrated, are we integrated?  false
12:33:58.866 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with GpuSelect
12:33:59.868 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with ForceSwitch
12:33:59.869 πŸ’™ INFO AppDelegate.unsafeIntegratedOnly():150 - Set Force Integrated
12:34:07.743 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
12:34:07.753 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:34:16.014 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
12:34:16.054 πŸ’™ INFO PreferencesWindow.windowDidLoad():28 - Preferences Opened
12:34:18.259 πŸ’™ INFO AdvancedWindow.windowDidLoad():39 - Advanced was opened
12:34:23.498 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 1476411
12:35:11.596 ❀️ ERROR GPUManager.dumpState():334 - Did not dump state
12:35:17.492 πŸ’™ INFO AdvancedWindow.unsafeDynamicSwitchingClicked():53 - Unsafe Dynamic Switching clicked
12:35:17.492 πŸ’™ INFO GPUManager.GPUMode():162 - Requesting Dynamic
12:35:17.492 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with EnableFeatureORFeatureInfo2
12:35:17.492 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with SwitchPolicy
12:35:17.492 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with GpuSelect
12:35:17.492 πŸ’™ INFO AppDelegate.unsafeDynamicSwitching():176 - Set Dynamic Switching
12:35:22.715 πŸ’™ INFO AdvancedWindow.unsafeDiscreteOnlyClicked():48 - Unsafe Discrete Only clicked
12:35:22.715 πŸ’™ INFO GPUManager.GPUMode():148 - Requesting discrete
12:35:22.715 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with EnableFeatureORFeatureInfo2
12:35:22.716 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with SwitchPolicy
12:35:22.716 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with GpuSelect
12:35:23.716 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with GpuSelect
12:35:23.716 πŸ’™ INFO AppDelegate.unsafeDiscreteOnly():163 - Set Force Discrete
12:35:27.083 πŸ’™ INFO AdvancedWindow.unsafeIntegratedOnlyClicked():43 - Unsafe Integrated Only clicked
12:35:27.083 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 0 (Discrete)
12:35:27.084 πŸ’™ INFO GPUManager.CheckGPUStateAndisUsingIntegratedGPU():198 - NOTIFY: checkGPUState ~ Checking GPU...
12:35:27.084 πŸ’™ INFO GPUManager.GPUMode():141 - Requesting integrated, are we integrated?  false
12:35:27.084 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with GpuSelect
12:35:28.085 πŸ’œ VERBOSE GPUManager.setGPUState():233 - SET: Modified state with ForceSwitch
12:35:28.085 πŸ’™ INFO AppDelegate.unsafeIntegratedOnly():150 - Set Force Integrated
12:35:33.460 πŸ’œ VERBOSE GPUManager.getGPUState():279 - GET: count 1, value 1476411
12:35:45.471 πŸ’™ INFO GPUViewController.viewWillDraw():23 - Menu was opened
12:35:45.479 πŸ’™ INFO ProcessManager.updateProcessMenuList():58 - UPDATE: Polling for hungry processes
12:35:47.198 πŸ’™ INFO GPUViewController.discardCursorRects():28 - Menu was closed
12:35:47.201 πŸ’™ INFO UserNotificationManager.cleanUp():77 - CLEAN: Notifications are gross
12:35:47.202 πŸ’™ INFO GPUManager.GPUMode():162 - Requesting Dynamic
HackintoshHD commented 6 years ago

A further detail concerning the hardware itself: Another discovery I've made with macOS 10.13.5 on this macbookpro5,2 in the meantime is that the System Preferences' Energy Saver pane's checkboxes changes depending on whether you start the machine on battery or connected by a power cable.

On battery, the Energy Saver pane offers the choice between "Graphics: Better battery life" or "Higher performance" on its top left. That's the one I was used to in earlier macOS version and that is AFAIK translating into "integrated or discrete GPU".

When the MacBook Pro is plugged in, however, I only see the checkbox "Automatic graphics switching" which I can either check or uncheck.

I don't know if this has a relevance to this thread's problem, I mention it just in case it does.

If I can deliver further test data, just let me know.

HackintoshHD commented 6 years ago

… oh, and by the way, GPU state 8 is 0xDEADBEEF! :smile: gswitch - 0xdeadbeef

HackintoshHD commented 6 years ago

Did my gSwitch 1.7.9 log above provide any new and/or helpful information? - If I can perform further tests, please let me know.

CodySchrank commented 6 years ago

@HackintoshHD Yes it was helpful! I'm currently rewriting some of the core functions in rxSwift to make the app more efficient. And I will attempt to add in the gpu changing for legacy machines at the same time because I know there are some settings that have to be used with them when switching.

zetp commented 5 years ago

Seems to work fine on MBP 15 Mid 2010 (i7) with Intel HD Graphics 288 MB / NVIDIA GeForce GT 330M running 10.13.6.

HackintoshHD commented 5 years ago

@CodySchrank : I know a new software version is ready when it's ready, of course, and an open source application developed for altruistic, ideal reasons in a developer's spare time does need its developer to really have that free time to make development progress.

So please forgive me that question out of curiosity ;) : Are there perhaps any new findings on the GPU changing feature for legacy MacBook Pros? - Thanks a lot!

CodySchrank commented 5 years ago

@HackintoshHD I wanted to thank you for all the hard work but I just don't think its going to be possible to support legacy macbooks with the new apple OS's anymore. My friend gave me his 2010 macbook pro to try and get it working but I just don't think the necessary API's exist anymore (for those machines). I'm going to leave this thread open if anyone wants to tackle this. gSwitch has all the necessary checks for finding a legacy computer its just the low level API needs to be found (it it exists!).

HackintoshHD commented 4 years ago

@CodySchrank Thank you very much for your hard work on gSwitch nonetheless. I also really appreciate the honest way you're communicating the problems and that you're leaving this thread open for someone else to pick up where you left off.

In the meantime, i.e. from time to time over the last few months, I've continued to analyse the MBP5,2 mid-2009 instant GPU switching problem under High Sierra and Mojave a bit further with the (albeit limited) ways and means I have. And I'm confident I'm about to find a solution that reinstates instant GPU switching on the fly on these machines, at least with @steveschow 's builds of gfxCardStatus.

Provided I succeed, would you or, of course, anybody else be willing to look over the relevant information again to reevaluate if it makes an implementation of mid-2009 MBP5,2 instant GPU switching in gSwitch possible?

CodySchrank commented 4 years ago

@HackintoshHD Of course. If you or anyone else can figure out a way to do this for legacy computers I will help them however I can.

onetaste1000 commented 3 years ago

Hi @CodySchrank . I'm not a coder. I tried to run your app on macOS 10.15.7 and the response was "developer needs to update software". I am hoping I can use your app to turn off the GPU and hopefully remove the purple/green taint I get on many YouTube videos. Any plans to update in the future? Cheers

xabimr commented 2 years ago

Working on a MBP Late 2013 running OSX Mojave. Thanks a lot for your work!!!!

HackintoshHD commented 2 years ago

@HackintoshHD Of course. If you or anyone else can figure out a way to do this for legacy computers I will help them however I can.

Okay, it's been two years now, but I've finally managed to get Instant GPU Switching / GPU Switching on the Fly working again on my 17" MacBook Pro Mid 2009 (MacBookPro5,2) for High Sierra, Mojave, Big Sur and Monterey:

The relevant API is obviously part of AppleMuxControl.kext, which itself is a plugin of AppleGraphicsControl.kext located in /System/Library/Extensions/AppleGraphicsControl.kext/Contents/PlugIns/ (cf. the excellent analysis by @0xbb for the MacBookPro11,3).

Apple's code responsible for that was lastly present as AppleMuxControl.kext version 3.14.52 in mac OS 10.12.6 Security Update 2019-005. It was obviously removed from the kext in macOS 10.13.0 High Sierra and with High Sierra, the whole code was split into two new AppleMuxControl.kext and AppleMuxControl2.kext.

I've written a script to automatically download (Low) Sierra's Security Update 2019-005 and to extract AppleMuxControl.kext version 3.14.52 from it with macOS' own integrated tools:

HackintoshHD/mbp5x-instant-gpu-switching

I've also documented the entire process of transplanting AppleMuxControl.kext version 3.14.52 into a current AppleGraphicsControl.kext in a detailed post on the MacRumors Forums.

With AppleMuxControl.kext version 3.14.52 transplanted that way, I can use Instant GPU Switching / GPU Switching on the Fly again with

gSwitch unfortunately doesn't switch successfully yet - as described above, it alters the system preferences' energy pref pane on my 17" MacBook Pro Mid 2009 to a "dynamic switching" view that is normally not present on a MacBookPro5,2 (not on the macOS ≀ 10.11, either, that still support this model). So I assume gSwitch treats the 2009 model exactly as its successors that officially support dynamic GPU switching.

Would it be possible to change that and to at least reach the state of gfxCardStatus for the 2009 models?

BaDWidoWMakeR commented 1 year ago

Hi Cody, actually I just start using gswitch on my Mid 2010 MBP 15" running macOS Monterey 12.6.2 via OpenCorePatcher.

Seems like gswitch is working fine with it.

Just to let you know.

If there is anything u may need from my MBP to check just let me know.

Kind Regards & Thanks for the great App.

BjΓΆrn Bildschirmfoto 2023-01-14 um 14 24 43