Module: Mesa
Branch: main
Commit: 3b885926e95ebbf545685890129f7063df5349e0
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b885926e95ebbf545685890129f7063df5349e0

Author: Jianxun Zhang <[email protected]>
Date:   Thu Sep 21 17:09:55 2023 -0700

intel/isl: Add a debug option to override modifer list

Developers can limit supported modifers to a single
modifier provided in INTEL_MODIFIER_OVERRIDE environment
variable for debug purposes. For example, setting it
makes Vulkan CTS only run modifier tests against the
specified modifier instead of all modifiers in production
code.

Signed-off-by: Jianxun Zhang <[email protected]>
Reviewed-by: Nanley Chery <[email protected]>
Acked-by: Rohan Garg <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25651>

---

 docs/envvars.rst        | 8 ++++++++
 src/intel/isl/isl_drm.c | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/docs/envvars.rst b/docs/envvars.rst
index c84ed7a09c5..084e37fa1fd 100644
--- a/docs/envvars.rst
+++ b/docs/envvars.rst
@@ -703,6 +703,14 @@ Intel driver environment variables
 
    ``INTEL_MEASURE=cpu {workload}``
 
+.. envvar:: INTEL_MODIFIER_OVERRIDE
+
+   if set, determines the single DRM modifier reported back to (Vulkan)
+   applications, in order to make selecting modifier deterministic
+   between Vulkan driver and applications. The value can be one of the
+   supported modifiers on a platform, but other values are also acceptable
+   for debug purposes.
+
 .. envvar:: INTEL_NO_HW
 
    if set to 1, true or yes, prevents batches from being submitted to the
diff --git a/src/intel/isl/isl_drm.c b/src/intel/isl/isl_drm.c
index 499acf7921b..2a154e64f12 100644
--- a/src/intel/isl/isl_drm.c
+++ b/src/intel/isl/isl_drm.c
@@ -190,6 +190,14 @@ uint32_t
 isl_drm_modifier_get_score(const struct intel_device_info *devinfo,
                            uint64_t modifier)
 {
+   /* We want to know the absence of the debug environment variable
+    * and don't want to provide a default value either, so we don't
+    * use debug_get_num_option() here.
+    */
+   const char *mod_str = getenv("INTEL_MODIFIER_OVERRIDE");
+   if (mod_str != NULL) {
+      return modifier == strtoul(mod_str, NULL, 0);
+   }
    /* FINISHME: Add gfx12 modifiers */
    switch (modifier) {
    default:

Reply via email to