driconf: add a way to override indirect-GL extensions

Support for DRI1 is not implemented, but who still uses that?

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Martin Peres <martin.peres@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7212>
diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt
index f4e80eb..9cc3008 100644
--- a/docs/relnotes/new_features.txt
+++ b/docs/relnotes/new_features.txt
@@ -12,3 +12,4 @@
 NGG GS support in ACO
 VK_KHR_shader_terminate_invocation on ANV
 driconf: add glx_extension_override
+driconf: add indirect_gl_extension_override
diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index 6691b2f..95e27bc 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -38,6 +38,7 @@
    DRI_CONF_FORCE_GL_VENDOR()
    DRI_CONF_OVERRIDE_VRAM_SIZE()
    DRI_CONF_GLX_EXTENSION_OVERRIDE()
+   DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE()
 DRI_CONF_SECTION_END
 
 DRI_CONF_SECTION_MISCELLANEOUS
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index e449f34..a42de14 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1367,6 +1367,12 @@
                                     &tmp) == 0)
       __glXParseExtensionOverride(&psc->base, tmp);
 
+   if (psc->config->base.version > 1 &&
+          psc->config->configQuerys(psc->driScreen,
+                                    "indirect_gl_extension_override",
+                                    &tmp) == 0)
+      __IndirectGlParseExtensionOverride(&psc->base, tmp);
+
    /* DRI2 supports SubBuffer through DRI2CopyRegion, so it's always
     * available.*/
    psp->copySubBuffer = dri2CopySubBuffer;
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 9793387..394fdfa 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -1003,6 +1003,12 @@
                                     &tmp) == 0)
       __glXParseExtensionOverride(&psc->base, tmp);
 
+   if (psc->config->base.version > 1 &&
+          psc->config->configQuerys(psc->driScreen,
+                                    "indirect_gl_extension_override",
+                                    &tmp) == 0)
+      __IndirectGlParseExtensionOverride(&psc->base, tmp);
+
    free(driverName);
 
    tmp = getenv("LIBGL_SHOW_FPS");
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 1bea3d1..e2a1124 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -54,6 +54,7 @@
 driOptionDescription __dri2ConfigOptions[] = {
       DRI_CONF_SECTION_DEBUG
          DRI_CONF_GLX_EXTENSION_OVERRIDE()
+         DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE()
       DRI_CONF_SECTION_END
 
       DRI_CONF_SECTION_PERFORMANCE
diff --git a/src/util/driconf.h b/src/util/driconf.h
index 326d58c..c67b0b6 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -221,6 +221,9 @@
    DRI_CONF_OPT_S(glx_extension_override, def, \
                   "Allow enabling/disabling a list of GLX extensions")
 
+#define DRI_CONF_INDIRECT_GL_EXTENSION_OVERRIDE(def) \
+   DRI_CONF_OPT_S(indirect_gl_extension_override, def, \
+                  "Allow enabling/disabling a list of indirect-GL extensions")
 
 
 /**