Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8041900

[macosx] Java forces the use of discrete GPU

XMLWordPrintable

    • 2d
    • b92
    • os_x

        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 ----------

              serb Sergey Bylokhov
              webbuggrp Webbug Group
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: