On Mar 29, 2011, at 11:36 PM, Nick Zitzmann wrote:

> 
> On Mar 29, 2011, at 3:16 PM, Jason Harris wrote:
> 
>> Hi All,
>> 
>> Some users are complaining that my application (MacHg) is causing their 
>> MacBooks to switch from using the integrated Intel (lower power) card to the 
>> NVIDIA (higher power) graphics card. 
>> 
>> Eg some related articles I dug up:
>> http://appletoolbox.com/2010/05/macbook-pro-mid-2010-graphics-switching-which-apps-trigger-how-to-monitor/
>> http://www.cocoabuilder.com/archive/cocoa/293116-i5-i7-auto-graphics-switching.html
>> http://support.apple.com/kb/HT3207
>> 
>> However, my application doesn't appear on the surface to make heavy use of 
>> graphics. (It does make heavy use of GCD though).  Is there a general cause 
>> for this switching of the graphics card?.  
> 
> There are a few of them I know about:
> 1. Your application starts CoreAnimation by calling -setWantsLayer: on a view 
> with a layer, or adding a layer in IB

Ahhh... yes I use core animation, but just very very lightly... some simple 
static stuff like:

        CIColor* black   = [CIColor colorWithRed:  0.0/255.0 green:  0.0/255.0 
blue:  0.0/255.0 alpha:1.0];
        CIColor* color0  = [CIColor colorWithRed: 77.0/255.0 green: 78.0/255.0 
blue: 87.0/255.0 alpha:0.8];
        CIColor* color1  = [CIColor colorWithRed: 39.0/255.0 green: 40.0/255.0 
blue: 52.0/255.0 alpha:0.5];
        CIVector* center = [self recomputePosition];
        NSNumber* radius = radius_ ? radius_ : [NSNumber numberWithFloat:450.0];
        
        CIFilter* gradiantFilter = [CIFilter 
filterWithName:@"CIGaussianGradient"];
        [gradiantFilter setValue:color0 forKey:@"inputColor0"];
        [gradiantFilter setValue:color1 forKey:@"inputColor1"];
        [gradiantFilter setValue:center forKey:@"inputCenter"];
        [gradiantFilter setValue:radius forKey:@"inputRadius"];
        
        CIFilter* constantFilter = [CIFilter 
filterWithName:@"CIConstantColorGenerator"];
        [constantFilter setValue:black forKey:@"inputColor"];
        
        foregroundFilters_ = [NSArray arrayWithObject:gradiantFilter];
        backgroundFilters_ = [NSArray arrayWithObject:constantFilter];

        [[self layer] setFilters: foregroundFilters_];
        [[self layer] setBackgroundFilters:backgroundFilters_];

Not much more... Ohh well at least I know where its coming from then!

Thanks!
   Jas

> 2. Your application initializes an NSOpenGLView using a pixel format that 
> works best using the discrete GPU
> 3. Your application initializes a QTCaptureView, QTMovieView, or QCView
> 4. The user plugged in an external display (external displays must use the 
> discrete GPU)
> 
> There might be more, but those are the ones I know about.
> 
>> How can I find out when such a switch occurs in my code and for what 
>> reasons?  
> 
> If you have a dual-GPU Mac, then try breaking on IOServiceOpen and look at 
> the stack trace when it breaks. If you don't, then you can't.
> 
> Nick Zitzmann
> <http://www.chronosnet.com/>
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to