mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-16 23:30:35 +01:00
egl: fix zink init
* close(fd) requires also resetting the fd=-1 or else boom
* checking just driver_name is broken because loader_get_driver_for_fd()
uses MESA_LOADER_DRIVER_OVERRIDE, so there's no way to differentiate
an inferred load
Fixes: b907eb4750 ("egl: don't bind zink under dri2/3")
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30556>
This commit is contained in:
parent
ad2e523817
commit
1a579552af
3 changed files with 7 additions and 6 deletions
|
|
@ -1813,7 +1813,7 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
|
|||
if (disp->Options.Zink &&
|
||||
!debug_get_bool_option("LIBGL_DRI3_DISABLE", false) &&
|
||||
!debug_get_bool_option("LIBGL_KOPPER_DRI2", false))
|
||||
dri3_x11_connect(dri2_dpy, disp->Options.ForceSoftware);
|
||||
dri3_x11_connect(dri2_dpy, disp->Options.Zink, disp->Options.ForceSoftware);
|
||||
#endif
|
||||
if (!dri2_load_driver(disp))
|
||||
goto cleanup;
|
||||
|
|
@ -1898,7 +1898,7 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
|
|||
if (!dri2_get_xcb_connection(disp, dri2_dpy))
|
||||
goto cleanup;
|
||||
|
||||
status = dri3_x11_connect(dri2_dpy, disp->Options.ForceSoftware);
|
||||
status = dri3_x11_connect(dri2_dpy, disp->Options.Zink, disp->Options.ForceSoftware);
|
||||
if (status != DRI2_EGL_DRIVER_LOADED)
|
||||
goto cleanup;
|
||||
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ struct dri2_egl_display_vtbl dri3_x11_display_vtbl = {
|
|||
};
|
||||
|
||||
enum dri2_egl_driver_fail
|
||||
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool swrast)
|
||||
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool zink, bool swrast)
|
||||
{
|
||||
dri2_dpy->fd_render_gpu =
|
||||
x11_dri3_open(dri2_dpy->conn, dri2_dpy->screen->root, 0);
|
||||
|
|
@ -550,15 +550,16 @@ dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool swrast)
|
|||
if (!dri2_dpy->driver_name)
|
||||
dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd_render_gpu);
|
||||
|
||||
if (!strcmp(dri2_dpy->driver_name, "zink") &&
|
||||
!debug_get_bool_option("LIBGL_KOPPER_DISABLE", false)) {
|
||||
if (!zink && !strcmp(dri2_dpy->driver_name, "zink")) {
|
||||
close(dri2_dpy->fd_render_gpu);
|
||||
dri2_dpy->fd_render_gpu = -1;
|
||||
return DRI2_EGL_DRIVER_PREFER_ZINK;
|
||||
}
|
||||
|
||||
if (!dri2_dpy->driver_name) {
|
||||
_eglLog(_EGL_WARNING, "DRI3: No driver found");
|
||||
close(dri2_dpy->fd_render_gpu);
|
||||
dri2_dpy->fd_render_gpu = -1;
|
||||
return DRI2_EGL_DRIVER_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,6 @@ extern const __DRIimageLoaderExtension dri3_image_loader_extension;
|
|||
extern struct dri2_egl_display_vtbl dri3_x11_display_vtbl;
|
||||
|
||||
enum dri2_egl_driver_fail
|
||||
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool swrast);
|
||||
dri3_x11_connect(struct dri2_egl_display *dri2_dpy, bool zink, bool swrast);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue