RFR: 8238954: Improve performance of tiled snapshot rendering [v5]
Frederic Thevenet
github.com+7450507+fthevenet at openjdk.java.net
Mon Jun 29 16:44:09 UTC 2020
On Mon, 29 Jun 2020 16:16:58 GMT, Frederic Thevenet <github.com+7450507+fthevenet at openjdk.org> wrote:
>> Thanks for your review.
>>
>> I don't have access to a Mac so I can't check that directly.
>> The tests pass on both my Windows 10 and Ubuntu 20.04 environments and the stack isn't very helpful (it simply
>> indicates the renderImage method returned null).
>> Running the test with the unpatched version of the `QuantumToolkit::renderToImage` method would typically result in
>> such a stack, but there are many other possible reasons.
>> With regard to the choice of random noise for the test image, my idea was to be able to catch any misalignment caused
>> by tiling in the final snapshot: using a single color or a simple pattern would not necessarily help catching such
>> errors. Using a complex image could do the trick, and avoid the broken aspect you mentioned, but it would need to be
>> very large (>4096x4096), and I was not sure it would be wise to add such a large binary resource to the repo. So I
>> settled for random noise, since it was the simplest way to generate an image which guaranties any misalignment would be
>> caught by comparing pixels 1 to 1.
>
> 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).
-------------
PR: https://git.openjdk.java.net/jfx/pull/112
More information about the openjfx-dev
mailing list