Hello.
Please review the fix for jdk 9. This a second iteration of the fix for 8041129, because it was changed to cover 8017626 as well.

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

--
Best regards, Sergey.

Reply via email to