JDK-8041129 : [OGL] surface->sw blit is extremely slow
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u4,8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-04-18
  • Updated: 2015-08-03
  • Resolved: 2014-06-04
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
8u20Fixed 9 b22Fixed
Related Reports
Duplicate :  
Description
The problem is in the j2d_glReadPixels() in OGLBlitLoop.c:

            // we must read one scanline at a time because there is no way
            // to read starting at the top-left corner of the source region
            while (height > 0) {
                j2d_glPixelStorei(GL_PACK_SKIP_ROWS, dsty);
                j2d_glReadPixels(srcx, srcy, width, 1,
                                 pf.format, pf.type, pDst);
                srcy--;
                dsty++;
                height--;
            }
Comments
Description of the problem: 8041129: [OGL] surface->sw blit is extremely slow - The problem is in the glReadPixels(), which is really slow and we call it very often for each image to make a flip. Solution: - We call glReadPixels() only once and then flip is done using memcpy after the whole image was moved from gpu to the memory. - glPixelStorei were added/removed when necessary. - Note: actually on my mac the slow path and the fast path(memcpy) works in the same time. I left it as is, because on other system it can be faster. 8017626: [OGL] Translucent VolatileImages don't paint correctly - The problem is in OGLSurfaceToSwBlit. It was implemented with assumption that the source(ogl) surface contain argb color format, this is wrong because it use premultiplied alpha. Solution: - The new ogl blit was added to cover the old behavior OGLSurfaceToSwBlit(SurfaceType.IntArgbPre,OGLSurfaceData.PF_INT_ARGB_PRE), - The blit was changed to properly restore the color components if the source is transparent and destination does not use premultiplied alpha. Bugs: https://bugs.openjdk.java.net/browse/JDK-8041129 https://bugs.openjdk.java.net/browse/JDK-8017626 Webrev can be found at: http://cr.openjdk.java.net/~serb/8041129/webrev.10 Benchmarks: Note that each benchmark was executed 3 times(25 seconds each) to be protected from such spread: D3D-base-nvidia-windows: 61796.32109 (var=308.77%) (5857.64%) |************* |********************************************************* |************************************************** So check the full report for additional information, since the spread for most of the test is small. ========================================================== Windows 7 x64, lenovo T410, nvidia NVS 3100M http://cr.openjdk.java.net/~serb/8041129/webrev.10/benchmarks/results_win.txt Summary: OGL-base-nvidia-windows: Number of tests: 40 Overall average: 1538.6158105111376 Best spread: 0.26% variance Worst spread: 51.66% variance (Basis for results comparison) D3D-base-nvidia-windows: Number of tests: 40 Overall average: 25477.2292224911 Best spread: 0.03% variance Worst spread: 308.77% variance Comparison to basis: Best result: 11192.65% of basis Worst result: 9.13% of basis Number of wins: 28 Number of ties: 0 Number of losses: 12 OGL-fix-nvidia-windows: Number of tests: 40 Overall average: 125053.84134106003 Best spread: 0.08% variance Worst spread: 11.96% variance Comparison to basis: Best result: 12631.78% of basis Worst result: 84.45% of basis Number of wins: 33 Number of ties: 6 Number of losses: 1 ========================================================== OSX 10.8.5, macbook pro retina, nvidia GeForce GT 650M 1024 MB http://cr.openjdk.java.net/~serb/8041129/webrev.10/benchmarks/results_osx_nvidia.txt Summary: OGL-base-nvidia-osx: Number of tests: 20 Overall average: 714.8688065382015 Best spread: 0.16% variance Worst spread: 2.12% variance (Basis for results comparison) OGL-fix-nvidia-osx: Number of tests: 20 Overall average: 10497.046970040716 Best spread: 0.11% variance Worst spread: 5.55% variance Comparison to basis: Best result: 4479.08% of basis Worst result: 172.49% of basis Number of wins: 20 Number of ties: 0 Number of losses: 0 ========================================================== OSX 10.8.5, macbook pro retina, Intel HD Graphics 4000 http://cr.openjdk.java.net/~serb/8041129/webrev.10/benchmarks/results_osx_intel.txt Summary: OGL-base-intel-osx: Number of tests: 20 Overall average: 3912.1181498636274 Best spread: 0.25% variance Worst spread: 22.52% variance (Basis for results comparison) OGL-fix-intel-osx: Number of tests: 20 Overall average: 9647.033915964947 Best spread: 0.2% variance Worst spread: 23.32% variance Comparison to basis: Best result: 457.06% of basis Worst result: 104.3% of basis Number of wins: 20 Number of ties: 0 Number of losses: 0
04-06-2014

The problem became obvious on osx + retina
18-04-2014