Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ah-

macrumors member
May 7, 2010
38
1
I took a look at AppleGraphicsControl the last few days and found a way to manually switch cards.

Warning: This will likely make your laptop explode and kill some kittens, so don't run it if you're not absolutely certain what you're doing. Also, I'm not responsible if something like this happens.

Code is at http://pastry.se/554001/

This talks directly to the switching driver, at the moment it's able to force a graphics card switch (regardless if you're in automatic switching mode or not) and to disable switching completely (but it's not possible to reenable it without a reboot atm), look at the code for more.

It's not finished yet, but i think it's possible to extend it so you can choose between automatic switching, always intel and always nvidia.

Another thing I'd like to do is to implement a black/whitelist for applications in dynamic switching but I don't know how it marks an application as bad exactly.

Edit: Everyone likes screenshots, so here's one with X11 running using the intel chip: click
 

Benni-chan

macrumors newbie
Apr 29, 2010
28
0
at last, finally some good news :)
so glad, that our dreams can really come true :D

looking forward to see this included in gfxcardstatus
 

bitninja

macrumors regular
Jun 16, 2007
236
0
San Jose, CA, USA
I took a look at AppleGraphicsControl the last few days and found a way to manually switch cards.

@ah-: I've got this working in the context of gfxCardStatus - nice work! Right now I've got a menu item for toggling the GPU that's in use, and it works great. I hesitate to uncomment the method call that disables the automatic switching for fear of my laptop and kittens dying...I need this laptop for a presentation tomorrow. After that I'm free to do whatever I wish with it, but not until then. :D
 

tufty

macrumors newbie
Jul 25, 2002
7
0
Great detective work! I was starting to have some hope because many Apple apps do not switch GPU, but do things that third party ones do, so I suspect Apple has some private list for their apps (at least the ones that they know don't need nVidia).

I did a battery test last night watching the UK election, light surfing and chatting, and got 4.5 hours on nVidia. Not very good.
 

bitninja

macrumors regular
Jun 16, 2007
236
0
San Jose, CA, USA
Interesting, it seems like it doesn't switch back to the 330M if you've manually switched GPUs and you launch another app that would normally trigger it. e.g. Launch Chrome, switch to Intel, then launch Tweetie. It stays on Intel. I'm pushing out v1.6 in a couple minutes - should account for the 'external display' item in the dependent process list and includes a menu item that switches GPUs upon clicking it, but doesn't include the ability to disable automatic switching.

Give me a few minutes!
 

ah-

macrumors member
May 7, 2010
38
1
Interesting, it seems like it doesn't switch back to the 330M if you've manually switched GPUs and you launch another app that would normally trigger it. e.g. Launch Chrome, switch to Intel, then launch Tweetie. It stays on Intel. I'm pushing out v1.6 in a couple minutes - should account for the 'external display' item in the dependent process list and includes a menu item that switches GPUs upon clicking it, but doesn't include the ability to disable automatic switching.

Give me a few minutes!

It switched from Intel to Nvidia sometimes when I _closed_ X11 after switching manually before. That's why I'm working on disabling dynamic switching.
 

huythanhv2

macrumors regular
Apr 5, 2010
158
64
Interesting, it seems like it doesn't switch back to the 330M if you've manually switched GPUs and you launch another app that would normally trigger it. e.g. Launch Chrome, switch to Intel, then launch Tweetie. It stays on Intel. I'm pushing out v1.6 in a couple minutes - should account for the 'external display' item in the dependent process list and includes a menu item that switches GPUs upon clicking it, but doesn't include the ability to disable automatic switching.

Give me a few minutes!

Bought my MacbookPro i7 3 weeks ago and still haven't got it yet to try on ur fantastic work but please know that even I haven't tried it yet I do really appreciate your contribution to the Mac community =)

Take care =)
 

bitninja

macrumors regular
Jun 16, 2007
236
0
San Jose, CA, USA
v1.6 is up! See my previous post for details. "Check for Updates" or manually download at the link in my signature.

As usual, let me know if you have any issues! I still have a couple more things to do that I had planned for this release, but I wanted to push out this functionality as soon as possible so it's easy for the less technically inclined to test ah's code.

huythanhv2 said:
Bought my MacbookPro i7 3 weeks ago and still haven't got it yet to try on ur fantastic work but please know that even I haven't tried it yet I do really appreciate your contribution to the Mac community =)

Take care =)

No problem at all! Please let me know how it works for you when it shows up. :)

Thanks!
Cody
 

bitninja

macrumors regular
Jun 16, 2007
236
0
San Jose, CA, USA
I've decided to open-source gfxCardStatus. I don't feel that it's right to include ah's code without properly crediting him, and this way everything that's going on would be a bit more transparent. I'll post the GitHub link soon.

