Mesa (main): intel/dev: fixup max_cs_workgroup_threads after hwconfig is read

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 20 08:12:23 UTC 2022


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

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Wed Jun 15 19:21:23 2022 +0200

intel/dev: fixup max_cs_workgroup_threads after hwconfig is read

Without it we get max value from gfx12 on gfx>12.

Fixes: d9ff9ea9c33 ("intel/dev: Read hwconfig from i915")

Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17063>

---

 src/intel/dev/intel_device_info.c |  8 +++++++-
 src/intel/dev/intel_hwconfig.c    | 24 +++++++-----------------
 src/intel/dev/intel_hwconfig.h    |  2 +-
 3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/src/intel/dev/intel_device_info.c b/src/intel/dev/intel_device_info.c
index e0c63e9acce..286b52b73b6 100644
--- a/src/intel/dev/intel_device_info.c
+++ b/src/intel/dev/intel_device_info.c
@@ -1899,7 +1899,13 @@ intel_get_device_info_from_fd(int fd, struct intel_device_info *devinfo)
       return true;
    }
 
-   intel_get_and_process_hwconfig_table(fd, devinfo);
+   if (intel_get_and_process_hwconfig_table(fd, devinfo)) {
+      /* After applying hwconfig values, some items need to be recalculated. */
+      devinfo->max_cs_threads =
+         devinfo->max_eus_per_subslice * devinfo->num_thread_per_eu;
+
+      update_cs_workgroup_threads(devinfo);
+   }
 
    int timestamp_frequency;
    if (getparam(fd, I915_PARAM_CS_TIMESTAMP_FREQUENCY,
diff --git a/src/intel/dev/intel_hwconfig.c b/src/intel/dev/intel_hwconfig.c
index e2a49fb442d..8d7b0ff5305 100644
--- a/src/intel/dev/intel_hwconfig.c
+++ b/src/intel/dev/intel_hwconfig.c
@@ -272,22 +272,7 @@ apply_hwconfig_item(struct intel_device_info *devinfo,
    }
 }
 
-static void
-intel_apply_hwconfig_table(struct intel_device_info *devinfo,
-                           const struct hwconfig *hwconfig,
-                           int32_t hwconfig_len)
-{
-   intel_process_hwconfig_table(devinfo, hwconfig, hwconfig_len,
-                                apply_hwconfig_item);
-
-   /* After applying hwconfig values, some items need to be recalculated. */
-   if (devinfo->apply_hwconfig) {
-      devinfo->max_cs_threads =
-         devinfo->max_eus_per_subslice * devinfo->num_thread_per_eu;
-   }
-}
-
-void
+bool
 intel_get_and_process_hwconfig_table(int fd,
                                      struct intel_device_info *devinfo)
 {
@@ -296,9 +281,14 @@ intel_get_and_process_hwconfig_table(int fd,
    hwconfig = intel_i915_query_alloc(fd, DRM_I915_QUERY_HWCONFIG_BLOB,
                                      &hwconfig_len);
    if (hwconfig) {
-      intel_apply_hwconfig_table(devinfo, hwconfig, hwconfig_len);
+      intel_process_hwconfig_table(devinfo, hwconfig, hwconfig_len,
+                                   apply_hwconfig_item);
       free(hwconfig);
+      if (devinfo->apply_hwconfig)
+         return true;
    }
+
+   return false;
 }
 
 static void
diff --git a/src/intel/dev/intel_hwconfig.h b/src/intel/dev/intel_hwconfig.h
index 829ebcc982d..a8d63f30917 100644
--- a/src/intel/dev/intel_hwconfig.h
+++ b/src/intel/dev/intel_hwconfig.h
@@ -34,7 +34,7 @@ extern "C" {
 
 struct intel_device_info;
 
-void
+bool
 intel_get_and_process_hwconfig_table(int fd,
                                      struct intel_device_info *devinfo);
 void



More information about the mesa-commit mailing list