JDK-8029253 : [macosx] Performance problems with Retina display on Mac OS X
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7u40,8,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-11-27
  • Updated: 2015-06-04
  • Resolved: 2014-10-08
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
8u40Fixed 9 b38Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Text editing and scrolling in Java Swing applications is slow when running on Mac OS X with a Retina display. To reproduce create a JFrame with a JTextPane and past some large text into the pane. Then start editing the text to force scrolling in the text pane. It will be slow and CPU usage for that process will go over 100%.
The same application running on external display connected to the same machine is much faster with CPU usage never going over 50%.
It is reproducible with JDK 8 build 117 as well. Adjusting resolution scaling in OS X System Preferences makes no difference. The problem is even more severe on MacBook Air computer - probably because their CPUs are less powerful.

See also https://netbeans.org/bugzilla/show_bug.cgi?id=237724
Comments
Back ported to 8u40.
08-12-2014

Currently I have no plan to backport it to jdk7 until I'll complete everything for jdk8.
18-11-2014

Sergey, do we need to back port it to 7u80(Sust)?
13-11-2014

j2dbench options file: http://cr.openjdk.java.net/~serb/8029253/drawimage Summary osx-retina Intel HD Graphics 4000 : http://cr.openjdk.java.net/~serb/8029253/perf.04/osx-retina-intel/results.txt base: Number of tests: 24 Overall average: 92015.36146212014 Best spread: 0.0% variance Worst spread: 0.0% variance (Basis for results comparison) fix: Number of tests: 24 Overall average: 616682.7498394073 Best spread: 0.0% variance Worst spread: 0.0% variance Comparison to basis: * Best result: 4899860.24% of basis* Worst result: 100.48% of basis Number of wins: 22 Number of ties: 2 Number of losses: 0 Summary osx-retina Nvidia GeForce GT 650M 1024 MB : http://cr.openjdk.java.net/~serb/8029253/perf.04/osx-retina-nvidia/results.txt base: Number of tests: 24 Overall average: 147138.4952051871 Best spread: 0.0% variance Worst spread: 0.0% variance (Basis for results comparison) fix: Number of tests: 24 Overall average: 634465.9854992364 Best spread: 0.0% variance Worst spread: 0.0% variance Comparison to basis: Best result: 42311.89% of basis Worst result: 77.93% of basis Number of wins: 16 Number of ties: 7 Number of losses: 1
08-10-2014

Workaround: use BufferedImage.TYPE_INT_ARGB_PRE images for maximum performance.
08-10-2014

This is indirect regression of JDK-4834832. In those fix some special blits were removed: OGLSwToSurfaceScale(SurfaceType.IntArgb, OGLSurfaceData.PF_INT_ARGB) OGLSwToSurfaceTransform(SurfaceType.IntArgb, OGLSurfaceData.PF_INT_ARGB) It was assumed that those blits should be replaced by the general blit, but for some reason it does not happen and we use TransformHelper.
01-10-2014

The bug still not fixed in jdk9 as well.
18-09-2014

Could you put a note here with the JDK 9 build including the fix, when available? I will ask NetBeans users to try the fix.
12-09-2014

The fix was not ready in time of 8u20, it is still under review. Current plan is to fix it in 8u40.
12-09-2014

Sergey, did your improvements get into 8u20? NetBeans users continue complaining about scrolling speed, so I am wondering if they should expect that 8u20 is supposed to have the improvement, or if the improvement is planned for a next 8uX update? And is the improvement in JDK 9?
12-09-2014

http://mail.openjdk.java.net/pipermail/2d-dev/2014-June/004642.html
11-06-2014

I'll improve speedup of the scrolling in 8u20 on retina + intel. But I am not sure that I'll fix the freezes, since I cannot reproduce them.
30-05-2014

Any chance for the fix in 8u20?
26-05-2014

The problem is in the glDrawPixels(). It is extremely slow in case of intel integrated video graphics. This issue became obvious on osx + retina
18-04-2014

Release team: Approved for deferral.
06-12-2013

please re-evaluate it
28-11-2013

Profiler snapshot on Retina display: https://netbeans.org/bugzilla/attachment.cgi?id=142655 Profiler snapshot from the same machine on external display: https://netbeans.org/bugzilla/attachment.cgi?id=142656
28-11-2013

There is difference under retina: OGLRenderQueueprivate native void flushBuffer(long buf, int limit); 23ms vs 3ms This method executes rendering of opengl and wasn't changed long time.
28-11-2013

we are on rampdown stage and any bug needs to be consistent in open state unless incomplete, please reopen within requested data
27-11-2013

I have asked the NetBeans bug submitters for profiler snapshots.
27-11-2013

I tested netbeans on macbook pro mid 2008(quartz debug) and ealy 2013(pure retina). Scrolling is good and smooth. cpu usage increasing is expected, because application draw 4 times more information. I cannot reproduce the freezes. At least netbeans snapshot from the problem systems is required, to figure out what is going wrong. Seems it could be related to the intel&opengl.
27-11-2013

Just use the steps I provided to reproduce the problem in a plain Swing app and generate your profiler snapshot yourself. Let me know if you don't have access to a Retina machine.
27-11-2013

Profiler snapshot is needed.
27-11-2013

This is not NetBeans only bug! Please read my bug description.
27-11-2013

I downgrade the priority, because initial submitter say that the problem is reproduced in Netbeans only. Problem was not reproduced in other java applications(SwingSet for example). Profiler snapshot is needed.
27-11-2013

is it affecting jdk8 as well? Where it was introduced, which release?
27-11-2013