gfxCardStatus icon indicating copy to clipboard operation
gfxCardStatus copied to clipboard

External monitor doesn't work if plugged in while on 'Integrated Only' mode

Open codykrieger opened this issue 14 years ago • 36 comments

Should probably listen for the screen params change notification in this case and force to the 330M if an external monitor is connected.

codykrieger avatar May 18 '10 23:05 codykrieger

This might not be related, but I'll throw it out anyway. When my mid-2010 MBP goes from single-display to dual-display, it switches the built-in LCD screen from Intel to nVidia graphics. So in dual-display mode, both displays are being driven by the nVidia.

Now here's where it gets kinda tricky. If you go back to single-display mode with the built-in display, it'll switch back to the Intel GPU. BUT if you go back to single-display mode with the external display, it stays on the nVidia GPU (connect an external display, close the lid on the laptop, awake-from-sleep with external keyboard/mouse commands, and it awakes only using the external).

What's even wonkier is Apple changes the CGDirectDisplayID when your built-in LCD Screen switches from Intel to nVidia. I asked about the issue on StackOverflow here:

http://stackoverflow.com/questions/2861871/how-to-resolve-cgdirectdisplayid-changing-issues-on-newer-multi-gpu-apple-laptops

So forcing the 330M when dual displays are connected should fix things. But, you might also have to force the 330M when a single external display is connected when the laptop lid is closed (I don't know if the Intel can drive an external display - you'll have to test that).

If it can't, you can do something like this:

if 1 display, and display is not built-in, use nVidia. Else, use Intel.

You can query to see if a display is built-in or not like so:

CGDirectDisplayID directDisplayID = ...;
boolean_t isBuiltin = CGDisplayIsBuiltin(directDisplayID);

To be notified of display changes:

// you register a C-Method for callbacks like so:

CGDisplayRegisterReconfigurationCallback(displaySettingsChanged, NULL);

// Write the C-Method like this (you can use something like id aSelf = self; to gain access to the object the method exists in, or pass it through userInfo).  Modify accordingly:

void displaySettingsChanged(CGDirectDisplayID directDisplayID, CGDisplayChangeSummaryFlags flags, void *userInfo)
{

    if (flags & kCGDisplayBeginConfigurationFlag)
        // pass - changes are about to occur, but haven't yet
    else
        NSLog(@"Display Changed - %u", directDisplayID);
}

// And when finished (dealloc), de-register the method from Core Graphics:

CGDisplayRemoveReconfigurationCallback(displaySettingsChanged, NULL);

Hope that helps! :)

dave-gallagher avatar May 19 '10 21:05 dave-gallagher

Thanks a lot for that - should help immensely. :)

codykrieger avatar May 20 '10 10:05 codykrieger

I just stumbled on this as well: I had my display set to Intel only to save battery life on the road but when I got home and plugged my external display in it would not work. Would be nice to be able to set a preference that on power it always uses mode x and by battery it uses mode y :)

jkp avatar May 25 '10 07:05 jkp

Even a pop-up to say why the external monitor isn't working would be helpful.

KenMacD avatar May 26 '10 12:05 KenMacD

Problem is when you have your laptop shut though :)

jkp avatar May 26 '10 13:05 jkp

Yeah, some kind of popup or Growl notification would be a nice touch here for sure. Then people could switch to the 330M of their own accord.

codykrieger avatar May 26 '10 17:05 codykrieger

I'm constantly running in the issue described by jkp.

Would love to see an option in gfxCardStatus to automatically switch to nvidia when laptop shut + external display when it previously was set to intel-only. thanks :)

rmoriz avatar Oct 07 '10 01:10 rmoriz

+1 on jkp and rmoriz's issue. Having the same problem here. In my opinion, it shouldn't even be a preference. If an external display is plugged in, use nvidia. When the display is unplugged, revert back to the last option.

gee-forr avatar Dec 23 '10 07:12 gee-forr

+1 on gee-forr's suggestion. with an external display you have to enable nvidia.

spullara avatar Jan 03 '11 07:01 spullara

Just a note on this one - I run Linux on my 2010 MacBook Pro - http://www.tomjepp.co.uk/?page=gentoo_mbp62 - and external and internal displays can be used simultaneously on the Intel HD chip.

