mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
glx/egl/x11: fix x11_dri3_check_multibuffer
glx/egl "multibuffers" denotes if server side support DRI3 multi plane and modifiers which is version >= 1.2. But now it returns true just when DRI3 version >= 1. This causes problem when xserver with amdgpu DDX which only support DRI3 1.0, so "multibuffers" gets set unexpectedly, and client send DRI3 >= 1.2 request to server which gets unimplemented error. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31657>
This commit is contained in:
parent
746381f870
commit
2a1ae6d94b
6 changed files with 13 additions and 26 deletions
|
|
@ -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 &&
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -600,7 +600,6 @@ struct glx_display
|
|||
|
||||
__glxHashTable *dri2Hash;
|
||||
bool has_multibuffer;
|
||||
bool has_explicit_modifiers;
|
||||
#endif
|
||||
#ifdef GLX_USE_WINDOWSGL
|
||||
__GLXDRIdisplay *windowsdriDisplay;
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,6 @@
|
|||
#include <xcb/xcb.h>
|
||||
#include <inttypes.h>
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue