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

Ajit Ghaisas aghaisas at openjdk.java.net
Fri Jan 8 19:13:20 UTC 2021


On Fri, 8 Jan 2021 13:24:55 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> My 2 cents. Me and Ajit discussed this internally adding this info in PR also.
>> 
>> 1) No options - Use OpenGL(Switch to Metal later when we want to make it default)
>> 2) opengl == true || metal == false - Use OpenGL
>> 3) metal initialization fails print log in verbose- Use OpenGL
>> 4) metal == true || opengl == false - Use Metal
>> 5) opengl initialization fails print log in verbose(In initial release when OpenGL is default, i am not 100% sure whether we should try Metal pipeline or just exit) - Use Metal / exit
>> 6) Both fails print log and exit
>> 
>> All these things can be handled in this PR or future changes.
>
>> 1. No options - Use OpenGL(Switch to Metal later when we want to make it default)
>> 
>> 2. opengl == true || metal == false - Use OpenGL
>> 
>> 3. metal initialization fails print log in verbose- Use OpenGL
>> 
>> 4. metal == true || opengl == false - Use Metal
>> 
>> 5. opengl initialization fails print log in verbose(In initial release when OpenGL is default, i am not 100% sure whether we should try Metal pipeline or just exit) - Use Metal / exit
>> 
>> 6. Both fails print log and exit
> 
> Unless I am misreading what you wrote, I think you have 3 and 5 switched. I would write it a bit differently in any case.
> 
> * No options - use the default pipeline (OpenGL today, Metal later), fallback to the other pipeline (Metal today, OpenGL later) if the default pipeline init fails
> 
> This is the most important case, since it is what end users will typically see (i.e., setting sun.java2d.metal is a developer option that wouldn't typically be set in production). In the absence of any flags we must fallback to the non-default pipeline if initializing the default pipeline fails.
> 
> * opengl == true - Use OpenGL, fallback to metal if OpenGL init fails
> 
> * metal == true - Use Metal, fallback to OpenGL if Metal init fails
> 
> * In all cases above, if both pipelines fail to initialize, then log error and throw an exception (a library should never call exit).
> 
> Btw, if both are set (once an "OpenGL" flag is added for the Mac), the precedence would be decided by whichever you check first -- probably metal, but it really doesn't matter as long as it is clearly spelled out.

> 
> Maybe we can make this check version specific (maybe 10.12 for now) so
> that in future version when opengl is removed, then this check will be
> noop and if Metal fails, then it will quit.
> 
> Regards
> Prasanta

It is better to avoid version specific check when we can cover all the combinations discussed in other comments. My last commit addresses it.

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

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


More information about the lanai-dev mailing list