So it's possible. I assume in this case that OSX is our limiting factor.

ghost avatar Feb 25 '11 07:02 ghost

Mmm...that is interesting. Any way to make this possible in OS X without fiddling with EFI?

codykrieger avatar Feb 25 '11 08:02 codykrieger

I use IO writes to the gmux unit to change GPU directly under Linux, I don't know how this translates to OSX (I'm reading through the gfxCardStatus code, but Objective-C is not my strong suit).

I use something like: #define PORT_SWITCH_EXTERNAL 0x740

// switch to intel
outb(2, PORT_SWITCH_EXTERNAL);

// switch to nvidia
outb(3, PORT_SWITCH_EXTERNAL);

This works for me on Linux (I've not tried it on OSX and don't expect it to work, YMMV).

Just to be 100% clear: I use this on Linux without any NVIDIA kernel modules loaded and with the NVIDIA chip actually powered down, so I know it works.

ghost avatar Feb 25 '11 08:02 ghost

+1 on gee-forr's suggestion.

salzig avatar May 18 '11 21:05 salzig

Hey guys,

I hate to bump an old issue, but I was wondering if this would ever get any attention. I rely on gfxcardstatus so much right now, as I leave it on integrated due to Lion's dodgy nvidia drivers constantly kernel panicking.

And just in case there was any misgivings here - thank you Cody, I really appreciate all the hard work you've already put in to this. Open Source is not always easy. Just want you to know you are appreciated.

gee-forr avatar Aug 16 '11 15:08 gee-forr

@gee-forr Sorry about the delay on this - my summer has been pretty action-packed. It was hard to find the time to even get v2.1 out the door for Lion compatibility. In about two weeks or so, my summer will effectively wind down, and I should have some more time to take a look at this. Thanks for the kind words. :)

It seems to me, though, that if you're having regular kernel panics that the last thing you'd want is to plug in an external monitor and force a switch. ;) Hopefully a fix will come for all of that nonsense soon.

codykrieger avatar Aug 17 '11 05:08 codykrieger

Hi Cody,

Thanks for the feedback. Agree on your last sentence, unfortunately, I need to present to audiences quite a bit, and when I forget I'm locked on intel, there's an awkward shuffle where I unplug, and shuffle around whilst fiddling with settings.

Well... 10.7.1 got released today, no specific mention of a fix for the problem, but fingers are crossed.

gee-forr avatar Aug 17 '11 08:08 gee-forr

Fair point!

Doesn't look like a fix is present in 10.7.1 - drat.

codykrieger avatar Aug 18 '11 08:08 codykrieger

I just ran into this problem earlier when I was trying to give a presentation with my retina MBP. I tried plugging it into the HDMI / thunderbolt ports and the external screen wouldn't work, because the power cable wasn't plugged in which made it run on Intel only.

Only later did I discover that it was due to this app...

Can we have some kind of option that just ignores the "integrated only" flag if you're not connected to power but do have an external device present?

dennda avatar Jul 18 '12 21:07 dennda

@dennda It's not quite as easy as that. It's questionable as to whether or not detecting external monitors being plugged in while you're on Integrated Only is even possible. I tried to have a fix for this in v2.2.1 and ran out of time because it wasn't cooperating. I'm basically just going to kick the machine into Dynamic Switching if I detect that a display has been plugged in if you're on Integrated Only.

That said, I don't recommend using power source-based switching if you're giving presentations or using external displays often, because changing power sources while that's going on can make things kind of screwy.

codykrieger avatar Jul 19 '12 07:07 codykrieger

Still an issue.

Please add a checkbox option to kick it into dynamic mode if external monitor is present or sth. Because othervise, it just does'nt detect external displays at all!

sala91 avatar Sep 19 '12 13:09 sala91

@sala91 From what I've tried so far, it's looking like it's not possible to detect that a display is plugged in while on Integrated Only. So I don't know if it will ever happen or not. If so, there wouldn't be a preference for it, since I seriously doubt anyone would actually want their display to not be detected if they plugged one in – it would just switch to Dynamic Switching with no user intervention required.

