From 995dc61bf55db37e2c2bd10897829ff98d2ac63d Mon Sep 17 00:00:00 2001 From: GKraats Date: Tue, 15 Apr 2025 17:23:36 +0200 Subject: [PATCH] EGL: legacy-x11=dri2 should support hardware driver Since MR !33891 EGL only supports a software driver (LLVM). Routine dri3_x11_connect at src/egl/drivers/dri2/platform_x11.c fails if DRI3 is not available. So at that location variable *allow_dri2 should be set. Looking at the major codition, we see it is not executed if LIBGL_DRI3_DISABLE is set. In that case the hardware driver is activated as desired. Previously this was not needed. Also it is not practical, and not necessary. I do not understand the major condition, so I did not change it. This causes some duplicate coding. Fixes: 323bad6b187 ("egl/x11: split out dri2 init entirely") Signed-off-by: GKraats Acked-by: Mike Blumenkrantz Part-of: --- src/egl/drivers/dri2/platform_x11.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index 48f14f29938..14335e0b504 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1989,8 +1989,15 @@ dri2_initialize_x11(_EGLDisplay *disp, bool *allow_dri2) /* the status here is ignored for zink-with-kopper and swrast, * otherwise return whatever error/fallback status as failure */ - if (!dri2_dpy->kopper && !disp->Options.ForceSoftware && !status) - return EGL_FALSE; + if (!dri2_dpy->kopper && !disp->Options.ForceSoftware) { +#ifdef HAVE_X11_DRI2 + *allow_dri2 = !debug_get_bool_option("LIBGL_DRI2_DISABLE", false); +#else + *allow_dri2 = false; +#endif + if (!status) + return EGL_FALSE; + } } #endif if (!dri2_load_driver(disp))