intel/dev: Add intel_check_hwconfig_items()

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: a4c5bfd34c ("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>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32359>
This commit is contained in:
Jordan Justen
2024-11-26 16:17:52 -08:00
committed by Marge Bot
parent 4eb10bc25e
commit 1027b071f9
3 changed files with 43 additions and 22 deletions

View File

@@ -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;
}

View File

@@ -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);
}
static struct hwconfig *
intel_get_hwconfig_table(int fd, struct intel_device_info *devinfo,
int32_t *hwconfig_len)
{
switch (devinfo->kmd_type) {
case INTEL_KMD_TYPE_I915:
return intel_device_info_i915_query_hwconfig(fd, hwconfig_len);
case INTEL_KMD_TYPE_XE:
return intel_device_info_xe_query_hwconfig(fd, hwconfig_len);
default:
unreachable("unknown kmd type");
return NULL;
}
}
void
intel_get_and_print_hwconfig_table(int fd, struct intel_device_info *devinfo)
{
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;
case INTEL_KMD_TYPE_XE:
hwconfig = intel_device_info_xe_query_hwconfig(fd, &hwconfig_len);
break;
default:
unreachable("unknown kmd type");
break;
}
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
}

View File

@@ -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