Quantcast
Channel: December 2016 – Michael Tsai
Viewing all articles
Browse latest Browse all 72

The Discrete GPU and You

$
0
0

Chris Liscio:

The combination of a dGPU and lower-capacity battery means that the practical battery life of these machines gets cut in half (or worse) when the dGPU is active. I’m not sure that previous models had nearly as bad a “battery life delta” as these ones, but boy-howdy is it noticeable in practice on this system.

[…]

This whole problem can be very easy to solve. You just have to set NSSupportsAutomaticGraphicsSwitching key to YES in your application’s Info.plist. The trouble is that an OpenGL context is being created, which defaults to switching the dGPU on. Enabling this flag in the plist will very likely fix the problem on its own, as the frameworks should Do the Right Thing (more details below) if they need access to OpenGL.

[…]

To solve the bug I had, it turned out that I was making a call to -[NSOpenGLContext clearDrawable] in the dealloc method of my custom NSOpenGLView. My NSOpenGLContext was already destructed, and a whole new NSOpenGLPixelFormat was getting created and kicked the GPU on again. The call I should have used instead was -[NSOpenGLView clearGLContext] (though I don’t even know if that’s really required, to be honest.

Previously: macOS 10.12.2 Removes Battery Time Remaining Estimate, gfxCardStatus.

Update (2016-12-13): McCloud:

you can explicitly ask CoreGL not to turn on the discrete GPU

You need to create your context with kCGLPFASupportsAutomaticGraphicsSwitching - won’t trigger discrete transition.


Viewing all articles
Browse latest Browse all 72

Trending Articles