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

[macosx] Java forces the use of discrete GPU

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      b92
    • OS:
      os_x

      Backports

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

          Issue Links

            Activity

            Hide
            vdyakov Victor Dyakov added a comment -
            as P3 should be fixed or deferred
            Show
            vdyakov Victor Dyakov added a comment - as P3 should be fixed or deferred
            Hide
            swpalmer Scott Palmer added a comment -
            This remains an issue with Java 8u45. It applies to JavaFX GUIs as well.
            Show
            swpalmer Scott Palmer added a comment - This remains an issue with Java 8u45. It applies to JavaFX GUIs as well.
            Hide
            kcr Kevin Rushforth added a comment -
            I created JDK-8132775 to track the equivalent JavaFX issue.
            Show
            kcr Kevin Rushforth added a comment - I created JDK-8132775 to track the equivalent JavaFX issue.
            Hide
            ckyang Chien Yang (Inactive) added a comment -
            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
            Show
            ckyang Chien Yang (Inactive) added a comment - 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
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/0746c20f1365
            User: serb
            Date: 2015-10-21 18:30:45 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/0746c20f1365 User: serb Date: 2015-10-21 18:30:45 +0000
            Show
            ampopov Alexander Popov (Inactive) added a comment - https://bugs.openjdk.java.net/browse/JDK-8132759?focusedCommentId=13857073&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13857073
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/0746c20f1365
            User: lana
            Date: 2015-11-11 22:11:44 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/0746c20f1365 User: lana Date: 2015-11-11 22:11:44 +0000

              People

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

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: