diff --git a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
index 1eb9c886479..53440b60af7 100644
--- a/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
+++ b/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h
@@ -1,6 +1,8 @@
// DriConf options supported by all Gallium DRI drivers.
DRI_CONF_SECTION_PERFORMANCE
- DRI_CONF_MESA_GLTHREAD(false)
+ DRI_CONF_MESA_GLTHREAD_DRIVER(false)
+ DRI_CONF_OPT_I(mesa_glthread_app_profile, -1, -1, 1, \
+ "Set an app profile enablement for glthread")
DRI_CONF_MESA_NO_ERROR(false)
DRI_CONF_SECTION_END
diff --git a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
index e8a2b4674a3..185f3716394 100644
--- a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
+++ b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
@@ -1,7 +1,7 @@
// DriConf options specific to radeonsi
DRI_CONF_SECTION_PERFORMANCE
DRI_CONF_ADAPTIVE_SYNC(true)
-DRI_CONF_MESA_GLTHREAD(true)
+DRI_CONF_MESA_GLTHREAD_DRIVER(true)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
diff --git a/src/gallium/drivers/zink/driinfo_zink.h b/src/gallium/drivers/zink/driinfo_zink.h
index 27a0b244a6c..62de73cac59 100644
--- a/src/gallium/drivers/zink/driinfo_zink.h
+++ b/src/gallium/drivers/zink/driinfo_zink.h
@@ -8,7 +8,7 @@ DRI_CONF_SECTION_DEBUG
DRI_CONF_SECTION_END
DRI_CONF_SECTION_PERFORMANCE
-DRI_CONF_MESA_GLTHREAD(true)
+DRI_CONF_MESA_GLTHREAD_DRIVER(true)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
diff --git a/src/gallium/frontends/dri/dri_context.c b/src/gallium/frontends/dri/dri_context.c
index b74fa579bf4..1c1b82bfaa6 100644
--- a/src/gallium/frontends/dri/dri_context.c
+++ b/src/gallium/frontends/dri/dri_context.c
@@ -200,8 +200,28 @@ dri_create_context(struct dri_screen *screen,
ctx->st, st_context_invalidate_state);
}
+ /* order of precedence (least to most):
+ * - driver setting
+ * - app setting
+ * - user setting
+ */
+ bool enable_glthread = driQueryOptionb(&screen->dev->option_cache, "mesa_glthread_driver");
+ int app_enable_glthread = driQueryOptioni(&screen->dev->option_cache, "mesa_glthread_app_profile");
+ if (app_enable_glthread != -1) {
+ /* if set (not -1), apply the app setting */
+ enable_glthread = app_enable_glthread == 1;
+ }
+ if (getenv("mesa_glthread")) {
+ /* only apply the env var if set */
+ bool user_enable_glthread = debug_get_bool_option("mesa_glthread", false);
+ if (user_enable_glthread != enable_glthread) {
+ /* print warning to mimic old behavior */
+ fprintf(stderr, "ATTENTION: default value of option mesa_glthread overridden by environment.");
+ }
+ enable_glthread = user_enable_glthread;
+ }
/* Do this last. */
- if (driQueryOptionb(&screen->dev->option_cache, "mesa_glthread")) {
+ if (enable_glthread) {
bool safe = true;
/* This is only needed by X11/DRI2, which can be unsafe. */
diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf
index f39825cde5d..71baff048b3 100644
--- a/src/util/00-mesa-defaults.conf
+++ b/src/util/00-mesa-defaults.conf
@@ -137,13 +137,13 @@ TODO: document the other workarounds.
-
+
-
+
-
+
@@ -366,7 +366,7 @@ TODO: document the other workarounds.
-
+
@@ -437,247 +437,247 @@ TODO: document the other workarounds.
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -787,7 +787,7 @@ TODO: document the other workarounds.
-
+
@@ -901,7 +901,7 @@ TODO: document the other workarounds.
-
+
@@ -971,7 +971,7 @@ TODO: document the other workarounds.
-
+
diff --git a/src/util/driconf.h b/src/util/driconf.h
index bf92b5d8e1e..446955c3efd 100644
--- a/src/util/driconf.h
+++ b/src/util/driconf.h
@@ -400,8 +400,8 @@
DRI_CONF_OPT_B(vk_xwayland_wait_ready, def, \
"Wait for fences before submitting buffers to Xwayland")
-#define DRI_CONF_MESA_GLTHREAD(def) \
- DRI_CONF_OPT_B(mesa_glthread, def, \
+#define DRI_CONF_MESA_GLTHREAD_DRIVER(def) \
+ DRI_CONF_OPT_B(mesa_glthread_driver, def, \
"Enable offloading GL driver work to a separate thread")
#define DRI_CONF_MESA_NO_ERROR(def) \