egl: add automatic zink fallback loading between hw and sw drivers

if loading the default hardware driver fails, implicitly loading zink
should now be preferable to hitting the software fallback now that zink
has all the same capabilities

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25640>
This commit is contained in:
Mike Blumenkrantz
2023-10-09 15:02:13 -04:00
committed by Marge Bot
parent cedb534a17
commit 8cd44b8843

View File

@@ -695,10 +695,17 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
if (disp->Options.ForceSoftware)
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
else {
disp->Options.Zink = EGL_FALSE;
disp->Options.ForceSoftware = EGL_TRUE;
if (!_eglDriver.Initialize(disp))
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
bool success = disp->Options.Zink;
if (!disp->Options.Zink && !getenv("GALLIUM_DRIVER")) {
disp->Options.Zink = EGL_TRUE;
success = _eglDriver.Initialize(disp);
}
if (!success) {
disp->Options.Zink = EGL_FALSE;
disp->Options.ForceSoftware = EGL_TRUE;
if (!_eglDriver.Initialize(disp))
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
}
}
}