Fix Version/s: tbd
Compatibility Risk Description:Default performance of the java app executed via command line "java" tool, will be lower. The app bundled via JPackage will not be affected.
Switch Java 2D on macOS from using the high performance, high power consumption graphics card to the lower performance, lower power consumption graphics card.
All 15" or 16" Macbook Pros to date have two video cards. An AMD discrete graphics card and the integrated Intel one on the CPU. Since Java has never requested the integrated one, then it causes the discrete one to be initialised. Most other apps, including the bundled ones request the integrated one. This means that when a Java UI app is started the system will draw more power, even if running on battery, since Apple does not provide sufficient control over this situation. This behaviour of defaulting to the discrete card is a consequence of a compatibility decision by Apple. See https://developer.apple.com/library/archive/qa/qa1734/_index.html#//apple_ref/doc/uid/DTS40010791
Add the "NSSupportsAutomaticGraphicsSwitching" key to the Info.plist for the java executable, so applications started that way will use the integrated video card, and will not force the discrete video card.
It is known that Java2D's OpenGL pipelline works fine on the integrated video card, because that is all that is available on various systems (Intel mac mini, 13" MacBook Pro, Air, etc). So we can use the integrated video by default.
This change also improves startup performance, on a 2019 16" MacBook Pro running macOS 11.1 the switching between discrete/integrated causes unexpected delays up to 10 seconds. Although this is not a problem on older releases, so is likely a macOS bug that should be fixed.
The drawback is that Java 2D performance will be lower on the integrated video card and this means lower than it has been in all Oracle JDK's for macOS since the first 7u2 release by Oracle. We intend to release note this and describe workarounds.
As mentioned above Apple does not provide much application control over when the discrete card is used so even with this change it can still be used in some cases. Empirically these include :
- If the app sets/uses a full-screen window - If the user disables "automatic graphics switching" in System Preferences - If an external monitor is connected to the laptop
No change in the specification.