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

Phil Race prr at openjdk.java.net
Thu Jan 14 18:12:17 UTC 2021


On Mon, 11 Jan 2021 09:50:22 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

>> This implements fallback to the OpenGL rendering pipeline if Metal rendering pipeline initialization fails.
>> I have tested this fallback on 10.15.4 by stubbing code. We need real testing on a system where Metal is not available.
>
> Ajit Ghaisas has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address review comments

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.

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

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

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


More information about the lanai-dev mailing list