RFR: 8238954: Improve performance of tiled snapshot rendering [v5]

Kevin Rushforth kcr at openjdk.java.net
Mon Jun 29 21:06:37 UTC 2020


On Mon, 29 Jun 2020 16:41:53 GMT, Frederic Thevenet <github.com+7450507+fthevenet at openjdk.org> wrote:

>> I have changed the test setup to fill up the scene with a gradient instead of random noise; it should be as able to
>> catch misalignment, while not looking like something's gone horribly wrong.
>
> Also, while running the tests again on a ubuntu 20.04 VM, I encountered 2 occurences where one of the tests failed, out
> of ~8 runs in total. In one case, the error where similar to yours:
>> Task :systemTests:test
> 
> test.javafx.scene.Snapshot2Test > testSnapshot2x2TilesSameSizeImm[3] FAILED
>     java.lang.IllegalArgumentException: Unrecognized image loader: null
>         at javafx.graphics/javafx.scene.image.WritableImage.loadTkImage(WritableImage.java:278)
>         at javafx.graphics/javafx.scene.image.WritableImage$1.loadTkImage(WritableImage.java:53)
>         at javafx.graphics/javafx.scene.Scene.doSnapshot(Scene.java:1342)
>         at javafx.graphics/javafx.scene.Node.doSnapshot(Node.java:2136)
>         at javafx.graphics/javafx.scene.Node.snapshot(Node.java:2214)
>         at test.javafx.scene.Snapshot2Test.lambda$doTestTiledSnapshotImm$12(Snapshot2Test.java:375)
> 
> 148 tests completed, 1 failed
> While in the other, it pointed to an Out Of Memory Error:
> 
>  Task :systemTests:test
> 
> test.javafx.scene.Snapshot2Test > testSnapshot2x2TilesSameHeightDefer[3] FAILED
>     java.lang.OutOfMemoryError: Java heap space
>         at java.base/java.nio.HeapByteBuffer.<init>(HeapByteBuffer.java:63)
>         at java.base/java.nio.ByteBuffer.allocate(ByteBuffer.java:351)
>         at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.createPlatformImage(QuantumToolkit.java:1426)
>         at javafx.graphics/javafx.scene.image.Image.<init>(Image.java:740)
>         at javafx.graphics/javafx.scene.image.WritableImage.<init>(WritableImage.java:77)
>         at test.javafx.scene.Snapshot2Test.doTestTiledSnapshotDefer(Snapshot2Test.java:377)
>         at test.javafx.scene.Snapshot2Test.testSnapshot2x2TilesSameHeightDefer(Snapshot2Test.java:489)
> 
> 148 tests completed, 1 failed
> 
> Again, in my environment, it only failed one test, and not all the time, but this could be the same root cause. Two
> ways we could find out would be by either increasing the max heap size for the test runner or use a smaller image and
> force the prism.maxTextureSize property to something less than 4096 to trigger tiling anyway. Unfortunately, I could
> not find out how to achieve either of these (simply passing the properties to the JVM running the Gradle wrapper seem
> to have no effect).

It runs fine for me on Ubuntu 20.04 (VM) and Windows 10.

I also see the failures on macOS. This isn't related to heap size. The failures are consistent, and hit virtually all
of the tests whose dimensions are larger than 4096. Also, I modified the test to `@Ignore` all but one of the failing
tests, and that test still fails.

I instrumented the code, and from one of the failing tests I see this:

    renderToImage: need to tile image, size = 18000 x 90
    renderTile: 4096 x 90
    renderTile: 4096 x 90
    renderTile: 4096 x 90
    renderTile: 4096 x 90
    renderTile: 1616 x 90
    renderTile: 4096 x 0

This last tile is an illegal tile size (so you're probably just getting lucky that it isn't causing problems on Windows
or Linux). I would check the tiling logic.

-------------

PR: https://git.openjdk.java.net/jfx/pull/112


More information about the openjfx-dev mailing list