File 0004-glx-pass-implicit-load-param-through-allocation.patch of Package Mesa

From e7c5f94a79ff0e545dfdc95703a541a0d43d739f Mon Sep 17 00:00:00 2001
From: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Date: Tue, 12 Mar 2024 09:42:06 -0400
Subject: [PATCH 4/9] glx: pass implicit load param through allocation

---
 src/glx/glxext.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: mesa-24.0.3/src/glx/glxext.c
===================================================================
--- mesa-24.0.3.orig/src/glx/glxext.c
+++ mesa-24.0.3/src/glx/glxext.c
@@ -763,7 +763,7 @@ glx_screen_cleanup(struct glx_screen *ps
 ** If that works then fetch the per screen configs data.
 */
 static Bool
-AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, Bool zink)
+AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv, Bool zink, Bool implicit)
 {
    struct glx_screen *psc;
    GLint i, screens;
@@ -783,19 +783,19 @@ AllocAndFetchScreenConfigs(Display * dpy
 #if defined(GLX_USE_DRM)
 #if defined(HAVE_DRI3)
       if (priv->dri3Display)
-         psc = priv->dri3Display->createScreen(i, priv, false);
+         psc = priv->dri3Display->createScreen(i, priv, implicit);
 #endif /* HAVE_DRI3 */
       if (psc == NULL && priv->dri2Display)
-	     psc = priv->dri2Display->createScreen(i, priv, false);
+	     psc = priv->dri2Display->createScreen(i, priv, implicit);
 #endif /* GLX_USE_DRM */
 
 #ifdef GLX_USE_WINDOWSGL
       if (psc == NULL && priv->windowsdriDisplay)
-	     psc = priv->windowsdriDisplay->createScreen(i, priv, false);
+	     psc = priv->windowsdriDisplay->createScreen(i, priv, implicit);
 #endif
 
       if (psc == NULL && priv->driswDisplay)
-	     psc = priv->driswDisplay->createScreen(i, priv, false);
+	     psc = priv->driswDisplay->createScreen(i, priv, psc == GLX_LOADER_USE_ZINK ? false : implicit);
 #endif /* GLX_DIRECT_RENDERING && !GLX_USE_APPLEGL */
 
       bool indirect = false;
@@ -929,14 +929,14 @@ __glXInitialize(Display * dpy)
    }
 #endif
 
-   if (!AllocAndFetchScreenConfigs(dpy, dpyPriv, zink | try_zink)) {
+   if (!AllocAndFetchScreenConfigs(dpy, dpyPriv, zink | try_zink, zink || try_zink ? try_zink : !env)) {
       Bool fail = True;
 #if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
       if (try_zink) {
          free(dpyPriv->screens);
          dpyPriv->driswDisplay->destroyDisplay(dpyPriv->driswDisplay);
          dpyPriv->driswDisplay = driswCreateDisplay(dpy, false);
-         fail = !AllocAndFetchScreenConfigs(dpy, dpyPriv, False);
+         fail = !AllocAndFetchScreenConfigs(dpy, dpyPriv, False, true);
       }
 #endif
       if (fail) {
Index: mesa-24.0.3/src/glx/glxclient.h
===================================================================
--- mesa-24.0.3.orig/src/glx/glxclient.h
+++ mesa-24.0.3/src/glx/glxclient.h
@@ -78,6 +78,8 @@ typedef struct __GLXDRIdisplayRec __GLXD
 typedef struct __GLXDRIscreenRec __GLXDRIscreen;
 typedef struct __GLXDRIdrawableRec __GLXDRIdrawable;
 
+#define GLX_LOADER_USE_ZINK ((struct glx_screen *)(uintptr_t)-1)
+
 struct __GLXDRIdisplayRec
 {
     /**
openSUSE Build Service is sponsored by