@ah-: any particular name you'd like me to use in crediting you for your work? :)

Cody
 

Libertine Lush

macrumors 6502a
Nov 23, 2009
682
2
Wow, switchable GPU implementation! It's a Friday night; I'm at home; and I don't care. This is awesome. Thank you, Cody!

Oddily, my battery runtime goes up a few minutes when I switch to the Nvidia.
 

bitninja

macrumors regular
Jun 16, 2007
236
0
San Jose, CA, USA
Wow, switchable GPU implementation! It's a Friday night; I'm at home; and I don't care. This is awesome. Thank you, Cody!

Oddily, my battery runtime goes up a few minutes when I switch to the Nvidia.

No problem! Thank ah, as well - all I did was modify his code to fit in the context of gfxCardStatus.

Regarding the battery life estimation, that's strange. I usually keep the battery percentage in my menu bar, not the time, so I haven't noticed that. Does it eventually adjust and reflect the correct time remaining?
 

Libertine Lush

macrumors 6502a
Nov 23, 2009
682
2
Regarding the battery life estimation, that's strange. I usually keep the battery percentage in my menu bar, not the time, so I haven't noticed that. Does it eventually adjust and reflect the correct time remaining?

I've switched it back and forth to compare, almost 10 times. Most times it still goes down with the Intel GPU. Peculiar. Though completely unrelated to your program.
 

bitninja

macrumors regular
Jun 16, 2007
236
0
San Jose, CA, USA
I've switched it back and forth to compare, almost 10 times. Most times it still goes down with the Intel GPU. Peculiar. Though completely unrelated to your program.

Very peculiar indeed. It may be one of the kinks still present in ah's code.

@ah-: is it possible that the switch is taking place, but it's not actually switching off the power to the 330M?
 

walterpaisley

macrumors 6502
Oct 27, 2004
328
314
Springfield
Has anyone else noticed if you manually switch to the intel graphics the section of any app that uses core animation is visually broken?

Here's what Tweetie looks like with the intel card switched on:

http://neil.io/XQL64+

And here's Path Finder:

http://neil.io/XQM2v+

Restarting the apps doesn't fix the issue. It's as if any part of an application that calls the frameworks that turn on the nvidia card disappears.

I'm *super* happy this option exists, but it looks like there needs to be some internal massaging by Apple to truly make it work.
 

walterpaisley

macrumors 6502
Oct 27, 2004
328
314
Springfield
Hmm...haven't noticed that. Tweetie looked fine for me. Which model MBP do you have? Can anyone else confirm this behavior?

What happens when you close the Tweetie window and open a new one (with intel graphics forced on)?

If you leave the window open, it works fine, but as soon as you close it, poof.

I'm running a 15-inch i7.
 

ah-

macrumors member
May 7, 2010
38
1
I've decided to open-source gfxCardStatus. I don't feel that it's right to include ah's code without properly crediting him, and this way everything that's going on would be a bit more transparent. I'll post the GitHub link soon.

@ah-: any particular name you'd like me to use in crediting you for your work? :)

Cody

Great move, I'm looking forward to the open source version. There's a lot of potential for people to improve gfxCardStatus and it's a solid base.
Btw., just ah is fine by me.

@ah-: is it possible that the switch is taking place, but it's not actually switching off the power to the 330M?

I don't think so but it's possible. While experimenting on my laptop the logs showed that the 330M gets always powered down and the intel chip stays on all the time, even when the 330M is selected. So if anything the battery life should get better when you select the intel card.

Has anyone else noticed if you manually switch to the intel graphics the section of any app that uses core animation is visually broken?

That's probably the reason why Apple disabled this option and I don't think we can do anything about it. But I'll look into it sometime.

In other news, I'm working on getting more info directly out of the driver like which cards are powered on and if dynamic switching is enabled. There's also an option to get the old switching behavior which forces you to log out before switching in case anyone misses that :D
But I highly doubt this works the other way around and I don't have access to an older mbp to test it.
 

IceBreakerG

macrumors member
Apr 27, 2010
52
30
Cordova, TN
This is awesome work. Thanks guys! I have Yahoo Messenger running, and also loaded up iPhoto and Photo Booth (neither of them switched to the nVidia GPU when I started them though). I didn't notice anything out of the ordinary while they were running on the Intel GPU though. So I'm not sure if any other apps will have the same problems as what neilio is seeing. So far so good though. This is awesome though!
 

MBHockey

macrumors 601
Oct 4, 2003
4,050
297
Connecticut
Wow, never thought this would come so fast! Great job guys!

