glx: fix indirect initialization crash
authorIllia Polishchuk <illia.a.polishchuk@globallogic.com>
Tue, 28 Feb 2023 14:07:59 +0000 (16:07 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 1 Mar 2023 19:54:00 +0000 (19:54 +0000)
Fixes: b090246a ("glx: Only compute client GL extensions for indirect contexts")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8393

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21591>

src/glx/glxext.c
src/glx/indirect_glx.c

index 755a75a..4b3496b 100644 (file)
@@ -813,10 +813,17 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
       if (psc == NULL)
          psc = applegl_create_screen(i, priv);
 #else
+      bool indirect = false;
       if (psc == NULL)
-        psc = indirect_create_screen(i, priv);
+      {
+         psc = indirect_create_screen(i, priv);
+         indirect = true;
+      }
 #endif
       priv->screens[i] = psc;
+
+      if(indirect) /* Load extensions required only for indirect glx */
+         glxSendClientInfo(priv, i);
    }
    SyncHandle();
    return GL_TRUE;
index dc3464f..abe561f 100644 (file)
@@ -365,7 +365,6 @@ indirect_create_screen(int screen, struct glx_display * priv)
       return NULL;
 
    glx_screen_init(psc, screen, priv);
-   glxSendClientInfo(priv, screen);
    psc->vtable = &indirect_screen_vtable;
 
    return psc;