glx: move has_multibuffer to base glx_screen struct

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30375>
This commit is contained in:
Mike Blumenkrantz
2024-07-19 08:47:39 -04:00
committed by Marge Bot
parent 54e234ee2b
commit 2126a48149
3 changed files with 8 additions and 14 deletions
+1 -10
View File
@@ -345,10 +345,6 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
struct dri3_screen *psc = (struct dri3_screen *) base;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
bool has_multibuffer = false;
#ifdef HAVE_DRI3_MODIFIERS
const struct dri3_display *const pdp = (struct dri3_display *)
base->display->dri3Display;
#endif
pdraw = calloc(1, sizeof(*pdraw));
if (!pdraw)
@@ -360,7 +356,7 @@ dri3_create_drawable(struct glx_screen *base, XID xDrawable,
pdraw->base.psc = &psc->base;
#ifdef HAVE_DRI3_MODIFIERS
if (pdp->has_multibuffer && psc->image && psc->image->base.version >= 15)
if (base->display->has_multibuffer && psc->image && psc->image->base.version >= 15)
has_multibuffer = true;
#endif
@@ -1060,15 +1056,10 @@ _X_HIDDEN __GLXDRIdisplay *
dri3_create_display(Display * dpy)
{
struct dri3_display *pdp;
bool err = false;
bool has_multibuffer = loader_dri3_check_multibuffer(XGetXCBConnection(dpy), &err);
if (err)
return NULL;
pdp = calloc(1, sizeof *pdp);
if (pdp == NULL)
return NULL;
pdp->has_multibuffer = has_multibuffer;
return (void*)pdp;
}
+1
View File
@@ -606,6 +606,7 @@ struct glx_display
__GLXDRIdisplay *driswDisplay;
__GLXDRIdisplay *dri2Display;
__GLXDRIdisplay *dri3Display;
bool has_multibuffer;
#endif
#ifdef GLX_USE_WINDOWSGL
__GLXDRIdisplay *windowsdriDisplay;
+6 -4
View File
@@ -903,6 +903,7 @@ __glXInitialize(Display * dpy)
#if defined(GLX_DIRECT_RENDERING) && (!defined(GLX_USE_APPLEGL) || defined(GLX_USE_APPLE))
Bool glx_direct = !debug_get_bool_option("LIBGL_ALWAYS_INDIRECT", false);
Bool glx_accel = !debug_get_bool_option("LIBGL_ALWAYS_SOFTWARE", false);
Bool dri3 = !debug_get_bool_option("LIBGL_DRI3_DISABLE", false);
if (env && !strcmp(env, "zink"))
glx_driver |= GLX_DRIVER_ZINK_YES;
@@ -920,14 +921,15 @@ __glXInitialize(Display * dpy)
** (e.g., those called in AllocAndFetchScreenConfigs).
*/
#if defined(GLX_USE_DRM)
bool dri3_err = false;
if (glx_direct && glx_accel && dri3)
dpyPriv->has_multibuffer = loader_dri3_check_multibuffer(XGetXCBConnection(dpy), &dri3_err);
if (glx_direct && glx_accel &&
(!(glx_driver & GLX_DRIVER_ZINK_YES) || debug_get_bool_option("LIBGL_KOPPER_DISABLE", false))) {
#if defined(HAVE_DRI3)
if (!debug_get_bool_option("LIBGL_DRI3_DISABLE", false)) {
bool err = false;
loader_dri3_check_multibuffer(XGetXCBConnection(dpy), &err);
if (dri3) {
/* dri3 is tried as long as this doesn't error; whether modifiers work is not relevant */
if (!err) {
if (!dri3_err) {
glx_driver |= GLX_DRIVER_DRI3;
/* nouveau wants to fallback to zink so if we get a screen enable try_zink */
if (!debug_get_bool_option("LIBGL_KOPPER_DISABLE", false))