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

[macosx] Java programs switch GPU from integrated to discrete

XMLWordPrintable

    • 2d
    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_131"
      Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
      Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      OS X 10.11.6
      macOS 10.12.4

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Reproducible on both of my laptops with hybrid graphics:

      MacBookPro8,3 (MacBook Pro 17 inch, late 2011) with Intel HD Graphics 3000 (integrated) and AMD Radeon HD 6770M (dedicated).

      MacBookPro11,3 (MacBook Pro 15 inch (Retina), mid-2014) with Intel Iris Pro (integrated) and GeForce GT 750M (dedicated).

      A DESCRIPTION OF THE PROBLEM :
      Any Java application that is launched immediately switches the graphics card from the integrated one to the dedicated/high performance one. This is true for all Java apps that are launched with Oracle's Java 8, but does not happen when they are launched with Apple's Java 6.

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      In version 1.6.0_65, provided by Apple, the graphics card switch does not occur. It keeps working in integrated mode making the laptop run cool and energy efficient.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Open up Activity Monitor (/Applications/Utilities/Activity Monitor.app) and switch to the energy tab. Monitor the "Graphics card" field and make sure it says "Integrated" before continuing (if not, close some graphics heavy apps, or all apps to be completely sure).

      Enter the following command into the terminal:
      $ echo 'public class TestFrame { public static void main(String[] args) { new javax.swing.JFrame().setVisible(true); } }' > TestFrame.java && javac TestFrame.java && java -cp . TestFrame

      Notice the graphics card immediately switching from "Integrated" to "High Perf.". This activates the dedicated graphics card making the laptop run hotter and consume more energy, draining the battery sooner.

      Close the frame and notice the graphics card switching back from "High Perf." to "Integrated".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The Java application starts without switching the graphics card to the high-performance one.
      ACTUAL -
      The Java application switches the graphics card immediately upon launch, even though no GPU intensive work is being done... it's just a plain window with no UI.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class TestFrame {
          public static void main(String[] args) {
              new javax.swing.JFrame().setVisible(true);
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Revert back to Apple's Java 6 (1.6.0_65). No other workaround known so far.

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: