On Thu, 23 Apr 2026 19:02:29 GMT, Thorsten Fischer <[email protected]> wrote:

> Hi all,
> this is the topic I opened on the mailing list for this ticket: 
> https://mail.openjdk.org/archives/list/[email protected]/thread/XJB272UTZSNRYTQTHSALXYY4VO23DCIU/
> 
> Additional notes to the problem:
> - The error happend with a dated driver, but updating it to a recent version 
> did not fix the problem.
> - I could not reproduce the problem with a similar notebook with the same 
> old(!) driver, but newer GPU revision.
> - I can verify that the fix below seems to fix the problem: the application 
> runs now for 5 days straight, which did never happen before with that 
> machine. The application runs on the FX 17, so my 'long term test' is with 
> that branch.
> 
> Notes to the patch:
> - This patch reduces the GL calls between frames.
> - During normal rendering, currentDrawable is now null between present() and 
> createGraphics() (which sets it back to a real drawable), but it is then 
> never read. Outside that window, the only reader is clearContext() on the 
> shutdown path, which already has a null guard. currentDrawable is only 
> written in invalidateCurrentDrawable() and makeCurrent(), and only read in 
> makeCurrent() and clearContext().
> - On the shutdown path (clearContext), dummy.swapBuffers() would no longer be 
> called, which I believe is fine.
> - ES2SwapChain.dispose() on master calls drawable.dispose(), which requires 
> the drawable to be non-current. Since present() no longer parks the context 
> on the dummy, that step moves into the dispose path: 
> context.makeCurrent(null) before drawable.dispose().
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Code change invalidates only the Java level current drawable after swap. I see 
no harm in doing this and i see that it maintains the current drawable state 
properly.

Also i don't see need for similar change in other pipelines like Metal/D3D, as 
we manage things differently on other pipelines.

I tested Ensemble8 with this change using ES2 pipeline on my M1 Mac. Played 
around with animating demos in multi monitor setup and i didn't observe any 
issue.

LGTM.

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

Marked as reviewed by jdv (Committer).

PR Review: https://git.openjdk.org/jfx/pull/2159#pullrequestreview-4335357623

Reply via email to