Looks like it's definitely working. When I open Starcraft 2 the nVidia GPU gets fired up but when I switch them the FPS at the menu screen drops from 80 to 35 haha :)
 

ah-

macrumors member
May 7, 2010
38
1
New Version done, with support for "use intel only": http://pastry.se/557002/

I wasn't able to reproduce the tweetie bug, if someone find a reliable way to trigger the bug please tell me. Also battery life goes way up for me when using the intel graphics.

And it doesn't look like it's possible to change the behavior of the apple dynamic switching, so there won't be black/whitelists in addition to the apple switching.
But I think we could just implement our own Optimus-like switching with a custom blacklist of applications that trigger the nvidia gpu. And different profiles when running on battery or plugged in. Oh, the possibilities :D

I really hope someone will implement all this as I have almost no experience with mac programming and would rather leave all the gui work to someone with the right skills. So please post your ideas how the interface could look like!
 

murdercitydevil

macrumors 68000
Feb 23, 2010
1,561
0
california
New Version done, with support for "use intel only": http://pastry.se/557002/

I wasn't able to reproduce the tweetie bug, if someone find a reliable way to trigger the bug please tell me. Also battery life goes way up for me when using the intel graphics.

And it doesn't look like it's possible to change the behavior of the apple dynamic switching, so there won't be black/whitelists in addition to the apple switching.
But I think we could just implement our own Optimus-like switching with a custom blacklist of applications that trigger the nvidia gpu. And different profiles when running on battery or plugged in. Oh, the possibilities :D

I really hope someone will implement all this as I have almost no experience with mac programming and would rather leave all the gui work to someone with the right skills. So please post your ideas how the interface could look like!

I second the above. It would be really nice to set which programs trigger different card usage. for instance, I like using chrome but it always makes the 330M kick in, so I'm back to firefox. If you could, hopefully, in the next release, add this, it would be a huge step forward. Pity that apple didn't include this, at the very least, as an optional functionality. Also, I would love to see an option to make the 330M kick in whenever the MBP is plugged into the wall, regardless of apps running. Awesome work, by the way.
 

KingSpeedy

macrumors newbie
Apr 11, 2010
8
0
Just reverted back to 1.5. I started having horrible graphic corruption with the iGPU, which was fixed by switching to the dGPU. Then I started to get alarming fan noises coming from the back of the laptop. Reverted to the 1.5, and have had no problems so far.
 

bitninja

macrumors regular
Jun 16, 2007
236
0
San Jose, CA, USA
Wow, never thought this would come so fast! Great job guys!

Looks like it's definitely working. When I open Starcraft 2 the nVidia GPU gets fired up but when I switch them the FPS at the menu screen drops from 80 to 35 haha :)

Haha, nice! That's proof enough for me.

ah- said:
New Version done, with support for "use intel only": http://pastry.se/557002/

I wasn't able to reproduce the tweetie bug, if someone find a reliable way to trigger the bug please tell me. Also battery life goes way up for me when using the intel graphics.

And it doesn't look like it's possible to change the behavior of the apple dynamic switching, so there won't be black/whitelists in addition to the apple switching.
But I think we could just implement our own Optimus-like switching with a custom blacklist of applications that trigger the nvidia gpu. And different profiles when running on battery or plugged in. Oh, the possibilities

I really hope someone will implement all this as I have almost no experience with mac programming and would rather leave all the gui work to someone with the right skills. So please post your ideas how the interface could look like!

Nice! I'll implement this as soon as I get a few moments. I'll be super busy tonight and all day tomorrow. Next release will be the first official version up on GitHub.

KingSpeedy said:
Just reverted back to 1.5. I started having horrible graphic corruption with the iGPU, which was fixed by switching to the dGPU. Then I started to get alarming fan noises coming from the back of the laptop. Reverted to the 1.5, and have had no problems so far.

That's unfortunate - which applications specifically did you experience the graphics corruption in? And by "alarming fan noises," do you mean that they just became loud, or were they whining? Which model MBP do you have?

Thanks!

murdercitydevil said:
I second the above. It would be really nice to set which programs trigger different card usage. for instance, I like using chrome but it always makes the 330M kick in, so I'm back to firefox. If you could, hopefully, in the next release, add this, it would be a huge step forward. Pity that apple didn't include this, at the very least, as an optional functionality. Also, I would love to see an option to make the 330M kick in whenever the MBP is plugged into the wall, regardless of apps running. Awesome work, by the way.

Agreed. I like Chrome as well. A whitelist would be great, and I dig the power source-based GPU changing idea. Thanks for the suggestions!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.