Commit 8fbe85fa authored by Mike Blumenkrantz's avatar Mike Blumenkrantz 🏋 Committed by Adam Jackson
Browse files

egl/glx: add fallback for zink loading



if the driver attemping to load is not zink and not software, then
attempt a zink fallback on failure

this conservatively handles the case of "only zink is built", though it
is going to be noticeably slower at startup than loading zink directly

Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
parent 20a57f8a
Pipeline #603994 waiting for manual action with stages
in 48 minutes and 21 seconds
......@@ -637,12 +637,25 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
* If the initialisation fails, try again using only software rendering.
*/
if (!_eglDriver.Initialize(disp)) {
if (disp->Options.ForceSoftware)
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
else {
bool fail = true;
if (!disp->Options.ForceSoftware && !disp->Options.Zink) {
/* zink fallback */
disp->Options.Zink = EGL_TRUE;
disp->Options.ForceSoftware = EGL_TRUE;
if (!_eglDriver.Initialize(disp))
fail = !_eglDriver.Initialize(disp);
if (fail) {
disp->Options.Zink = EGL_FALSE;
disp->Options.ForceSoftware = EGL_FALSE;
}
}
if (fail) {
if (disp->Options.ForceSoftware)
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
else {
disp->Options.ForceSoftware = EGL_TRUE;
if (!_eglDriver.Initialize(disp))
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
}
}
}
......
......@@ -952,9 +952,12 @@ __glXInitialize(Display * dpy)
#endif /* HAVE_DRI3 */
if (!env_var_as_boolean("LIBGL_DRI2_DISABLE", false))
dpyPriv->dri2Display = dri2CreateDisplay(dpy);
/* zink fallback */
if (!dpyPriv->dri3Display && !dpyPriv->dri2Display)
dpyPriv->driswDisplay = driswCreateDisplay(dpy, true);
}
#endif /* GLX_USE_DRM */
if (glx_direct)
if (glx_direct && !dpyPriv->driswDisplay)
dpyPriv->driswDisplay = driswCreateDisplay(dpy, zink);
#endif /* GLX_DIRECT_RENDERING && !GLX_USE_APPLEGL */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment