egl/x11: Allow the loader to choose zink

If the loader tells us to use zink, we use zink.  This breaks the
Nouveau heuristic where we use Zink instead of the Nouveau GL driver on
Turing and later.  The only reason why it works at all is because we
fail to load what the loader requests and then EGL goes "Oops. No
driver! Let's see if Zink works" and we pick it up on the fallback.  We
shouldn't depend on those fallbacks if the loader explicitly says to use
Zink for some bit of hardware.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36014>
This commit is contained in:
Faith Ekstrand
2025-07-04 17:14:53 -04:00
committed by Marge Bot
parent 540169766d
commit 9f097f36b0
3 changed files with 3 additions and 9 deletions

View File

@@ -1305,7 +1305,7 @@ dri2_initialize_x11(_EGLDisplay *disp)
* We're going to enable Zink anyway.
*/
if (!force_zink) {
bool status = dri3_x11_connect(dri2_dpy, disp->Options.Zink, disp->Options.ForceSoftware);
bool status = dri3_x11_connect(dri2_dpy, disp->Options.ForceSoftware);
/* the status here is ignored for zink-with-kopper and swrast,
* otherwise return whatever error/fallback status as failure
*/

View File

@@ -522,7 +522,7 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
};
bool
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool zink, bool swrast)
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool swrast)
{
dri2_dpy->fd_render_gpu =
x11_dri3_open(dri2_dpy->conn, dri2_dpy->screen->root, 0);
@@ -544,12 +544,6 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool zink, bool swrast)
if (!dri2_dpy->driver_name)
dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd_render_gpu);
if (!zink && !strcmp(dri2_dpy->driver_name, "zink")) {
close(dri2_dpy->fd_render_gpu);
dri2_dpy->fd_render_gpu = -1;
return false;
}
if (!dri2_dpy->driver_name) {
_eglLog(_EGL_WARNING, "DRI3: No driver found");
close(dri2_dpy->fd_render_gpu);

View File

@@ -36,6 +36,6 @@ extern const __DRIimageLoaderExtension dri3_image_loader_extension;
extern struct dri2_egl_display_vtbl dri3_x11_display_vtbl;
bool
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool zink, bool swrast);
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool swrast);
#endif