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

[macosx] Performance problems with Retina display on Mac OS X

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 7u40, 8, 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Environment:
    • Subcomponent:
    • Resolved In Build:
      b38
    • OS:
      os_x

      Backports

        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

          Issue Links

            Activity

            Hide
            vdyakov Victor Dyakov added a comment -
            is it affecting jdk8 as well?
            Where it was introduced, which release?
            Show
            vdyakov Victor Dyakov added a comment - is it affecting jdk8 as well? Where it was introduced, which release?
            Hide
            serb Sergey Bylokhov added a comment -
            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.
            Show
            serb Sergey Bylokhov added a comment - 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.
            Hide
            saubrech Stanislav Aubrecht added a comment -
            This is not NetBeans only bug! Please read my bug description.
            Show
            saubrech Stanislav Aubrecht added a comment - This is not NetBeans only bug! Please read my bug description.
            Hide
            vdyakov Victor Dyakov added a comment -
            Profiler snapshot is needed.
            Show
            vdyakov Victor Dyakov added a comment - Profiler snapshot is needed.
            Hide
            saubrech Stanislav Aubrecht added a comment -
            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.
            Show
            saubrech Stanislav Aubrecht added a comment - 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.
            Hide
            serb Sergey Bylokhov added a comment -
            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.
            Show
            serb Sergey Bylokhov added a comment - 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.
            Hide
            saubrech Stanislav Aubrecht added a comment -
            I have asked the NetBeans bug submitters for profiler snapshots.
            Show
            saubrech Stanislav Aubrecht added a comment - I have asked the NetBeans bug submitters for profiler snapshots.
            Hide
            vdyakov Victor Dyakov added a comment -
            we are on rampdown stage and any bug needs to be consistent in open state unless incomplete,
            please reopen within requested data
            Show
            vdyakov Victor Dyakov added a comment - we are on rampdown stage and any bug needs to be consistent in open state unless incomplete, please reopen within requested data
            Hide
            saubrech Stanislav Aubrecht added a comment -
            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
            Show
            saubrech Stanislav Aubrecht added a comment - 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
            Hide
            vdyakov Victor Dyakov added a comment -
            please re-evaluate it
            Show
            vdyakov Victor Dyakov added a comment - please re-evaluate it
            Hide
            serb Sergey Bylokhov added a comment -
            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.
            Show
            serb Sergey Bylokhov added a comment - 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.
            Hide
            maxelsso Mathias Axelsson (Inactive) added a comment -
            Release team: Approved for deferral.
            Show
            maxelsso Mathias Axelsson (Inactive) added a comment - Release team: Approved for deferral.
            Hide
            serb Sergey Bylokhov added a comment -
            The problem is in the glDrawPixels(). It is extremely slow in case of intel integrated video graphics. This issue became obvious on osx + retina
            Show
            serb Sergey Bylokhov added a comment - The problem is in the glDrawPixels(). It is extremely slow in case of intel integrated video graphics. This issue became obvious on osx + retina
            Hide
            anebuzel Antonín Nebuželský added a comment -
            Any chance for the fix in 8u20?
            Show
            anebuzel Antonín Nebuželský added a comment - Any chance for the fix in 8u20?
            Hide
            serb Sergey Bylokhov added a comment -
            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.
            Show
            serb Sergey Bylokhov added a comment - 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.
            Show
            serb Sergey Bylokhov added a comment - http://mail.openjdk.java.net/pipermail/2d-dev/2014-June/004642.html
            Hide
            anebuzel Antonín Nebuželský added a comment -
            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?
            Show
            anebuzel Antonín Nebuželský added a comment - 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?
            Hide
            serb Sergey Bylokhov added a comment -
            The fix was not ready in time of 8u20, it is still under review. Current plan is to fix it in 8u40.
            Show
            serb Sergey Bylokhov added a comment - The fix was not ready in time of 8u20, it is still under review. Current plan is to fix it in 8u40.
            Hide
            anebuzel Antonín Nebuželský added a comment -
            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.
            Show
            anebuzel Antonín Nebuželský added a comment - 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.
            Hide
            serb Sergey Bylokhov added a comment -
            The bug still not fixed in jdk9 as well.
            Show
            serb Sergey Bylokhov added a comment - The bug still not fixed in jdk9 as well.
            Hide
            serb Sergey Bylokhov added a comment -
            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.
            Show
            serb Sergey Bylokhov added a comment - 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.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/f8498246a197
            User: serb
            Date: 2014-10-08 13:47:19 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/client/jdk/rev/f8498246a197 User: serb Date: 2014-10-08 13:47:19 +0000
            Hide
            serb Sergey Bylokhov added a comment -
            Workaround: use BufferedImage.TYPE_INT_ARGB_PRE images for maximum performance.
            Show
            serb Sergey Bylokhov added a comment - Workaround: use BufferedImage.TYPE_INT_ARGB_PRE images for maximum performance.
            Hide
            serb Sergey Bylokhov added a comment -
            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
            Show
            serb Sergey Bylokhov added a comment - 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
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/f8498246a197
            User: lana
            Date: 2014-11-05 19:35:24 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/f8498246a197 User: lana Date: 2014-11-05 19:35:24 +0000
            Hide
            vdyakov Victor Dyakov added a comment -
            Sergey, do we need to back port it to 7u80(Sust)?
            Show
            vdyakov Victor Dyakov added a comment - Sergey, do we need to back port it to 7u80(Sust)?
            Hide
            serb Sergey Bylokhov added a comment -
            Currently I have no plan to backport it to jdk7 until I'll complete everything for jdk8.
            Show
            serb Sergey Bylokhov added a comment - Currently I have no plan to backport it to jdk7 until I'll complete everything for jdk8.
            Hide
            vdyakov Victor Dyakov added a comment -
            Back ported to 8u40.
            Show
            vdyakov Victor Dyakov added a comment - Back ported to 8u40.

              People

              • Assignee:
                serb Sergey Bylokhov
                Reporter:
                saubrech Stanislav Aubrecht
              • Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: