RFR: 8258754: Gracefully fallback to the OpenGL rendering pipeline if Metal rendering pipeline initialization fails [v5]
prr at openjdk.java.net
Fri Jan 8 21:09:09 UTC 2021
On Fri, 8 Jan 2021 20:57:08 GMT, Phil Race <prr at openjdk.org> wrote:
>> The logic looks correct to me (I didn't run it). I did leave one question about whether we want to initialize both pipelines in the typical case where we don't need a fallback.
>> Yes, I think this is what we what.
>> > Note that - I have not considered the order of VM options. If needed, that should be handled separately later.
>> I don't think this is possible (even if it were desired).
> I am sure it is not.
> I think what we can do, which is really all we can do, is be consistent in the order in which we consider the pipelines.
> I think the code we write here for mac ought to be written in a way that when we flip
> the switch to make metal peferred / default that we don't have a lot of code to move around.
> In as few words as possible :
> The default pipeline will be used so long as it is supported, and in the absence of any other
> unambiguous request for another supported pipeline.
> It is expected that some pipeline is available, so long as the windowing system is running and reachable.
> In such an unlikely event no pipeline is supported an InternalError will be thrown.
> unambiguous means that with opengl as default
> - if you ask for both, we first try opengl.
> - if you disable both, we first try opengl
> - if you ask for neither, we first try opengl
> - if you don't enable some other pipeline, we first try opengl
> when we flip the switch to metal as default then :
> - if you ask for both, we first try metal.
> - if you disable both, we first try metal
> - if you ask for neither, we first try metal
> - if you don't enable some other pipeline, we first try metal
this implies that -Dsun.java2d.opengl=false on its own means the same as -Dsun.java2d.metal=true.
This is a bit grayer. It would imply that there is a designated fall back.
I take that back - it isn't grey. Because the default for metal is false, it means you've disabled both so rule 1 applies
I'll add another rule up above to make it clearer.
But .. we have a sort of precedent on windows that d3d=false means fall back to gdi. So that contradicts the above :-(
So is metal a "fallback" or an "option" ? We don't fall back to optional pipelines. Meaning d3d=false would not cause opengl to be used on windows.
More information about the lanai-dev