RFR: 8258754: Gracefully fallback to the OpenGL rendering pipeline if Metal rendering pipeline initialization fails [v6]

Ajit Ghaisas aghaisas at openjdk.java.net
Fri Jan 15 11:04:17 UTC 2021


On Thu, 14 Jan 2021 18:09:12 GMT, Phil Race <prr at openjdk.org> wrote:

>> Ajit Ghaisas has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review comments
>
> src/java.desktop/macosx/classes/sun/java2d/macos/MacOSFlags.java line 94:
> 
>> 92:                     PropertyState oglState = getBooleanProp("sun.java2d.opengl", PropertyState.UNSPECIFIED);
>> 93:                     PropertyState metalState = getBooleanProp("sun.java2d.metal", PropertyState.UNSPECIFIED);
>> 94: 
> 
> Right here we could add
>                     if (metalState == PropertyState.UNSPECIFIED && oglState == PropertyState.UNSPECIFIED) {
>                         // change this line to set metalState to toggle the default pipeline.
>                         oglState = PropertyState.ENABLED;
>                     }
> This makes it easier to set the default

Good suggestion.
We need to handle other invalid combinations here as well - I will update the code.

> src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m line 85:
> 
>> 83:     bool metalSupported = JNI_FALSE;
>> 84:     while (getc(f) != EOF)
>> 85:     {
> 
> This strikes me as a slow way to find if metal is supported and I am not sure it is what I would call a "supported interface" either. Isn't there a better, more robust, faster way ?
> Even if we don't change it today, we should file a bug on this to remember.

As of now, there is no known Metal API to do it in a better way. I have created JDK-8259825 to address it later.

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

PR: https://git.openjdk.java.net/lanai/pull/147


More information about the lanai-dev mailing list