Re: Staying on integrated GPU while using NSOpenGLView
Re: Staying on integrated GPU while using NSOpenGLView
- Subject: Re: Staying on integrated GPU while using NSOpenGLView
- From: Miguel Pontes <email@hidden>
- Date: Wed, 12 Jun 2013 01:16:51 +0100
On Jun 11, 2013, at 21:39 , Nick Zitzmann <email@hidden> wrote:
> On Jun 10, 2013, at 10:03 PM, Miguel Pontes <email@hidden> wrote:
>
>> Hello,
>> I'm having issues getting an app to not trigger switching to the dedicated GPU when using NSOpenGLView.
> […]
>> Is there anything I'm doing wrong? I've read on this mailing list before (http://lists.apple.com/archives/cocoa-dev/2011/Mar/msg00795.html) that specifying certain pixel formats could cause the discrete GPU to be triggered, but I'n not even defining any pixel format when I'm initting the NSOpenGLView, just a simple [super initWithFrame:frameRect].
>
> No, you're not doing anything wrong. I was curious about this as well, and I noticed that, starting in 10.8.4, instantiating an IKImageBrowserView will not toggle the discrete GPU. So I tried to figure out what it was doing, and found it uses four pixel formats: NSOpenGLPFAAllowOfflineRenderers, NSOpenGLPFANoRecovery, NSOpenGLPFAAccelerated, and a mysterious pixel format identified as 1262.
>
> The first three of the above are standard pixel formats, but the 1262 format doesn't appear to be documented anywhere. I found out that adding the undocumented pixel format in addition to the three above apparently prevents the discrete switch-over from happening. Since it's undocumented, the usual disclaimers apply: use it at your own risk, it may break in the future, and all that.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
Actually, I was being dumb. I was failing to set the "NSOpenGLPFAAllowOfflineRenderers" pixel format. You must explicitly set that one for NSOpenGLView to not trigger a GPU change. Just letting it use the defaults won't work.
With NSOpenGLPFAAllowOfflineRenderers as a pixel format + NSSupportsAutomaticGraphicsSwitching in the Info.plist, the GPU change isn't triggered.
That 1262 format is a nice find, though. It appears that using it as a pixel format makes it ALWAYS use the integrated graphics, even without needing to set NSSupportsAutomaticGraphicsSwitching to YES in the Info.plist. I'm assuming they added that as a private, internal mode in order to make it so programs that use framework classes such as that ImageKit one you mentioned don't indadvertedly switch to discrete graphics when they use them, without the developers needing to go and explicitly modify the plist.
Thanks!
Miguel Pontes
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden