[Rev 03] RFR: 8088198: Exception thrown from snapshot if dimensions are larger than max texture size
Kevin Rushforth
kcr at openjdk.java.net
Mon Jan 27 15:30:36 UTC 2020
On Mon, 27 Jan 2020 13:47:43 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>>>
>>>
>>> > profiling a run of the benchmark shows that a lot of time is spent into `IntTo4ByteSameConverter::doConvert`
>>>
>>> This is a bit naive, but what if you parallelize the code there? I didn't test that this produces the correct result, but you can try to replace the loops with this:
>>>
>>> ```
>>> IntStream.range(0, h).parallel().forEach(y -> {
>>> IntStream.range(0, w).parallel().forEach(x -> {
>>> int pixel = srcarr[srcoff++];
>>> dstarr[dstoff++] = (byte) (pixel );
>>> dstarr[dstoff++] = (byte) (pixel >> 8);
>>> dstarr[dstoff++] = (byte) (pixel >> 16);
>>> dstarr[dstoff++] = (byte) (pixel >> 24);
>>> });
>>> srcoff += srcscanints;
>>> dstoff += dstscanbytes;
>>> });
>>> ```
>>
>> I don't think this works as it is, as all threads race to increment `srcoff` and `dstoff`.
>
> I would be very cautious of using multi-threading here. In any case, I think that the issues around absolute performance could be handled separately.
>
> Having said that, given my review comments, along with the concerns over performance regressions for those cases that will now be tiled, but formerly weren't, I no longer think this is a good candidate for openjfx14. This PR should be retargeted to the `master` branch for openjfx15.
I thought of one possibility that might be worth looking into for a short term fix (i.e., could still go into openjfx14). Rather than relying on `PrismSettings.maxTextureSize` you could instead try to render the entire image (as is done today) in a try / catch block, and only fall back to tiling if there is an exception. That way there would be no concern over any possible performance regression, since the only time we would use tiling would be in the case where it fials today.
What do you think?
-------------
PR: https://git.openjdk.java.net/jfx/pull/68
More information about the openjfx-dev
mailing list