diff --git a/src/egl/drivers/dri2/platform_x11.c b/src/egl/drivers/dri2/platform_x11.c index f573f99ac8b..c47bd6fac32 100644 --- a/src/egl/drivers/dri2/platform_x11.c +++ b/src/egl/drivers/dri2/platform_x11.c @@ -1789,8 +1789,7 @@ dri2_x11_check_multibuffers(_EGLDisplay *disp) struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); #ifdef HAVE_X11_DRM - bool err; - dri2_dpy->multibuffers_available = x11_dri3_check_multibuffer(dri2_dpy->conn, &err, &dri2_dpy->explicit_modifiers); + dri2_dpy->multibuffers_available = x11_dri3_has_multibuffer(dri2_dpy->conn); if (disp->Options.Zink && !disp->Options.ForceSoftware && !dri2_dpy->multibuffers_available && diff --git a/src/gallium/auxiliary/vl/vl_winsys_kopper.c b/src/gallium/auxiliary/vl/vl_winsys_kopper.c index f8565b0a4b5..ca2edb28673 100644 --- a/src/gallium/auxiliary/vl/vl_winsys_kopper.c +++ b/src/gallium/auxiliary/vl/vl_winsys_kopper.c @@ -168,7 +168,6 @@ vl_kopper_screen_create_x11(Display *display, int screen) xcb_get_geometry_cookie_t geom_cookie; xcb_get_geometry_reply_t *geom_reply; struct vl_kopper_screen *scrn = CALLOC_STRUCT(vl_kopper_screen); - bool err = false; if (!scrn) goto error; @@ -177,9 +176,8 @@ vl_kopper_screen_create_x11(Display *display, int screen) goto error; int fd = x11_dri3_open(scrn->conn, RootWindow(display, screen), 0); - bool explicit_modifiers = false; - x11_dri3_check_multibuffer(scrn->conn, &err, &explicit_modifiers); - if (fd < 0 || !explicit_modifiers) { + bool has_multibuffer = x11_dri3_has_multibuffer(scrn->conn); + if (fd < 0 || !has_multibuffer) { goto error; } diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h index 97c5bc093f9..121f09707ea 100644 --- a/src/glx/glxclient.h +++ b/src/glx/glxclient.h @@ -600,7 +600,6 @@ struct glx_display __glxHashTable *dri2Hash; bool has_multibuffer; - bool has_explicit_modifiers; #endif #ifdef GLX_USE_WINDOWSGL __GLXDRIdisplay *windowsdriDisplay; diff --git a/src/glx/glxext.c b/src/glx/glxext.c index f56b530c856..fa2399c513b 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -1016,7 +1016,7 @@ __glXInitialize(Display * dpy) #if defined(GLX_USE_DRM) bool dri3_err = false; if (glx_direct && glx_accel && dri3) - dpyPriv->has_multibuffer = x11_dri3_check_multibuffer(XGetXCBConnection(dpy), &dri3_err, &dpyPriv->has_explicit_modifiers); + dpyPriv->has_multibuffer = x11_dri3_has_multibuffer(XGetXCBConnection(dpy)); if (glx_direct && glx_accel && (!(glx_driver & GLX_DRIVER_ZINK_YES) || !kopper)) { if (dri3) { @@ -1043,7 +1043,7 @@ __glXInitialize(Display * dpy) glx_driver |= GLX_DRIVER_SW; #if !defined(GLX_USE_APPLE) - if (!dpyPriv->has_explicit_modifiers && glx_accel && !debug_get_bool_option("LIBGL_KOPPER_DRI2", false)) { + if (!dpyPriv->has_multibuffer && glx_accel && !debug_get_bool_option("LIBGL_KOPPER_DRI2", false)) { if (glx_driver & GLX_DRIVER_ZINK_YES) { /* only print error if zink was explicitly requested */ CriticalErrorMessageF("DRI3 not available\n"); diff --git a/src/x11/loader_x11.c b/src/x11/loader_x11.c index 75eb560595f..9477ec9a404 100644 --- a/src/x11/loader_x11.c +++ b/src/x11/loader_x11.c @@ -93,7 +93,7 @@ x11_dri3_open(xcb_connection_t *conn, #endif bool -x11_dri3_check_multibuffer(xcb_connection_t *c, bool *err, bool *explicit_modifiers) +x11_dri3_has_multibuffer(xcb_connection_t *c) { xcb_dri3_query_version_cookie_t dri3_cookie; xcb_dri3_query_version_reply_t *dri3_reply; @@ -107,11 +107,11 @@ x11_dri3_check_multibuffer(xcb_connection_t *c, bool *err, bool *explicit_modifi extension = xcb_get_extension_data(c, &xcb_dri3_id); if (!(extension && extension->present)) - goto error; + return false; extension = xcb_get_extension_data(c, &xcb_present_id); if (!(extension && extension->present)) - goto error; + return false; dri3_cookie = xcb_dri3_query_version(c, DRI3_SUPPORTED_MAJOR, @@ -123,7 +123,7 @@ x11_dri3_check_multibuffer(xcb_connection_t *c, bool *err, bool *explicit_modifi dri3_reply = xcb_dri3_query_version_reply(c, dri3_cookie, &error); if (!dri3_reply) { free(error); - goto error; + return false; } int dri3Major = dri3_reply->major_version; @@ -133,21 +133,12 @@ x11_dri3_check_multibuffer(xcb_connection_t *c, bool *err, bool *explicit_modifi present_reply = xcb_present_query_version_reply(c, present_cookie, &error); if (!present_reply) { free(error); - goto error; + return false; } int presentMajor = present_reply->major_version; int presentMinor = present_reply->minor_version; free(present_reply); -#ifdef HAVE_X11_DRM - if (presentMajor > 1 || (presentMajor == 1 && presentMinor >= 2)) { - *explicit_modifiers = dri3Major > 1 || (dri3Major == 1 && dri3Minor >= 2); - if (dri3Major >= 1) - return true; - } -#endif - return false; -error: - *err = true; - return false; + return (presentMajor > 1 || (presentMajor == 1 && presentMinor >= 2)) && + (dri3Major > 1 || (dri3Major == 1 && dri3Minor >= 2)); } diff --git a/src/x11/loader_x11.h b/src/x11/loader_x11.h index 5aa6262aa1d..c1cfa7e2ea6 100644 --- a/src/x11/loader_x11.h +++ b/src/x11/loader_x11.h @@ -27,6 +27,6 @@ #include #include int x11_dri3_open(xcb_connection_t *conn, xcb_window_t root, uint32_t provider); -bool x11_dri3_check_multibuffer(xcb_connection_t *c, bool *err, bool *explicit_modifiers); +bool x11_dri3_has_multibuffer(xcb_connection_t *c); #endif