summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2024-11-26 16:17:52 -0800
committerJordan Justen <jordan.l.justen@intel.com>2024-11-26 16:36:49 -0800
commit55d3b02e2ceda094f9dd97aa410651fd83440639 (patch)
treea6455585de3caf0d19a8b1584d841f0595c2d10d
parenta3259f490e22bf3ca57b93fd4238ba200b5967af (diff)
intel/dev: Add intel_check_hwconfig_items()fix-hwconfig-warnings
Rather than checking hwconfig items when using them, wait until after devinfo has been fully initialized. This includes having workarounds implemented. We can then check if the hwconfig data and final Mesa initialization agree. If the match fails, we need to investigate if Mesa or the hwconfig data is wrong. This code becomes a no-op when not on a release build. Fixes: a4c5bfd34ca ("intel/dev: Use hwconfig for urb min/max entry values") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12141 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r--src/intel/dev/intel_device_info.c3
-rw-r--r--src/intel/dev/intel_hwconfig.c56
-rw-r--r--src/intel/dev/intel_hwconfig.h2
3 files changed, 41 insertions, 20 deletions
diff --git a/src/intel/dev/intel_device_info.c b/src/intel/dev/intel_device_info.c
index 6e9fafe51ff..051ade43061 100644
--- a/src/intel/dev/intel_device_info.c
+++ b/src/intel/dev/intel_device_info.c
@@ -31,6 +31,7 @@
#include "util/libdrm.h"
#include "intel_device_info.h"
+#include "intel_hwconfig.h"
#include "intel_wa.h"
#include "i915/intel_device_info.h"
#include "xe/intel_device_info.h"
@@ -1969,6 +1970,8 @@ intel_get_device_info_from_fd(int fd, struct intel_device_info *devinfo, int min
intel_device_info_init_was(devinfo);
intel_device_info_apply_workarounds(devinfo);
+ intel_check_hwconfig_items(fd, devinfo);
+
return true;
}
diff --git a/src/intel/dev/intel_hwconfig.c b/src/intel/dev/intel_hwconfig.c
index 8401e397993..7c66943b66b 100644
--- a/src/intel/dev/intel_hwconfig.c
+++ b/src/intel/dev/intel_hwconfig.c
@@ -333,22 +333,12 @@ apply_hwconfig_item(struct intel_device_info *devinfo,
process_hwconfig_item(devinfo, item, false);
}
-UNUSED static void
-check_hwconfig_item(struct intel_device_info *devinfo,
- const struct hwconfig *item)
-{
- process_hwconfig_item(devinfo, item, true);
-}
-
bool
intel_hwconfig_process_table(struct intel_device_info *devinfo,
void *data, int32_t len)
{
if (apply_hwconfig(devinfo))
process_hwconfig_table(devinfo, data, len, apply_hwconfig_item);
-#ifndef NDEBUG
- process_hwconfig_table(devinfo, data, len, check_hwconfig_item);
-#endif
return apply_hwconfig(devinfo);
}
@@ -371,26 +361,52 @@ intel_print_hwconfig_table(const struct hwconfig *hwconfig,
process_hwconfig_table(NULL, hwconfig, hwconfig_len, print_hwconfig_item);
}
-void
-intel_get_and_print_hwconfig_table(int fd, struct intel_device_info *devinfo)
+static struct hwconfig *
+intel_get_hwconfig_table(int fd, struct intel_device_info *devinfo,
+ int32_t *hwconfig_len)
{
- struct hwconfig *hwconfig;
- int32_t hwconfig_len = 0;
-
switch (devinfo->kmd_type) {
case INTEL_KMD_TYPE_I915:
- hwconfig = intel_device_info_i915_query_hwconfig(fd, &hwconfig_len);
- break;
+ return intel_device_info_i915_query_hwconfig(fd, hwconfig_len);
case INTEL_KMD_TYPE_XE:
- hwconfig = intel_device_info_xe_query_hwconfig(fd, &hwconfig_len);
- break;
+ return intel_device_info_xe_query_hwconfig(fd, hwconfig_len);
default:
unreachable("unknown kmd type");
- break;
+ return NULL;
}
+}
+void
+intel_get_and_print_hwconfig_table(int fd, struct intel_device_info *devinfo)
+{
+ struct hwconfig *hwconfig;
+ int32_t hwconfig_len = 0;
+
+ hwconfig = intel_get_hwconfig_table(fd, devinfo, &hwconfig_len);
if (hwconfig) {
intel_print_hwconfig_table(hwconfig, hwconfig_len);
free(hwconfig);
}
}
+
+UNUSED static void
+check_hwconfig_item(struct intel_device_info *devinfo,
+ const struct hwconfig *item)
+{
+ process_hwconfig_item(devinfo, item, true);
+}
+
+void
+intel_check_hwconfig_items(int fd, struct intel_device_info *devinfo)
+{
+#ifndef NDEBUG
+ struct hwconfig *data;
+ int32_t len = 0;
+
+ data = intel_get_hwconfig_table(fd, devinfo, &len);
+ if (data) {
+ process_hwconfig_table(devinfo, data, len, check_hwconfig_item);
+ free(data);
+ }
+#endif
+}
diff --git a/src/intel/dev/intel_hwconfig.h b/src/intel/dev/intel_hwconfig.h
index c85d7cd62cc..a9854188b30 100644
--- a/src/intel/dev/intel_hwconfig.h
+++ b/src/intel/dev/intel_hwconfig.h
@@ -38,6 +38,8 @@ bool
intel_hwconfig_process_table(struct intel_device_info *devinfo, void *data,
int32_t len);
void
+intel_check_hwconfig_items(int fd, struct intel_device_info *devinfo);
+void
intel_get_and_print_hwconfig_table(int fd, struct intel_device_info *devinfo);
#ifdef __cplusplus