egl/x11: hoist up dri2_get_xcb_connection call

but not out of dri2 init since that's a new display

Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33891>
This commit is contained in:
Mike Blumenkrantz 2024-08-27 12:30:15 -04:00 committed by Marge Bot
parent cea4c94d17
commit eca51b7978

View file

@ -1766,9 +1766,6 @@ dri2_initialize_x11_swrast(_EGLDisplay *disp)
{
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;
/*
* Every hardware driver_name is set using strdup. Doing the same in
* here will allow is to simply free the memory at dri2_terminate().
@ -1857,9 +1854,6 @@ dri2_initialize_x11_dri3(_EGLDisplay *disp)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
enum dri2_egl_driver_fail status = DRI2_EGL_DRIVER_FAILED;
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;
status = dri3_x11_connect(dri2_dpy, disp->Options.Zink, disp->Options.ForceSoftware);
if (status != DRI2_EGL_DRIVER_LOADED)
goto cleanup;
@ -1955,7 +1949,7 @@ dri2_initialize_x11_dri2(_EGLDisplay *disp)
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;
return EGL_FALSE;
if (!dri2_x11_connect(dri2_dpy))
goto cleanup;
@ -2018,6 +2012,12 @@ EGLBoolean
dri2_initialize_x11(_EGLDisplay *disp, bool *allow_dri2)
{
enum dri2_egl_driver_fail status = DRI2_EGL_DRIVER_FAILED;
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
if (!dri2_get_xcb_connection(disp, dri2_dpy))
return EGL_FALSE;
if (disp->Options.ForceSoftware ||
(disp->Options.Zink && !debug_get_bool_option("LIBGL_KOPPER_DISABLE", false)))
return dri2_initialize_x11_swrast(disp);