rugarciap / Turbo-Boost-Switcher

Turbo Boost disabler / enable app for Mac OS X
GNU General Public License v2.0
1.49k stars 151 forks source link

Ability to switch graphics depending of the power source #42

Open heaven opened 7 years ago

heaven commented 7 years ago

Apple allows to adjust some settings depending on the power source, but not to switch graphics. I would like to use discrete graphic working from the power adapter.

screen shot 2017-08-29 at 13 46 37
rugarciap commented 6 years ago

Hi!

I know this is old, but could you please elaborate a little more? Thanks!

heaven commented 6 years ago

Hi, sure. The problem is I don't have a setting to prefer discrete GPU when on power and integrated when working from the battery. On the screenshot, you can see the graphics switching option was moved outside the battery/power adapter tabs.

rugarciap commented 6 years ago

Hi,ok, I get it, but don't see how that is related to enabling / disabling Turbo Boost..., so you're requesting to add a feature to switch mode when on battery from within the app? ...

heaven commented 6 years ago

Not related to turbo boost, but I was thinking this could be a great feature that is missing in mac os.

ideologysec commented 5 years ago

Seems also like, just as you can enable/disable TurboBoost on battery to save power, @heaven is asking to be able to automatically use the dedicated GPU when connected to power.

So, on battery, switches automatically/prefers integrated GPU. when connected to power, the dedicated GPU is used.

heaven commented 5 years ago

Yeah, something like that. Mac OS doesn't have the ability to set the GPU preference. You can see on the screenshot above the graphics switching setting is out of the scope and there's no way to set up the GPU preference based on the modes.

Often, when working from the battery, during long trips, waiting in airports or working from a plane I need the maximum battery life. And something like Google Chrome forces discrete GPU and dries the battery in a few hours.

I reported this issue to Apple but they don't care. So I was thinking it would be an awesome feature if there was a checkbox that would disable discrete GPU when working from the battery:

Screen shot 2019-11-08 at 09 49 06

I am not sure if this is possible to implement, this is just a setting that I really miss in Mac OS.

jb510 commented 4 years ago

For years I used https://github.com/codykrieger/gfxCardStatus for forcing the discrete GPU off to extend battery life and reduce heat generation on my MBPs. It was awesome, but @codykrieger went to work for Apple and stopped supporting it since it used private apis. I’m fairly certain it stopped working all together in newer MBPs or with 10.14.

Above, @heaven’s request is a bit confusing. There is no real performance benefit to forcing the dGPU on. Auto switching works great. There is a huge power and heat savings to forcing it off however, with minimal impact to most non-intensive workloads (ie, browsing, coding, typing, not rendering).

It would be a welcome related feature to disable dGPU switching along with disabling CPU turbo If that even still possible.

ideologysec commented 4 years ago

It's no longer possible to force integrated-only GPU; that changed back in High Sierra I believe.

jb510 commented 4 years ago

It's no longer possible to force integrated-only GPU; that changed back in High Sierra I believe.

I stand corrected, 10.13 not 14

codykrieger commented 4 years ago

@jb510 Well, that's one version of events, I suppose. 😛

In actuality, when I was at Apple, I had special dispensation to continue supporting gfxCardStatus to a degree.

I'm pretty sure the root cause of the breakage comes down to changes in AppleGraphicsControl.kext, which is how gfxCardStatus interfaces with the graphics muxing system. The way gfxCardStatus speaks to AppleGraphicsControl is based on some reverse-engineering originally done by a semi-anonymous poster on the MacRumors forums back in 2010. With some effort, it may be possible to fix the brokenness introduced in the 10.13-ish timeframe.

While I now have the know-how to do this kind of reverse-engineering myself, ultimately, I don't think it's worthwhile. The vast majority of remaining gfxCardStatus users are folks trying to prolong the life of older machines with defective hardware—which is all well and good—but the automatic graphics switching in modern macOS is pretty damn good, and the hardware seems to be more reliable (y'know, aside from the keyboards).

That being the case, gfxCardStatus seems a lot less necessary now than it was in 2010. 🤷‍♀

jb510 commented 4 years ago

Cody thank you for that!

I agree gfx switching is way better these days. Interesting people using it to get around broken hardware, I’d never thought of that.

I’m an edge case in that I often use an external usb monitor while still on battery. That would force the dGPU on and eat more power than really need. But that was years ago and I have no idea yet if my 3 day old 16” will behave that way.

Even then an external usb-pd battery has solved 99% of my unplugged all day power needs.

Thanks again for the awesomeness that was/is Gfxswitcher.

jb510 commented 4 years ago

Oh! And sorry about the confusion. I clearly misremembered whatever it was I read when you announced going to work for Apple. Maybe it was just a similar story someone else shared.

codykrieger commented 4 years ago

@jb510 Heh, no worries.

zllovesuki commented 4 years ago

On my 2019 16-inch MacBook Pro running macOS 10.15.3 Catalina, this still works to switch your graphics automatically based on your power source:

Switch to discrete graphics when on AC Power: sudo pmset -c gpuswitch 1

Switch to integrated graphics when on battery: sudo pmset -b gpuswitch 0

Or an one-liner: sudo pmset -c gpuswitch 1 && sudo pmset -b gpuswitch 0

Explanation: pmset changes your power profile depending on power source (-c for charging, -b for battery), 1 for discrete graphics, and 0 for integrated graphics.


To reset back to default behavior: sudo pmset -a gpuswitch 2

Explanation: -a for both AC and Battery.


Using this pmset in combination with Turbo Boost Switcher, running on battery is extremely cool and it saves on battery greatly.

Caveat: If you are running something that specifically uses the discrete graphics, the application/script will still uses the discrete without the OS switching to the discrete graphics (as evident by running Keras while the system reports it is using integrated graphics, yet the discrete GPU is using 50W of power reported by iStat Menus).

mjturner commented 4 years ago

Bit belated, but I've found that gSwitch works well as a replacement for gfxCardStatus. It possibly doesn't fit others' use cases, but I use it to force discrete graphics to avoid the annoying integrated/discrete switch when using certain applications (eg, when browsing an image-heavy site in Firefox).

codykrieger commented 4 years ago

@mjturner If that's all you want to do, you don't need anything like gfxCardStatus or gSwitch. Just disable Automatic graphics switching in System Preferences > Energy Saver. That'll keep the discrete GPU on all the time. (You'll want to disable and remove gfxCardStatus/gSwitch before doing that.)

poige commented 1 year ago

On my 2019 16-inch MacBook Pro running macOS 10.15.3 Catalina, this still works to switch your graphics automatically based on your power source:

Switch to discrete graphics when on AC Power: sudo pmset -c gpuswitch 1

Switch to integrated graphics when on battery: sudo pmset -b gpuswitch 0

Or an one-liner: sudo pmset -c gpuswitch 1 && sudo pmset -b gpuswitch 0

Explanation: pmset changes your power profile depending on power source (-c for charging, -b for battery), 1 for discrete graphics, and 0 for integrated graphics.

There's another explanation @zllovesuki : If it doesn't fail when you run it, it doesn't mean it worked as you expected (and persuaded others). It's simply just another way to the same knobs as with GUI and it won't make macOS handle it any smarter than its GUI.

rugarciap commented 1 year ago

Hi,

Now that I've released another app called Power Mode Switcher (http://www.pmswitcher.com), this could fit in that app better than inside Turbo Boost Switcher. Would that make sense to you? :)

poige commented 1 year ago

As to me TBSw is still appropriate app to add the feature — switching turbo boost on/off for a CPU is very close to changing between int/ext GPUs, kinda switching graphics boost on/off. And of course it should be just a different setting, not the all-in-one big on/off knob.