JDK-8041900 : [macosx] Java forces the use of discrete GPU
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u45,8
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-10-30
  • Updated: 2020-08-15
  • Resolved: 2015-10-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u101Fixed 9 b92Fixed
Related Reports
Blocks :  
Duplicate :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Darwin karls-mbp 13.0.2 Darwin Kernel Version 13.0.2: Sun Sep 29 19:38:57 PDT 2013; root:xnu-2422.75.4~1/RELEASE_X86_64 x86_64

EXTRA RELEVANT SYSTEM CONFIGURATION :
MacBook Pro Late 2013 with integrated Intel Iris Pro graphics and discrete NVIDIA GeForce GT 750M graphics cards.

A DESCRIPTION OF THE PROBLEM :
When a Java application runs that presents a UI (in this case a Swing UI) it forces Mac OS X to switch to the discrete GPU, thus consuming more energy than required.

According to https://developer.apple.com/library/mac/qa/qa1734/_index.html, adding an NSSupportsAutomaticGraphicsSwitching key with a value of true to the Info.plist of the application should enable it to use the integrated graphics. However regardless, the Java application uses the discrete graphics.

Apple's Java 6 does not have this property - it operates with the integrated graphics card correctly.

Apple also provide this tech note on supporting multiple GPUs, if it is useful! https://developer.apple.com/library/mac/technotes/tn2229/_index.html

ADDITIONAL REGRESSION INFORMATION:
It does work in Apple's Java, which isn't listed in the Regression drop down. I've included the java -version output for completeness:

java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run a Java application that shows a JFrame. Use Activity Monitor's Energy tab to see that it is using the "High Perf GPU".

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
That the Java application will not require the discrete / high perf GPU and will use the integrated GPU.
ACTUAL -
The Java application requires the discrete / high perf GPU and causes the system to switch to using the discrete GPU and thus use more energy / battery drain.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;

public class Test {

public static void main(String[] argv) {
JFrame f = new JFrame();
f.setVisible(true);
}

}
---------- END SOURCE ----------
Comments
https://bugs.openjdk.java.net/browse/JDK-8132759?focusedCommentId=13857073&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13857073
22-10-2015

The first link in the description is broken due to an ending comma. Here is the link that works: https://developer.apple.com/library/mac/qa/qa1734/_index.html
31-07-2015

I created JDK-8132775 to track the equivalent JavaFX issue.
31-07-2015

This remains an issue with Java 8u45. It applies to JavaFX GUIs as well.
25-05-2015

as P3 should be fixed or deferred
08-05-2014