<AWT Dev> RFR: 8263363: Minor cleanup of Lanai code - unused code removal and comments correction [v3]

Sergey Bylokhov serb at openjdk.java.net
Fri Apr 9 07:25:18 UTC 2021


On Thu, 8 Apr 2021 10:39:38 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

>> src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java line 149:
>> 
>>> 147:         try {
>>> 148:             // getMTLConfigInfo() creates new MTLContext, so we should first
>>> 149:             // invalidate the current Java-level context and flush the queue...
>> 
>> The old discussion was related not only to the comment but to the invalidateCurrentContext, do we need to do it?
>
> This is the only place where we use MTLContext.invalidateCurrentContext() - which when processed in MTLRenderQueue - clears some native stuff and nulls out both mtlc and dstOps pointers maintained in MTLRenderQueue.m. I think, this will be important once we get rid of SET_SCRATCH_SURFACE under JDK-8263309.

But why you need to invalidate context here? Why do you need "clears some native stuff and nulls out both mtlc and dstOps pointers maintained in MTLRenderQueue.m"?

In OGL the getCGLConfigInfo() change the state of the OGL state due to "makeCurrentContext", this is why we need to update the lava level state to "invalid", otherwise we will get a mismatch between the state in the native and java state.

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

PR: https://git.openjdk.java.net/jdk/pull/3357


More information about the awt-dev mailing list