codykrieger avatar Sep 19 '12 17:09 codykrieger

What tomjepp describes also works under OS X sometimes. Just yesterday I had an "error" that allowed me to power an external Display (< full hd) with only the Intel graphics. OS X detected this and switched the internal display to black, but I could still move and see the mouse on the internal screen. So, feature-request: External Display + internal Display via Intel graphics. Btw. I'm on a rMBP, so this is a hell lot of work to do for the intel chip, maybe too much?

0ff avatar Sep 24 '12 15:09 0ff

@simpleFabian Yeah, I've seen that issue happen on a couple of rMBPs so far, though I have yet to see it on older hardware.

One big issue with adding such a feature to gfxCardStatus is that it would likely cause OS X to freak out in some yet-unknown cases. It doesn't expect to ever have to run an external display on the integrated GPU at this point, and certain assumptions may have been made in OS X that that would be the case, at least on these machines.

codykrieger avatar Sep 25 '12 06:09 codykrieger

(Note to self: a user pointed out that BrightnessSync watches for displays being plugged in/unplugged. Its source appears to do exactly what we need in this respect, and may work while on Integrated Only: http://www.bernhard-baehr.de/).

codykrieger avatar Dec 26 '12 10:12 codykrieger

This would be pretty cool, specially on the new rMBP where the discrete graphics card is almost only useful in gaming/3D.

goncalossilva avatar Oct 24 '13 18:10 goncalossilva

Today gfxCardStatus is used by a lot of the owners of early 2011 MBPs who have troubles with the external Radeon GPU.

Look at the thread https://discussions.apple.com/message/23685303?ac_cid=tw123456

For example, to be able to boot my MBP 8.2 , I must remove the ATI* and AMD* extensions, but in this case, the selected GPU is the Radeon GPU and gfxCardStatus is not able to force the usage of the integrated GPU because it detects an external display even I have no plugged external display !...

note: if I let the ATI* and AMD* extensions in place, my MBP freezes during the boot sequence

It would be great if we could use gfxCardStatus to always force the usage of the internal GPU.

ogattaz avatar Nov 06 '13 20:11 ogattaz

I experience the same issue, and the frustrating thing is that if I forget that I've forced integrated-only mode and accidentally connect an external display, I'm forced to reboot in order for it to work again. Simply changing the setting to dynamic isn't sufficient.

cchriste avatar Apr 06 '14 18:04 cchriste

You should not have to reboot. Switching to Dynamic and unplugging/plugging the display back in should be sufficient.

Unfortunately, though, this isn't easy (maybe not even possible) to fix.

Sent from my iPhone

On Apr 6, 2014, at 11:27 AM, Cameron Christensen [email protected] wrote:

I experience the same issue, and the frustrating thing is that if I forget that I've forced integrated-only mode and accidentally connect an external display, I'm forced to reboot in order for it to work again. Simply changing the setting to dynamic isn't sufficient.

— Reply to this email directly or view it on GitHub.

codykrieger avatar Apr 06 '14 22:04 codykrieger

Sorry if this has already been asked and answered, but @codykrieger your software has been saving my ~ $3000 from going down the drain for some time now. I use your gfxCardStatus (v2.1) to prevent my MBP Mid 2010 from crashing like crazy. My only problem is with using external displays. When I connect the external display (a TV), the crashing issue resurfaces. Is there a fix for this- Thank you for the wonderful software!!

vikramram avatar Jun 22 '14 05:06 vikramram

Assuming that the issue with your machine is related to the discrete GPU, then no, there's probably no way to work around the crashes when using an external display of any kind, since those require the use of the discrete GPU. :/

On Jun 21, 2014, at 10:28 PM, vikramram [email protected] wrote:

Sorry if this has already been asked and answered, but @codykrieger your software has been saving my ~ $3000 from going down the drain for some time now. I use your gfxCardStatus (v2.1) to prevent my MBP Mid 2010 from crashing like crazy. My only problem is with using external displays. When I connect the external display (a TV), the crashing issue resurfaces. Is there a fix for this- Thank you for the wonderful software!!

— Reply to this email directly or view it on GitHub.

codykrieger avatar Jun 22 '14 21:06 codykrieger