Opened 12 years ago
Closed 8 years ago
#11111 closed defect (obsolete)
VirtualBox forces Mac laptops to use discrete GPU => Fixed in SVN
Reported by: | cap10morgan | Owned by: | |
---|---|---|---|
Component: | host support | Version: | VirtualBox 4.2.2 |
Keywords: | Cc: | ||
Guest type: | all | Host type: | Mac OS X |
Description
VirtualBox forces Mac laptops to activate their discrete GPUs, thus shortening battery life. I could understand this if there were a 3D accelerated guest OS running, but it also happens when a headless guest is running or even when no guests are running.
VirtualBox should not force the discrete GPU on when not running 3D accelerated guests.
Others have confirmed this issue in the forums here: https://forums.virtualbox.org/viewtopic.php?f=8&t=50574&p=234479&hilit=discrete#p234479
Attachments (3)
Change History (49)
comment:1 by , 12 years ago
comment:9 by , 12 years ago
Yes, understood. But so far we don't have an idea why VirtualBox triggers using the discrete CPU. Investigations plus patches are welcome.
comment:11 by , 12 years ago
If you search the web, you'll find that this issue isn't new. Maybe there's something to be learned from others.
http://code.google.com/p/chromium/issues/detail?id=88788
http://developer.apple.com/library/mac/#qa/qa1734/_index.html
http://developer.apple.com/library/mac/#technotes/tn2229/_index.html
comment:16 by , 12 years ago
+1 with the newest VB 4.2.14 version, please fix this the bateriies on macbook retina last for less than 2.3 hours
comment:17 by , 12 years ago
Just for fun I tried setting NSSupportsAutomaticGraphicsSwitching to true in VirtualBox's Info.plist as mentioned here:
http://developer.apple.com/library/mac/#qa/qa1734/_index.html
I managed to generate two nearly identical VBoxSVC crash reports by trying to use vagrant after setting that bit.
https://gist.github.com/phinze/da3b75a0219d6dec818e
Looks like a null pointer dereference somewhere in Appliance::Task. I'm way out of my league here, but conceptually it seems like we need to delay or avoid the creation of an OpenGL context in a headless environment. I'll see if I can get the chance to bomb around the VBoxSVC source this week and I'll post back here if I learn anything.
But anybody who actually knows what they're doing is more than welcome to chime in here. :)
comment:18 by , 12 years ago
Correction: The crashes I reported above were actually coming from #11895 - I had just upgraded to 4.2.14 before fiddling with this and the VBoxSVC
crashes were happening on OVF imports.
So after getting on 4.2.16, the behavior when adding that Info.plist
key is actually no change at all. The rest of my comments still apply, most especially the ones about me not knowing what I'm doing. ;)
comment:19 by , 12 years ago
+1
This is a huge issue... it would be fantastic to get support for switching graphics drivers!
comment:22 by , 11 years ago
Here is workaround that works for me. I get 5 hours with 3-4 instances running !!!!
I have the latest 4.2.16 VB installed. This works on both the lion and OS X 10.8.4 "mountain lion". Here is how can you get the virtual box work with integrated graphics. (YMMV)
- Make sure that all VB instances are in "Powered OFF" mode.
- Make sure that you don't have the "3d" or "2d" acceleration turned on under settings->Display
- start the gfxcardstatus utility (http://gfx.io)
- switch the card to "I" integrated mode "Integrated Only" using gfxcardstatus
- Start the VirtualBox
- Start one of the instances the graphic mode should stay on "I" integrated mode
I didn't try to start VB from the terminal window. I tested this with winxp, win7 win764 win2k8 and others. Let me know if it worked for you!
comment:24 by , 11 years ago
+1, it's the single biggest battery drain on my MBP and limits my mobility quite a bit, as I always work with (headless) VMs for development. Since the upgrade to OSX Mavericks is free, perhaps it's a good idea to just focus on that OS in the beginning.
comment:26 by , 11 years ago
If you're sure none of your VMs are using any graphics accelleration (2D/3D), you can add a line to the Info.plist yourself to avoid switching to the discrete GPU. Add this line within the <dict> tag in /Applications/VirtualBox/Contents/Info.plist:
<key>NSSupportsAutomaticGraphicsSwitching</key> <true/>
That stops my Macbook Pro from switching to the discrete GPU.
comment:27 by , 11 years ago
I'm on a MBP early 2013 and recently upgraded to Mavericks and my headless VM's no longer switch to discrete graphics. Not sure about non-headless VMs though.
comment:28 by , 11 years ago
My guess is that this is caused by VBoxSVC running the 3D test (which is a separate executable), but I have no idea whatsoever why this permanently marks it as needing the "good" 3D.
Any OSX experts around who could give a hand? The number of "+1" posts can't speed up our work if we have no idea what's the root cause and how to change it.
comment:29 by , 11 years ago
I'm not a complete Mac OS X expert, but I've done a lot of research on the subject of graphics switching. Any call to an OpenGL function will cause Mac OS X to switch to the discrete GPU until the application is closed.
In my experience it only happens when either starting a guest with 3D acceleration enabled (which expected behavior) or when I open the settings menu (that needs to be fixed). With the settings menu the discrete GPU stays in use until both the settings menu and the main window are closed. It doesn't matter whether a guest running simultaneously as long as it does not use 3D acceleration.
This lead me to believe this separate executable for the 3D test is only exited when the main window of VirtualBox closes.
EDIT: It will also persist on the guest if the settings menu is opened through its menus, meaning the guest has to be closed completely to switch back to the integrated GPU.
comment:31 by , 10 years ago
Summary: | VirtualBox forces Mac laptops to use discrete GPU → VirtualBox forces Mac laptops to use discrete GPU => Fixed in SVN |
---|
The 2nd part of the fix is part of the next maintenance release. Here is a test build.
comment:33 by , 10 years ago
Still happening for me when I open the machine settings dialog. OSX 10.9.4, MacBookPro6,2, VBox 4.3.18.
follow-up: 37 comment:36 by , 10 years ago
Replying to galitsyn:
Ringding, could you please attach VBox.log?
Unfortunately, I don't think VirtualBox writes log information for opening the settings dialog.
comment:37 by , 10 years ago
Replying to Ringding:
Replying to galitsyn:
Ringding, could you please attach VBox.log?
Unfortunately, I don't think VirtualBox writes log information for opening the settings dialog.
Could you please run any VM on your Mac host and attach VBox.log which relates to it?
by , 10 years ago
follow-up: 40 comment:39 by , 10 years ago
Replying to Ringding:
Sure, but that does not switch the graphics card.
Seems your VM has no 3D acceleration enabled. May I ask you to enable it and re-take log? Most likely graphics card switching is caused by 2D and/or 3D test execution which we run once settings dialog is opened. We enable offline rendering for both 2D and 3D tests if we correctly determine that Mac host has more than one GPU installed. Enabling 3D for VM should show if we do it correctly for your host. Btw, if you would build VBox from source -- 2D test will cause graphics switching because we patch Qt (and ship it) in order to enable offline rendering.
comment:40 by , 10 years ago
Replying to galitsyn:
Replying to Ringding:
Sure, but that does not switch the graphics card.
Seems your VM has no 3D acceleration enabled. May I ask you to enable it and re-take log? Most likely graphics card switching is caused by 2D and/or 3D test execution which we run once settings dialog is opened. We enable offline rendering for both 2D and 3D tests if we correctly determine that Mac host has more than one GPU installed. Enabling 3D for VM should show if we do it correctly for your host. Btw, if you would build VBox from source -- 2D test will cause graphics switching because we patch Qt (and ship it) in order to enable offline rendering.
It's the official binary. Sure enough, with 3D acceleration enabled, display switching did indeed occur.
follow-up: 42 comment:41 by , 10 years ago
Ok, thanks for the logs. VBox.log shows that we enable offline rendering and graphics card switching should not occur. Let me think about it tomorrow morning. Btw, you don't have any ext monitor attached to you MBP, right?
comment:42 by , 10 years ago
Replying to galitsyn:
Ok, thanks for the logs. VBox.log shows that we enable offline rendering and graphics card switching should not occur. Let me think about it tomorrow morning. Btw, you don't have any ext monitor attached to you MBP, right?
No. Integrated display, that’s all.
I have a version of Qt installed in /Library/Frameworks (4.8.5). Is it possible that there might be some interference coming from that?
comment:43 by , 10 years ago
I think this is not likely. May I ask you to attach sample report for VM process (sudo sample <VBox VM PID>)? It will show all dylibs used by the process.
by , 10 years ago
Attachment: | VirtualBoxVM_2014-12-09_231741_OY3S.sample.txt added |
---|
comment:45 by , 10 years ago
To clarify this: graphics switching is triggered by running a VM with 3D acceleration enabled (expected), but not when running one without 3D acceleration (also expected). It also happens when opening the machine settings dialog, either from the main manager window or from the running VM window itself (both not expected), the latter especially annoying because it will stay in discrete mode for as long as the VM continues to run.
comment:46 by , 8 years ago
Resolution: | → obsolete |
---|---|
Status: | new → closed |
Please reopen if still relevant with a recent VirtualBox release.
This issue remains. To replicate:
Using Mac OS 10.8.2, gfxCardStatus v2.3, VitrtualBox 4.2.6 r82870, driven by Vagrant 1.0.6