RFR: 8352209: NPE com.sun.prism.d3d.D3DTextureData.getContext [v3]
Alessadro Parisi
duke at openjdk.org
Mon Nov 3 13:38:23 UTC 2025
On Thu, 30 Oct 2025 14:08:38 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:
>> This PR fixes NPE thrown when trying to update D3D texture in some rare scenarios.
>>
>> On more stressful cases (like the one using Canvas attached to this issue) it is possible that a D3DTexture.update() call will go through after the Resource Pool already pruned the underlying Texture's resource. This in turn caused an NPE, which propagated to higher levels and disrupted the rendering loop, causing the Canvas to not be drawn anymore. The update() call seems not to be called more than once on an already freed resource, suggesting this is some sort of rare race between the pool and the drawing code.
>>
>> This change prevents the NPE from being thrown. I noticed no visual problems with the test even when the update() call is rejected by the newly added check. Best way to verify it is to add a log call inside added `if (!resource.isValid())` blocks when running the test, it will occasionally get printed but the test itself won't change its behavior like it does without this change.
>
> Lukasz Kostyra has updated the pull request incrementally with one additional commit since the last revision:
>
> BaseContext: Add maskTex checks to flushMask()
I have an app that performs a lot of rendering. It creates and needs to store many Canvas objects. I’ve noticed that when the maximum allowed VRAM is exhausted, the app becomes unresponsive and starts throwing multiple NullPointerExceptions.
Does this PR solve the issue?
I also have a couple more questions:
- Is there any way to prevent VRAM saturation? The plan would be to switch to ImageViews once VRAM is full, since they seem to use system RAM instead.
- I read that it’s possible to control the amount of VRAM through the `prism.maxvram` system property. What happens if I set a value much larger than the available VRAM? Does it automatically fall back to system RAM on both iGPUs and dGPUs?
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1951#issuecomment-3480564794
More information about the openjfx-dev
mailing list